GUI: Remove include paths from the preferences dialog

This commit is contained in:
Daniel Marjamäki 2017-08-13 16:56:37 +02:00
parent ca6109b40c
commit 83ae7ce270
3 changed files with 0 additions and 159 deletions

View File

@ -179,69 +179,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>Paths</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Include paths:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="mListIncludePaths">
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QPushButton" name="mBtnAddIncludePath">
<property name="text">
<string>Add...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mBtnEditIncludePath">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mBtnRemoveIncludePath">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Applications</string>
@ -447,10 +384,6 @@
<tabstop>mShowFullPath</tabstop>
<tabstop>mShowNoErrorsMessage</tabstop>
<tabstop>mInlineSuppressions</tabstop>
<tabstop>mListIncludePaths</tabstop>
<tabstop>mBtnAddIncludePath</tabstop>
<tabstop>mBtnEditIncludePath</tabstop>
<tabstop>mBtnRemoveIncludePath</tabstop>
<tabstop>mListWidget</tabstop>
<tabstop>mBtnAddApplication</tabstop>
<tabstop>mBtnEditApplication</tabstop>

View File

@ -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,

View File

@ -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.
*/