From 83ae7ce270fa6a4303622f422aa669f4d09f3589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 13 Aug 2017 16:56:37 +0200 Subject: [PATCH] GUI: Remove include paths from the preferences dialog --- gui/settings.ui | 67 ------------------------------------------ gui/settingsdialog.cpp | 61 -------------------------------------- gui/settingsdialog.h | 31 ------------------- 3 files changed, 159 deletions(-) diff --git a/gui/settings.ui b/gui/settings.ui index 9430c988f..9c58fd224 100644 --- a/gui/settings.ui +++ b/gui/settings.ui @@ -179,69 +179,6 @@ - - - Paths - - - - - - Include paths: - - - - - - - - - QAbstractItemView::SelectRows - - - - - - - - - Add... - - - - - - - Edit - - - - - - - Remove - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Applications @@ -447,10 +384,6 @@ mShowFullPath mShowNoErrorsMessage mInlineSuppressions - mListIncludePaths - mBtnAddIncludePath - mBtnEditIncludePath - mBtnRemoveIncludePath mListWidget mBtnAddApplication mBtnEditApplication diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index e4e4b9fd4..3b8a85142 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -75,12 +75,6 @@ SettingsDialog::SettingsDialog(ApplicationList *list, this, SLOT(defaultApplication())); connect(mUI.mListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(editApplication())); - 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); populateApplicationList(); @@ -93,7 +87,6 @@ SettingsDialog::SettingsDialog(ApplicationList *list, loadSettings(); initTranslationsList(); - initIncludepathsList(); } SettingsDialog::~SettingsDialog() @@ -101,26 +94,6 @@ 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() -{ - QSettings settings; - const QString allPaths = settings.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(); @@ -196,15 +169,6 @@ void SettingsDialog::saveSettingValues() const const QString langcode = currentLang->data(LangCodeRole).toString(); settings.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 += ";"; - } - settings.setValue(SETTINGS_GLOBAL_INCLUDE_PATHS, includePaths); } void SettingsDialog::saveCheckboxValue(QSettings *settings, QCheckBox *box, @@ -332,31 +296,6 @@ bool SettingsDialog::showInconclusive() const return checkStateToBool(mUI.mEnableInconclusive->checkState()); } -void SettingsDialog::addIncludePath() -{ - QString selectedDir = QFileDialog::getExistingDirectory(this, - tr("Select include directory"), - getPath(SETTINGS_LAST_INCLUDE_PATH)); - - if (!selectedDir.isEmpty()) { - addIncludePath(selectedDir); - setPath(SETTINGS_LAST_INCLUDE_PATH, 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); -} - void SettingsDialog::browseClangPath() { QString selectedDir = QFileDialog::getExistingDirectory(this, diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h index 00bea4ee5..ef55273f6 100644 --- a/gui/settingsdialog.h +++ b/gui/settingsdialog.h @@ -124,24 +124,6 @@ protected slots: */ void defaultApplication(); - /** - * @brief Slot for adding new include path - * - */ - void addIncludePath(); - - /** - * @brief Slot for removing an include path. - * - */ - void removeIncludePath(); - - /** - * @brief Slot for editing an include path. - * - */ - void editIncludePath(); - /** @brief Slot for browsing for the clang binary */ void browseClangPath(); @@ -149,14 +131,6 @@ protected slots: void browseClangHeaders(); 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 * @@ -201,11 +175,6 @@ protected: */ static bool checkStateToBool(Qt::CheckState state); - /** - * @brief Populate the include paths-list. - */ - void initIncludepathsList(); - /** * @brief Populate the translations list. */