Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 331 lines (290 sloc) 11.268 kb
b39c154 Began implementing a simple Qt based GUI.
Vesa Pikki authored
1 /*
2 * Cppcheck - A tool for static C/C++ code analysis
8cae17f Reijo Tomperi Update year to 2012
aggro80 authored
3 * Copyright (C) 2007-2012 Daniel Marjamäki and Cppcheck team.
b39c154 Began implementing a simple Qt based GUI.
Vesa Pikki authored
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
fdde218 Reijo Tomperi Fix GPL comments in all files. ">." was missing from the end.
aggro80 authored
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b39c154 Began implementing a simple Qt based GUI.
Vesa Pikki authored
17 */
18
19
13eb741 Kimmo Varis GUI: Make mainwindow parent of Settings-dialog.
kimmov authored
20 #include <QDialog>
21 #include <QWidget>
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
22 #include <QLabel>
c80c709 Kimmo Varis Add missing include lines.
kimmov authored
23 #include <QList>
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
24 #include <QDebug>
c80c709 Kimmo Varis Add missing include lines.
kimmov authored
25 #include <QListWidgetItem>
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
26 #include <QTabWidget>
3261f84 Kimmo Varis GUI: Fix includes for dialogs/views.
kimmov authored
27 #include <QSettings>
2dfa1d5 Kimmo Varis GUI: Add Setting for global include paths.
kimmov authored
28 #include <QFileDialog>
46c0397 Kimmo Varis GUI: Show ideal thread count next to current thread count.
kimmov authored
29 #include <QThread>
3261f84 Kimmo Varis GUI: Fix includes for dialogs/views.
kimmov authored
30 #include "settingsdialog.h"
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
31 #include "applicationdialog.h"
3261f84 Kimmo Varis GUI: Fix includes for dialogs/views.
kimmov authored
32 #include "applicationlist.h"
29d6b44 Kimmo Varis GUI: Add language selection panel to settings-dialog.
kimmov authored
33 #include "translationhandler.h"
ebfa55b vesap Began adding translations and using Qt Designer .ui files.
vesap authored
34 #include "common.h"
b39c154 Began implementing a simple Qt based GUI.
Vesa Pikki authored
35
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
36 SettingsDialog::SettingsDialog(ApplicationList *list,
29d6b44 Kimmo Varis GUI: Add language selection panel to settings-dialog.
kimmov authored
37 TranslationHandler *translator,
13eb741 Kimmo Varis GUI: Make mainwindow parent of Settings-dialog.
kimmov authored
38 QWidget *parent) :
c718a7c Daniel Marjamäki astyle: Update to astyle 1.24
authored
39 QDialog(parent),
40 mApplications(list),
012b070 Kimmo Varis GUI: Fix compiler warning from GCC.
kimmov authored
41 mTempApplications(new ApplicationList(this)),
42 mTranslator(translator)
b39c154 Began implementing a simple Qt based GUI.
Vesa Pikki authored
43 {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
44 mUI.setupUi(this);
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
45 QSettings settings;
ebfa55b vesap Began adding translations and using Qt Designer .ui files.
vesap authored
46 mTempApplications->Copy(list);
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
47
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
48 mUI.mJobs->setText(settings.value(SETTINGS_CHECK_THREADS, 1).toString());
49 mUI.mForce->setCheckState(BoolToCheckState(settings.value(SETTINGS_CHECK_FORCE, false).toBool()));
50 mUI.mShowFullPath->setCheckState(BoolToCheckState(settings.value(SETTINGS_SHOW_FULL_PATH, false).toBool()));
51 mUI.mShowNoErrorsMessage->setCheckState(BoolToCheckState(settings.value(SETTINGS_SHOW_NO_ERRORS, false).toBool()));
52 mUI.mShowDebugWarnings->setCheckState(BoolToCheckState(settings.value(SETTINGS_SHOW_DEBUG_WARNINGS, false).toBool()));
53 mUI.mSaveAllErrors->setCheckState(BoolToCheckState(settings.value(SETTINGS_SAVE_ALL_ERRORS, false).toBool()));
54 mUI.mSaveFullPath->setCheckState(BoolToCheckState(settings.value(SETTINGS_SAVE_FULL_PATH, false).toBool()));
55 mUI.mInlineSuppressions->setCheckState(BoolToCheckState(settings.value(SETTINGS_INLINE_SUPPRESSIONS, false).toBool()));
56 mUI.mEnableInconclusive->setCheckState(BoolToCheckState(settings.value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool()));
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
57
2dfa1d5 Kimmo Varis GUI: Add Setting for global include paths.
kimmov authored
58 connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(Ok()));
59 connect(mUI.mButtons, SIGNAL(rejected()), this, SLOT(reject()));
b7aa14f Kimmo Varis GUI: Improve edit application setttings dialog.
kimmov authored
60 connect(mUI.mBtnAddApplication, SIGNAL(clicked()),
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
61 this, SLOT(AddApplication()));
b7aa14f Kimmo Varis GUI: Improve edit application setttings dialog.
kimmov authored
62 connect(mUI.mBtnRemoveApplication, SIGNAL(clicked()),
63 this, SLOT(RemoveApplication()));
64 connect(mUI.mBtnEditApplication, SIGNAL(clicked()),
65 this, SLOT(EditApplication()));
66 connect(mUI.mBtnDefaultApplication, SIGNAL(clicked()),
2b7bf67 vesap Now starts the default application by double clicking the error.
vesap authored
67 this, SLOT(DefaultApplication()));
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
68 connect(mUI.mListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
b7aa14f Kimmo Varis GUI: Improve edit application setttings dialog.
kimmov authored
69 this, SLOT(EditApplication()));
2dfa1d5 Kimmo Varis GUI: Add Setting for global include paths.
kimmov authored
70 connect(mUI.mBtnAddIncludePath, SIGNAL(clicked()),
71 this, SLOT(AddIncludePath()));
51eee5f Kimmo Varis GUI: Add list control for include paths.
kimmov authored
72 connect(mUI.mBtnRemoveIncludePath, SIGNAL(clicked()),
73 this, SLOT(RemoveIncludePath()));
74 connect(mUI.mBtnEditIncludePath, SIGNAL(clicked()),
75 this, SLOT(EditIncludePath()));
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
76
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
77 mUI.mListWidget->setSortingEnabled(false);
dd71742 Kimmo Varis GUI: Rename method.
kimmov authored
78 PopulateApplicationList();
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
79
46c0397 Kimmo Varis GUI: Show ideal thread count next to current thread count.
kimmov authored
80 const int count = QThread::idealThreadCount();
81 if (count != -1)
82 mUI.mLblIdealThreads->setText(QString::number(count));
83 else
84 mUI.mLblIdealThreads->setText(tr("N/A"));
85
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
86 LoadSettings();
29d6b44 Kimmo Varis GUI: Add language selection panel to settings-dialog.
kimmov authored
87 InitTranslationsList();
51eee5f Kimmo Varis GUI: Add list control for include paths.
kimmov authored
88 InitIncludepathsList();
b39c154 Began implementing a simple Qt based GUI.
Vesa Pikki authored
89 }
90
91 SettingsDialog::~SettingsDialog()
92 {
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
93 SaveSettings();
94 }
95
51eee5f Kimmo Varis GUI: Add list control for include paths.
kimmov authored
96 void SettingsDialog::AddIncludePath(const QString &path)
97 {
98 if (path.isNull() || path.isEmpty())
99 return;
100
101 QListWidgetItem *item = new QListWidgetItem(path);
102 item->setFlags(item->flags() | Qt::ItemIsEditable);
103 mUI.mListIncludePaths->addItem(item);
104 }
105
106 void SettingsDialog::InitIncludepathsList()
107 {
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
108 QSettings settings;
109 const QString allPaths = settings.value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString();
51eee5f Kimmo Varis GUI: Add list control for include paths.
kimmov authored
110 const QStringList paths = allPaths.split(";", QString::SkipEmptyParts);
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
111 foreach(QString path, paths) {
51eee5f Kimmo Varis GUI: Add list control for include paths.
kimmov authored
112 AddIncludePath(path);
113 }
114 }
115
29d6b44 Kimmo Varis GUI: Add language selection panel to settings-dialog.
kimmov authored
116 void SettingsDialog::InitTranslationsList()
117 {
fd112fc Kimmo Varis GUI: Store selected language as language code.
kimmov authored
118 const QString current = mTranslator->GetCurrentLanguage();
119 QList<TranslationInfo> translations = mTranslator->GetTranslations();
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
120 foreach(TranslationInfo translation, translations) {
fd112fc Kimmo Varis GUI: Store selected language as language code.
kimmov authored
121 QListWidgetItem *item = new QListWidgetItem;
122 item->setText(translation.mName);
123 item->setData(LangCodeRole, QVariant(translation.mCode));
124 mUI.mListLanguages->addItem(item);
125 if (translation.mCode == current)
126 mUI.mListLanguages->setCurrentItem(item);
29d6b44 Kimmo Varis GUI: Add language selection panel to settings-dialog.
kimmov authored
127 }
128 }
129
483a3dd IOBYTE Fixed #1925 (fix some cppcheck warnings in cppcheck)
IOBYTE authored
130 Qt::CheckState SettingsDialog::BoolToCheckState(bool yes) const
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
131 {
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
132 if (yes) {
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
133 return Qt::Checked;
134 }
135 return Qt::Unchecked;
136 }
137
483a3dd IOBYTE Fixed #1925 (fix some cppcheck warnings in cppcheck)
IOBYTE authored
138 bool SettingsDialog::CheckStateToBool(Qt::CheckState state) const
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
139 {
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
140 if (state == Qt::Checked) {
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
141 return true;
142 }
143 return false;
144 }
145
146
147 void SettingsDialog::LoadSettings()
148 {
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
149 QSettings settings;
150 resize(settings.value(SETTINGS_CHECK_DIALOG_WIDTH, 800).toInt(),
151 settings.value(SETTINGS_CHECK_DIALOG_HEIGHT, 600).toInt());
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
152 }
153
154 void SettingsDialog::SaveSettings()
155 {
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
156 QSettings settings;
157 settings.setValue(SETTINGS_CHECK_DIALOG_WIDTH, size().width());
158 settings.setValue(SETTINGS_CHECK_DIALOG_HEIGHT, size().height());
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
159 }
160
2dfa1d5 Kimmo Varis GUI: Add Setting for global include paths.
kimmov authored
161 void SettingsDialog::SaveSettingValues()
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
162 {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
163 int jobs = mUI.mJobs->text().toInt();
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
164 if (jobs <= 0) {
de0dd0a vesap Fixed issues pointed out by Reijo.
vesap authored
165 jobs = 1;
166 }
167
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
168 QSettings settings;
169 settings.setValue(SETTINGS_CHECK_THREADS, jobs);
170 SaveCheckboxValue(&settings, mUI.mForce, SETTINGS_CHECK_FORCE);
171 SaveCheckboxValue(&settings, mUI.mSaveAllErrors, SETTINGS_SAVE_ALL_ERRORS);
172 SaveCheckboxValue(&settings, mUI.mSaveFullPath, SETTINGS_SAVE_FULL_PATH);
173 SaveCheckboxValue(&settings, mUI.mShowFullPath, SETTINGS_SHOW_FULL_PATH);
174 SaveCheckboxValue(&settings, mUI.mShowNoErrorsMessage, SETTINGS_SHOW_NO_ERRORS);
175 SaveCheckboxValue(&settings, mUI.mShowDebugWarnings, SETTINGS_SHOW_DEBUG_WARNINGS);
176 SaveCheckboxValue(&settings, mUI.mInlineSuppressions, SETTINGS_INLINE_SUPPRESSIONS);
177 SaveCheckboxValue(&settings, mUI.mEnableInconclusive, SETTINGS_INCONCLUSIVE_ERRORS);
fd112fc Kimmo Varis GUI: Store selected language as language code.
kimmov authored
178
179 QListWidgetItem *currentLang = mUI.mListLanguages->currentItem();
180 const QString langcode = currentLang->data(LangCodeRole).toString();
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
181 settings.setValue(SETTINGS_LANGUAGE, langcode);
51eee5f Kimmo Varis GUI: Add list control for include paths.
kimmov authored
182
183 const int count = mUI.mListIncludePaths->count();
184 QString includePaths;
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
185 for (int i = 0; i < count; i++) {
51eee5f Kimmo Varis GUI: Add list control for include paths.
kimmov authored
186 QListWidgetItem *item = mUI.mListIncludePaths->item(i);
187 includePaths += item->text();
188 includePaths += ";";
189 }
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
190 settings.setValue(SETTINGS_GLOBAL_INCLUDE_PATHS, includePaths);
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
191 }
192
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
193 void SettingsDialog::SaveCheckboxValue(QSettings *settings, QCheckBox *box,
194 const QString &name)
5e19940 vesap Added settings dialog to select what kind of errors are visible.
vesap authored
195 {
1002d2e Kimmo Varis GUI: Simplify settings handling in Preferences dialog.
kimmov authored
196 settings->setValue(name, CheckStateToBool(box->checkState()));
b39c154 Began implementing a simple Qt based GUI.
Vesa Pikki authored
197 }
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
198
199 void SettingsDialog::AddApplication()
200 {
68a28ab Kimmo Varis GUI: Modify ApplicationDialog to get/return Application class.
kimmov authored
201 Application app;
202 ApplicationDialog dialog(tr("Add a new application"), app, this);
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
203
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
204 if (dialog.exec() == QDialog::Accepted) {
68a28ab Kimmo Varis GUI: Modify ApplicationDialog to get/return Application class.
kimmov authored
205 const Application app = dialog.GetApplication();
9134523 Kimmo Varis GUI: Refactoring application definition.
kimmov authored
206 mTempApplications->AddApplication(app);
68a28ab Kimmo Varis GUI: Modify ApplicationDialog to get/return Application class.
kimmov authored
207 mUI.mListWidget->addItem(app.getName());
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
208 }
209 }
210
b7aa14f Kimmo Varis GUI: Improve edit application setttings dialog.
kimmov authored
211 void SettingsDialog::RemoveApplication()
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
212 {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
213 QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems();
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
214 foreach(QListWidgetItem *item, selected) {
085034d Kimmo Varis GUI: Fix for removing application.
kimmov authored
215 const int removeIndex = mUI.mListWidget->row(item);
216 const int currentDefault = mTempApplications->GetDefaultApplication();
217 mTempApplications->RemoveApplication(removeIndex);
218 if (removeIndex == currentDefault)
219 // If default app is removed set default to unknown
220 mTempApplications->SetDefault(-1);
221 else if (removeIndex < currentDefault)
222 // Move default app one up if earlier app was removed
223 mTempApplications->SetDefault(currentDefault - 1);
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
224 }
085034d Kimmo Varis GUI: Fix for removing application.
kimmov authored
225 mUI.mListWidget->clear();
226 PopulateApplicationList();
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
227 }
228
b7aa14f Kimmo Varis GUI: Improve edit application setttings dialog.
kimmov authored
229 void SettingsDialog::EditApplication()
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
230 {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
231 QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems();
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
232 QListWidgetItem *item = 0;
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
233 foreach(item, selected) {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
234 int row = mUI.mListWidget->row(item);
9134523 Kimmo Varis GUI: Refactoring application definition.
kimmov authored
235 const Application app = mTempApplications->GetApplication(row);
68a28ab Kimmo Varis GUI: Modify ApplicationDialog to get/return Application class.
kimmov authored
236 ApplicationDialog dialog(tr("Modify an application"), app, this);
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
237
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
238 if (dialog.exec() == QDialog::Accepted) {
68a28ab Kimmo Varis GUI: Modify ApplicationDialog to get/return Application class.
kimmov authored
239 const Application app2 = dialog.GetApplication();
9134523 Kimmo Varis GUI: Refactoring application definition.
kimmov authored
240 mTempApplications->SetApplication(row, app2);
68a28ab Kimmo Varis GUI: Modify ApplicationDialog to get/return Application class.
kimmov authored
241 item->setText(app2.getName());
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
242 }
243 }
244 }
245
2b7bf67 vesap Now starts the default application by double clicking the error.
vesap authored
246 void SettingsDialog::DefaultApplication()
247 {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
248 QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems();
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
249 if (selected.size() > 0) {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
250 int index = mUI.mListWidget->row(selected[0]);
eabec80 Kimmo Varis GUI: Show default application with [Default] text.
kimmov authored
251 mTempApplications->SetDefault(index);
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
252 mUI.mListWidget->clear();
dd71742 Kimmo Varis GUI: Rename method.
kimmov authored
253 PopulateApplicationList();
2b7bf67 vesap Now starts the default application by double clicking the error.
vesap authored
254 }
255 }
256
dd71742 Kimmo Varis GUI: Rename method.
kimmov authored
257 void SettingsDialog::PopulateApplicationList()
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
258 {
eabec80 Kimmo Varis GUI: Show default application with [Default] text.
kimmov authored
259 const int defapp = mTempApplications->GetDefaultApplication();
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
260 for (int i = 0; i < mTempApplications->GetApplicationCount(); i++) {
9134523 Kimmo Varis GUI: Refactoring application definition.
kimmov authored
261 Application app = mTempApplications->GetApplication(i);
262 QString name = app.getName();
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
263 if (i == defapp) {
eabec80 Kimmo Varis GUI: Show default application with [Default] text.
kimmov authored
264 name += " ";
265 name += tr("[Default]");
266 }
267 mUI.mListWidget->addItem(name);
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
268 }
f146ce1 Kimmo Varis GUI: If application list contains applications select the first by defau...
kimmov authored
269
74c85b6 Kimmo Varis GUI: Select the default application in app list.
kimmov authored
270 // Select default application, or if there is no default app then the
271 // first item.
272 if (defapp == -1)
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
273 mUI.mListWidget->setCurrentRow(0);
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
274 else {
74c85b6 Kimmo Varis GUI: Select the default application in app list.
kimmov authored
275 if (mTempApplications->GetApplicationCount() > defapp)
276 mUI.mListWidget->setCurrentRow(defapp);
277 else
278 mUI.mListWidget->setCurrentRow(0);
f146ce1 Kimmo Varis GUI: If application list contains applications select the first by defau...
kimmov authored
279 }
78d4318 vesap Added the ability to add/remove/modify applications to open errors with.
vesap authored
280 }
281
04b23b5 vesap User can now undo changes to application list by clicking cancel.
vesap authored
282 void SettingsDialog::Ok()
283 {
ebfa55b vesap Began adding translations and using Qt Designer .ui files.
vesap authored
284 mApplications->Copy(mTempApplications);
04b23b5 vesap User can now undo changes to application list by clicking cancel.
vesap authored
285 accept();
286 }
287
a330e9c vesap Added the initial version of saving results to a file.
vesap authored
288 bool SettingsDialog::ShowFullPath()
289 {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
290 return CheckStateToBool(mUI.mShowFullPath->checkState());
a330e9c vesap Added the initial version of saving results to a file.
vesap authored
291 }
292
293 bool SettingsDialog::SaveFullPath()
294 {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
295 return CheckStateToBool(mUI.mSaveFullPath->checkState());
a330e9c vesap Added the initial version of saving results to a file.
vesap authored
296 }
297
298 bool SettingsDialog::SaveAllErrors()
299 {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
300 return CheckStateToBool(mUI.mSaveAllErrors->checkState());
a330e9c vesap Added the initial version of saving results to a file.
vesap authored
301 }
b674247 vesap Added messagebox to inform user about not found/non visible errors.
vesap authored
302
303 bool SettingsDialog::ShowNoErrorsMessage()
304 {
e973f96 vesap Settings dialog and application dialog now use Qt Designer ui files.
vesap authored
305 return CheckStateToBool(mUI.mShowNoErrorsMessage->checkState());
b674247 vesap Added messagebox to inform user about not found/non visible errors.
vesap authored
306 }
307
2dfa1d5 Kimmo Varis GUI: Add Setting for global include paths.
kimmov authored
308 void SettingsDialog::AddIncludePath()
309 {
310 QString selectedDir = QFileDialog::getExistingDirectory(this,
311 tr("Select include directory"),
312 QString());
b674247 vesap Added messagebox to inform user about not found/non visible errors.
vesap authored
313
6f8e42a Daniel Marjamäki changed the astyle formatting flags
authored
314 if (!selectedDir.isEmpty()) {
51eee5f Kimmo Varis GUI: Add list control for include paths.
kimmov authored
315 AddIncludePath(selectedDir);
2dfa1d5 Kimmo Varis GUI: Add Setting for global include paths.
kimmov authored
316 }
317 }
51eee5f Kimmo Varis GUI: Add list control for include paths.
kimmov authored
318
319 void SettingsDialog::RemoveIncludePath()
320 {
321 const int row = mUI.mListIncludePaths->currentRow();
322 QListWidgetItem *item = mUI.mListIncludePaths->takeItem(row);
323 delete item;
324 }
325
326 void SettingsDialog::EditIncludePath()
327 {
328 QListWidgetItem *item = mUI.mListIncludePaths->currentItem();
329 mUI.mListIncludePaths->editItem(item);
330 }
Something went wrong with that request. Please try again.