GUI: refactoring librarydialog
This commit is contained in:
parent
c5a8ecb6f9
commit
a65fabebce
|
@ -151,17 +151,15 @@ void LibraryDialog::editArg()
|
||||||
LibraryEditArgDialog *d = new LibraryEditArgDialog(0, arg);
|
LibraryEditArgDialog *d = new LibraryEditArgDialog(0, arg);
|
||||||
if (d->exec() == QDialog::Accepted) {
|
if (d->exec() == QDialog::Accepted) {
|
||||||
arg = d->getArg();
|
arg = d->getArg();
|
||||||
updateArguments(function);
|
ui->arguments->selectedItems().first()->setText(getArgText(arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete d;
|
delete d;
|
||||||
ui->buttonSave->setEnabled(true);
|
ui->buttonSave->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryDialog::updateArguments(const CppcheckLibraryData::Function &function)
|
QString LibraryDialog::getArgText(const CppcheckLibraryData::Function::Arg &arg)
|
||||||
{
|
{
|
||||||
ui->arguments->clear();
|
|
||||||
foreach(const CppcheckLibraryData::Function::Arg &arg, function.args) {
|
|
||||||
QString s("arg");
|
QString s("arg");
|
||||||
if (arg.nr != CppcheckLibraryData::Function::Arg::ANY)
|
if (arg.nr != CppcheckLibraryData::Function::Arg::ANY)
|
||||||
s += QString::number(arg.nr);
|
s += QString::number(arg.nr);
|
||||||
|
@ -175,7 +173,13 @@ void LibraryDialog::updateArguments(const CppcheckLibraryData::Function &functio
|
||||||
foreach(const CppcheckLibraryData::Function::Arg::MinSize &minsize, arg.minsizes) {
|
foreach(const CppcheckLibraryData::Function::Arg::MinSize &minsize, arg.minsizes) {
|
||||||
s += "\n minsize: " + minsize.type + " " + minsize.arg + " " + minsize.arg2;
|
s += "\n minsize: " + minsize.type + " " + minsize.arg + " " + minsize.arg2;
|
||||||
}
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
ui->arguments->addItem(s);
|
void LibraryDialog::updateArguments(const CppcheckLibraryData::Function &function)
|
||||||
|
{
|
||||||
|
ui->arguments->clear();
|
||||||
|
foreach(const CppcheckLibraryData::Function::Arg &arg, function.args) {
|
||||||
|
ui->arguments->addItem(getArgText(arg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ private:
|
||||||
QString mFileName;
|
QString mFileName;
|
||||||
bool ignoreChanges;
|
bool ignoreChanges;
|
||||||
|
|
||||||
|
static QString getArgText(const CppcheckLibraryData::Function::Arg &arg);
|
||||||
void updateArguments(const CppcheckLibraryData::Function &function);
|
void updateArguments(const CppcheckLibraryData::Function &function);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue