GUI: tweaks in library dialog for sorting and filter
This commit is contained in:
parent
9f31414179
commit
4cffff7bde
|
@ -36,6 +36,8 @@ LibraryDialog::LibraryDialog(QWidget *parent) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->buttonSave->setEnabled(false);
|
ui->buttonSave->setEnabled(false);
|
||||||
|
ui->sortFunctions->setEnabled(false);
|
||||||
|
ui->filter->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryDialog::~LibraryDialog()
|
LibraryDialog::~LibraryDialog()
|
||||||
|
@ -81,6 +83,8 @@ void LibraryDialog::openCfg()
|
||||||
foreach(const struct CppcheckLibraryData::Function &function, data.functions) {
|
foreach(const struct CppcheckLibraryData::Function &function, data.functions) {
|
||||||
ui->functions->addItem(function.name);
|
ui->functions->addItem(function.name);
|
||||||
}
|
}
|
||||||
|
ui->sortFunctions->setEnabled(!data.functions.empty());
|
||||||
|
ui->filter->setEnabled(!data.functions.empty());
|
||||||
ignoreChanges = false;
|
ignoreChanges = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,6 +119,8 @@ void LibraryDialog::addFunction()
|
||||||
data.functions.append(f);
|
data.functions.append(f);
|
||||||
ui->functions->addItem(f.name);
|
ui->functions->addItem(f.name);
|
||||||
ui->buttonSave->setEnabled(true);
|
ui->buttonSave->setEnabled(true);
|
||||||
|
ui->sortFunctions->setEnabled(!data.functions.empty());
|
||||||
|
ui->filter->setEnabled(!data.functions.empty());
|
||||||
}
|
}
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
@ -145,9 +151,14 @@ void LibraryDialog::sortFunctions(bool sort)
|
||||||
ui->functions->sortItems();
|
ui->functions->sortItems();
|
||||||
else {
|
else {
|
||||||
ignoreChanges = true;
|
ignoreChanges = true;
|
||||||
|
CppcheckLibraryData::Function *selfunction = currentFunction();
|
||||||
ui->functions->clear();
|
ui->functions->clear();
|
||||||
foreach(const struct CppcheckLibraryData::Function &function, data.functions)
|
foreach(const struct CppcheckLibraryData::Function &function, data.functions) {
|
||||||
ui->functions->addItem(function.name);
|
QListWidgetItem *item = new QListWidgetItem(ui->functions);
|
||||||
|
item->setText(function.name);
|
||||||
|
item->setSelected(selfunction == &function);
|
||||||
|
ui->functions->addItem(item);
|
||||||
|
}
|
||||||
if (!ui->filter->text().isEmpty())
|
if (!ui->filter->text().isEmpty())
|
||||||
filterFunctions(ui->filter->text());
|
filterFunctions(ui->filter->text());
|
||||||
ignoreChanges = false;
|
ignoreChanges = false;
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="sortFunctions">
|
<widget class="QPushButton" name="sortFunctions">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>AZ</string>
|
<string>Sort</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -118,6 +118,13 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Filter:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="filter"/>
|
<widget class="QLineEdit" name="filter"/>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue