Differential D9809 Diff 25413 plugins/custom-definesandincludes/compilerprovider/widget/compilerswidget.cpp
Changeset View
Changeset View
Standalone View
Standalone View
plugins/custom-definesandincludes/compilerprovider/widget/compilerswidget.cpp
Show All 27 Lines | |||||
28 | #include <KLineEdit> | 28 | #include <KLineEdit> | ||
29 | #endif | 29 | #endif | ||
30 | 30 | | |||
31 | #include <QAction> | 31 | #include <QAction> | ||
32 | #include <KLocalizedString> | 32 | #include <KLocalizedString> | ||
33 | #include <QKeySequence> | 33 | #include <QKeySequence> | ||
34 | #include <QMenu> | 34 | #include <QMenu> | ||
35 | #include <QSignalMapper> | 35 | #include <QSignalMapper> | ||
36 | #include <QSignalBlocker> | ||||
36 | 37 | | |||
37 | #include "ui_compilerswidget.h" | 38 | #include "ui_compilerswidget.h" | ||
38 | #include "compilersmodel.h" | 39 | #include "compilersmodel.h" | ||
39 | #include "../compilerprovider/settingsmanager.h" | 40 | #include "../compilerprovider/settingsmanager.h" | ||
40 | #include "../compilerprovider/compilerprovider.h" | 41 | #include "../compilerprovider/compilerprovider.h" | ||
41 | #include <debug.h> | 42 | #include <debug.h> | ||
42 | 43 | | |||
43 | using namespace KDevelop; | 44 | using namespace KDevelop; | ||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Line(s) | 157 | { | |||
157 | return m_compilersModel->compilers(); | 158 | return m_compilersModel->compilers(); | ||
158 | } | 159 | } | ||
159 | 160 | | |||
160 | void CompilersWidget::compilerSelected(const QModelIndex& index) | 161 | void CompilersWidget::compilerSelected(const QModelIndex& index) | ||
161 | { | 162 | { | ||
162 | auto compiler = index.data(CompilersModel::CompilerDataRole); | 163 | auto compiler = index.data(CompilersModel::CompilerDataRole); | ||
163 | if (compiler.value<CompilerPointer>()) { | 164 | if (compiler.value<CompilerPointer>()) { | ||
164 | m_ui->compilerName->setText(compiler.value<CompilerPointer>()->name()); | 165 | m_ui->compilerName->setText(compiler.value<CompilerPointer>()->name()); | ||
166 | | ||||
167 | //NOTE: there is a bug in kLineEdit, which causes textEdited signal to be | ||||
168 | // spuriously emitted on calling setText(). See bug report here: | ||||
169 | // https://bugs.kde.org/show_bug.cgi?id=388798 | ||||
170 | // The resulting spurious call of compilerEdited then fails with an assert. | ||||
171 | //Work around this bug until it is fixed upstream by disabling signals here | ||||
anthonyfieroni: Prefer to use
```
const QSignalBlocker blocker(m_ui->compilerPath); | |||||
172 | const QSignalBlocker blocker(m_ui->compilerPath); | ||||
165 | m_ui->compilerPath->setText(compiler.value<CompilerPointer>()->path()); | 173 | m_ui->compilerPath->setText(compiler.value<CompilerPointer>()->path()); | ||
174 | | ||||
166 | enableItems(true); | 175 | enableItems(true); | ||
167 | } else { | 176 | } else { | ||
168 | enableItems(false); | 177 | enableItems(false); | ||
169 | } | 178 | } | ||
170 | } | 179 | } | ||
171 | 180 | | |||
172 | void CompilersWidget::compilerEdited() | 181 | void CompilersWidget::compilerEdited() | ||
173 | { | 182 | { | ||
Show All 15 Lines | |||||
189 | 198 | | |||
190 | void CompilersWidget::enableItems(bool enable) | 199 | void CompilersWidget::enableItems(bool enable) | ||
191 | { | 200 | { | ||
192 | m_ui->compilerName->setEnabled(enable); | 201 | m_ui->compilerName->setEnabled(enable); | ||
193 | m_ui->compilerPath->setEnabled(enable); | 202 | m_ui->compilerPath->setEnabled(enable); | ||
194 | 203 | | |||
195 | if(!enable) { | 204 | if(!enable) { | ||
196 | m_ui->compilerName->clear(); | 205 | m_ui->compilerName->clear(); | ||
206 | | ||||
207 | //NOTE: this is to work around the | ||||
208 | //spurious signal bug in kLineEdit | ||||
209 | const QSignalBlocker blocker(m_ui->compilerPath); | ||||
anthonyfieroni: dito | |||||
197 | m_ui->compilerPath->clear(); | 210 | m_ui->compilerPath->clear(); | ||
198 | } | 211 | } | ||
199 | } | 212 | } | ||
200 | 213 | | |||
201 | void CompilersWidget::reset() | 214 | void CompilersWidget::reset() | ||
202 | { | 215 | { | ||
203 | auto settings = SettingsManager::globalInstance(); | 216 | auto settings = SettingsManager::globalInstance(); | ||
204 | setCompilers(settings->provider()->compilers()); | 217 | setCompilers(settings->provider()->compilers()); | ||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |
Prefer to use