diff --git a/gui/settings.ui b/gui/settings.ui
index 8d6fc2e3d..78c6f405f 100644
--- a/gui/settings.ui
+++ b/gui/settings.ui
@@ -7,7 +7,7 @@
0
0
589
- 313
+ 319
@@ -17,37 +17,13 @@
-
- 0
+ 1
General
-
-
-
-
-
-
-
- Include paths:
-
-
- mEditIncludePaths
-
-
-
- -
-
-
- -
-
-
- Add...
-
-
-
-
-
-
@@ -182,6 +158,69 @@
+
+
+ Paths
+
+
+ -
+
+
+ Include paths:
+
+
+
+ -
+
+
-
+
+
+ QAbstractItemView::SelectRows
+
+
+
+ -
+
+
-
+
+
+ Add...
+
+
+
+ -
+
+
+ Edit
+
+
+
+ -
+
+
+ Remove
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
Applications
@@ -284,8 +323,6 @@
tabWidget
- mEditIncludePaths
- mBtnAddIncludePath
mJobs
mForce
mShowFullPath
diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp
index 2301950fa..78f110156 100644
--- a/gui/settingsdialog.cpp
+++ b/gui/settingsdialog.cpp
@@ -46,7 +46,6 @@ SettingsDialog::SettingsDialog(QSettings *programSettings,
mUI.setupUi(this);
mTempApplications->Copy(list);
- mUI.mEditIncludePaths->setText(programSettings->value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString());
mUI.mJobs->setText(programSettings->value(SETTINGS_CHECK_THREADS, 1).toString());
mUI.mForce->setCheckState(BoolToCheckState(programSettings->value(SETTINGS_CHECK_FORCE, false).toBool()));
mUI.mShowFullPath->setCheckState(BoolToCheckState(programSettings->value(SETTINGS_SHOW_FULL_PATH, false).toBool()));
@@ -70,6 +69,10 @@ SettingsDialog::SettingsDialog(QSettings *programSettings,
this, SLOT(ModifyApplication()));
connect(mUI.mBtnAddIncludePath, SIGNAL(clicked()),
this, SLOT(AddIncludePath()));
+ connect(mUI.mBtnRemoveIncludePath, SIGNAL(clicked()),
+ this, SLOT(RemoveIncludePath()));
+ connect(mUI.mBtnEditIncludePath, SIGNAL(clicked()),
+ this, SLOT(EditIncludePath()));
mUI.mListWidget->setSortingEnabled(false);
PopulateListWidget();
@@ -82,6 +85,7 @@ SettingsDialog::SettingsDialog(QSettings *programSettings,
LoadSettings();
InitTranslationsList();
+ InitIncludepathsList();
}
SettingsDialog::~SettingsDialog()
@@ -89,6 +93,26 @@ SettingsDialog::~SettingsDialog()
SaveSettings();
}
+void SettingsDialog::AddIncludePath(const QString &path)
+{
+ if (path.isNull() || path.isEmpty())
+ return;
+
+ QListWidgetItem *item = new QListWidgetItem(path);
+ item->setFlags(item->flags() | Qt::ItemIsEditable);
+ mUI.mListIncludePaths->addItem(item);
+}
+
+void SettingsDialog::InitIncludepathsList()
+{
+ const QString allPaths = mSettings->value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString();
+ const QStringList paths = allPaths.split(";", QString::SkipEmptyParts);
+ foreach(QString path, paths)
+ {
+ AddIncludePath(path);
+ }
+}
+
void SettingsDialog::InitTranslationsList()
{
const QString current = mTranslator->GetCurrentLanguage();
@@ -151,11 +175,20 @@ void SettingsDialog::SaveSettingValues()
SaveCheckboxValue(mUI.mShowNoErrorsMessage, SETTINGS_SHOW_NO_ERRORS);
SaveCheckboxValue(mUI.mShowDebugWarnings, SETTINGS_SHOW_DEBUG_WARNINGS);
SaveCheckboxValue(mUI.mInlineSuppressions, SETTINGS_INLINE_SUPPRESSIONS);
- mSettings->setValue(SETTINGS_GLOBAL_INCLUDE_PATHS, mUI.mEditIncludePaths->text());
QListWidgetItem *currentLang = mUI.mListLanguages->currentItem();
const QString langcode = currentLang->data(LangCodeRole).toString();
mSettings->setValue(SETTINGS_LANGUAGE, langcode);
+
+ const int count = mUI.mListIncludePaths->count();
+ QString includePaths;
+ for (int i = 0; i < count; i++)
+ {
+ QListWidgetItem *item = mUI.mListIncludePaths->item(i);
+ includePaths += item->text();
+ includePaths += ";";
+ }
+ mSettings->setValue(SETTINGS_GLOBAL_INCLUDE_PATHS, includePaths);
}
void SettingsDialog::SaveCheckboxValue(QCheckBox *box, const QString &name)
@@ -268,10 +301,19 @@ void SettingsDialog::AddIncludePath()
if (!selectedDir.isEmpty())
{
- QString text = mUI.mEditIncludePaths->text();
- if (!text.isEmpty())
- text += ';';
- text += selectedDir;
- mUI.mEditIncludePaths->setText(text);
+ AddIncludePath(selectedDir);
}
}
+
+void SettingsDialog::RemoveIncludePath()
+{
+ const int row = mUI.mListIncludePaths->currentRow();
+ QListWidgetItem *item = mUI.mListIncludePaths->takeItem(row);
+ delete item;
+}
+
+void SettingsDialog::EditIncludePath()
+{
+ QListWidgetItem *item = mUI.mListIncludePaths->currentItem();
+ mUI.mListIncludePaths->editItem(item);
+}
diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h
index d2a9e11ad..77d9c7f81 100644
--- a/gui/settingsdialog.h
+++ b/gui/settingsdialog.h
@@ -118,8 +118,27 @@ protected slots:
*/
void AddIncludePath();
+ /**
+ * @brief Slot for removing an include path.
+ *
+ */
+ void RemoveIncludePath();
+
+ /**
+ * @brief Slot for editing an include path.
+ *
+ */
+ void EditIncludePath();
+
protected:
+ /**
+ * @brief Add new include path to the list.
+ * @param path Path to add.
+ *
+ */
+ void AddIncludePath(const QString &path);
+
/**
* @brief Clear all applications from the list and re insert them from mTempApplications
*
@@ -165,6 +184,11 @@ protected:
*/
bool CheckStateToBool(Qt::CheckState state) const;
+ /**
+ * @brief Populate the include paths-list.
+ */
+ void InitIncludepathsList();
+
/**
* @brief Populate the translations list.
*/