GUI: Rename private variable ui to mUi
This commit is contained in:
parent
86c5f44d19
commit
7d00b30488
|
@ -6,26 +6,26 @@
|
|||
|
||||
LibraryAddFunctionDialog::LibraryAddFunctionDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::LibraryAddFunctionDialog)
|
||||
mUi(new Ui::LibraryAddFunctionDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
mUi->setupUi(this);
|
||||
QRegExp rx(NAMES);
|
||||
QValidator *validator = new QRegExpValidator(rx, this);
|
||||
ui->functionName->setValidator(validator);
|
||||
mUi->functionName->setValidator(validator);
|
||||
}
|
||||
|
||||
LibraryAddFunctionDialog::~LibraryAddFunctionDialog()
|
||||
{
|
||||
delete ui;
|
||||
delete mUi;
|
||||
}
|
||||
|
||||
QString LibraryAddFunctionDialog::functionName() const
|
||||
{
|
||||
return ui->functionName->text();
|
||||
return mUi->functionName->text();
|
||||
}
|
||||
|
||||
int LibraryAddFunctionDialog::numberOfArguments() const
|
||||
{
|
||||
return ui->numberOfArguments->value();
|
||||
return mUi->numberOfArguments->value();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
int numberOfArguments() const;
|
||||
|
||||
private:
|
||||
Ui::LibraryAddFunctionDialog *ui;
|
||||
Ui::LibraryAddFunctionDialog *mUi;
|
||||
};
|
||||
|
||||
#endif // LIBRARYADDFUNCTIONDIALOG_H
|
||||
|
|
|
@ -46,15 +46,15 @@ public:
|
|||
|
||||
LibraryDialog::LibraryDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::LibraryDialog),
|
||||
mUi(new Ui::LibraryDialog),
|
||||
ignoreChanges(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->buttonSave->setEnabled(false);
|
||||
ui->buttonSaveAs->setEnabled(false);
|
||||
ui->sortFunctions->setEnabled(false);
|
||||
ui->filter->setEnabled(false);
|
||||
ui->addFunction->setEnabled(false);
|
||||
mUi->setupUi(this);
|
||||
mUi->buttonSave->setEnabled(false);
|
||||
mUi->buttonSaveAs->setEnabled(false);
|
||||
mUi->sortFunctions->setEnabled(false);
|
||||
mUi->filter->setEnabled(false);
|
||||
mUi->addFunction->setEnabled(false);
|
||||
|
||||
//As no function selected, this disables function editing widgets
|
||||
selectFunction();
|
||||
|
@ -62,12 +62,12 @@ LibraryDialog::LibraryDialog(QWidget *parent) :
|
|||
|
||||
LibraryDialog::~LibraryDialog()
|
||||
{
|
||||
delete ui;
|
||||
delete mUi;
|
||||
}
|
||||
|
||||
CppcheckLibraryData::Function *LibraryDialog::currentFunction()
|
||||
{
|
||||
QList<QListWidgetItem *> selitems = ui->functions->selectedItems();
|
||||
QList<QListWidgetItem *> selitems = mUi->functions->selectedItems();
|
||||
if (selitems.count() != 1)
|
||||
return nullptr;
|
||||
return static_cast<FunctionListItem *>(selitems.first())->function;
|
||||
|
@ -115,18 +115,18 @@ void LibraryDialog::openCfg()
|
|||
ignoreChanges = true;
|
||||
data.swap(tempdata);
|
||||
mFileName = selectedFile;
|
||||
ui->buttonSave->setEnabled(false);
|
||||
ui->buttonSaveAs->setEnabled(true);
|
||||
ui->filter->clear();
|
||||
ui->functions->clear();
|
||||
mUi->buttonSave->setEnabled(false);
|
||||
mUi->buttonSaveAs->setEnabled(true);
|
||||
mUi->filter->clear();
|
||||
mUi->functions->clear();
|
||||
for (CppcheckLibraryData::Function &function : data.functions) {
|
||||
ui->functions->addItem(new FunctionListItem(ui->functions,
|
||||
mUi->functions->addItem(new FunctionListItem(mUi->functions,
|
||||
&function,
|
||||
false));
|
||||
}
|
||||
ui->sortFunctions->setEnabled(!data.functions.empty());
|
||||
ui->filter->setEnabled(!data.functions.empty());
|
||||
ui->addFunction->setEnabled(true);
|
||||
mUi->sortFunctions->setEnabled(!data.functions.empty());
|
||||
mUi->filter->setEnabled(!data.functions.empty());
|
||||
mUi->addFunction->setEnabled(true);
|
||||
ignoreChanges = false;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ void LibraryDialog::saveCfg()
|
|||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream ts(&file);
|
||||
ts << data.toString() << '\n';
|
||||
ui->buttonSave->setEnabled(false);
|
||||
mUi->buttonSave->setEnabled(false);
|
||||
} else {
|
||||
QMessageBox msg(QMessageBox::Critical,
|
||||
tr("Cppcheck"),
|
||||
|
@ -182,10 +182,10 @@ void LibraryDialog::addFunction()
|
|||
f.args.append(arg);
|
||||
}
|
||||
data.functions.append(f);
|
||||
ui->functions->addItem(new FunctionListItem(ui->functions, &data.functions.back(), false));
|
||||
ui->buttonSave->setEnabled(true);
|
||||
ui->sortFunctions->setEnabled(!data.functions.empty());
|
||||
ui->filter->setEnabled(!data.functions.empty());
|
||||
mUi->functions->addItem(new FunctionListItem(mUi->functions, &data.functions.back(), false));
|
||||
mUi->buttonSave->setEnabled(true);
|
||||
mUi->sortFunctions->setEnabled(!data.functions.empty());
|
||||
mUi->filter->setEnabled(!data.functions.empty());
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ void LibraryDialog::editFunctionName(QListWidgetItem* item)
|
|||
if (functionName != function->name) {
|
||||
if (QRegExp(NAMES).exactMatch(functionName)) {
|
||||
function->name = functionName;
|
||||
ui->buttonSave->setEnabled(true);
|
||||
mUi->buttonSave->setEnabled(true);
|
||||
} else {
|
||||
ignoreChanges = true;
|
||||
item->setText(function->name);
|
||||
|
@ -213,67 +213,67 @@ void LibraryDialog::selectFunction()
|
|||
const CppcheckLibraryData::Function * const function = currentFunction();
|
||||
|
||||
if (function == nullptr) {
|
||||
ui->comments->clear();
|
||||
ui->comments->setEnabled(false);
|
||||
mUi->comments->clear();
|
||||
mUi->comments->setEnabled(false);
|
||||
|
||||
ui->noreturn->setCurrentIndex(0);
|
||||
ui->noreturn->setEnabled(false);
|
||||
mUi->noreturn->setCurrentIndex(0);
|
||||
mUi->noreturn->setEnabled(false);
|
||||
|
||||
ui->useretval->setChecked(false);
|
||||
ui->useretval->setEnabled(false);
|
||||
mUi->useretval->setChecked(false);
|
||||
mUi->useretval->setEnabled(false);
|
||||
|
||||
ui->leakignore->setChecked(false);
|
||||
ui->leakignore->setEnabled(false);
|
||||
mUi->leakignore->setChecked(false);
|
||||
mUi->leakignore->setEnabled(false);
|
||||
|
||||
ui->arguments->clear();
|
||||
ui->arguments->setEnabled(false);
|
||||
mUi->arguments->clear();
|
||||
mUi->arguments->setEnabled(false);
|
||||
|
||||
ui->editArgButton->setEnabled(false);
|
||||
mUi->editArgButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
ignoreChanges = true;
|
||||
ui->comments->setPlainText(function->comments);
|
||||
ui->comments->setEnabled(true);
|
||||
mUi->comments->setPlainText(function->comments);
|
||||
mUi->comments->setEnabled(true);
|
||||
|
||||
ui->noreturn->setCurrentIndex(function->noreturn);
|
||||
ui->noreturn->setEnabled(true);
|
||||
mUi->noreturn->setCurrentIndex(function->noreturn);
|
||||
mUi->noreturn->setEnabled(true);
|
||||
|
||||
ui->useretval->setChecked(function->useretval);
|
||||
ui->useretval->setEnabled(true);
|
||||
mUi->useretval->setChecked(function->useretval);
|
||||
mUi->useretval->setEnabled(true);
|
||||
|
||||
ui->leakignore->setChecked(function->leakignore);
|
||||
ui->leakignore->setEnabled(true);
|
||||
mUi->leakignore->setChecked(function->leakignore);
|
||||
mUi->leakignore->setEnabled(true);
|
||||
|
||||
updateArguments(*function);
|
||||
ui->arguments->setEnabled(true);
|
||||
mUi->arguments->setEnabled(true);
|
||||
|
||||
ui->editArgButton->setEnabled(true);
|
||||
mUi->editArgButton->setEnabled(true);
|
||||
ignoreChanges = false;
|
||||
}
|
||||
|
||||
void LibraryDialog::sortFunctions(bool sort)
|
||||
{
|
||||
if (sort) {
|
||||
ui->functions->sortItems();
|
||||
mUi->functions->sortItems();
|
||||
} else {
|
||||
ignoreChanges = true;
|
||||
CppcheckLibraryData::Function *selfunction = currentFunction();
|
||||
ui->functions->clear();
|
||||
mUi->functions->clear();
|
||||
for (CppcheckLibraryData::Function &function : data.functions) {
|
||||
ui->functions->addItem(new FunctionListItem(ui->functions,
|
||||
mUi->functions->addItem(new FunctionListItem(mUi->functions,
|
||||
&function,
|
||||
selfunction == &function));
|
||||
}
|
||||
if (!ui->filter->text().isEmpty())
|
||||
filterFunctions(ui->filter->text());
|
||||
if (!mUi->filter->text().isEmpty())
|
||||
filterFunctions(mUi->filter->text());
|
||||
ignoreChanges = false;
|
||||
}
|
||||
}
|
||||
|
||||
void LibraryDialog::filterFunctions(QString filter)
|
||||
{
|
||||
QList<QListWidgetItem *> allItems = ui->functions->findItems(QString(), Qt::MatchContains);
|
||||
QList<QListWidgetItem *> allItems = mUi->functions->findItems(QString(), Qt::MatchContains);
|
||||
|
||||
if (filter.isEmpty()) {
|
||||
foreach (QListWidgetItem *item, allItems) {
|
||||
|
@ -295,12 +295,12 @@ void LibraryDialog::changeFunction()
|
|||
if (!function)
|
||||
return;
|
||||
|
||||
function->comments = ui->comments->toPlainText();
|
||||
function->noreturn = (CppcheckLibraryData::Function::TrueFalseUnknown)ui->noreturn->currentIndex();
|
||||
function->useretval = ui->useretval->isChecked();
|
||||
function->leakignore = ui->leakignore->isChecked();
|
||||
function->comments = mUi->comments->toPlainText();
|
||||
function->noreturn = (CppcheckLibraryData::Function::TrueFalseUnknown)mUi->noreturn->currentIndex();
|
||||
function->useretval = mUi->useretval->isChecked();
|
||||
function->leakignore = mUi->leakignore->isChecked();
|
||||
|
||||
ui->buttonSave->setEnabled(true);
|
||||
mUi->buttonSave->setEnabled(true);
|
||||
}
|
||||
|
||||
void LibraryDialog::editArg()
|
||||
|
@ -309,20 +309,20 @@ void LibraryDialog::editArg()
|
|||
if (!function)
|
||||
return;
|
||||
|
||||
if (ui->arguments->selectedItems().count() != 1)
|
||||
if (mUi->arguments->selectedItems().count() != 1)
|
||||
return;
|
||||
CppcheckLibraryData::Function::Arg &arg = function->args[ui->arguments->row(ui->arguments->selectedItems().first())];
|
||||
CppcheckLibraryData::Function::Arg &arg = function->args[mUi->arguments->row(mUi->arguments->selectedItems().first())];
|
||||
|
||||
LibraryEditArgDialog *d = new LibraryEditArgDialog(0, arg);
|
||||
if (d->exec() == QDialog::Accepted) {
|
||||
unsigned number = arg.nr;
|
||||
arg = d->getArg();
|
||||
arg.nr = number;
|
||||
ui->arguments->selectedItems().first()->setText(getArgText(arg));
|
||||
mUi->arguments->selectedItems().first()->setText(getArgText(arg));
|
||||
}
|
||||
|
||||
delete d;
|
||||
ui->buttonSave->setEnabled(true);
|
||||
mUi->buttonSave->setEnabled(true);
|
||||
}
|
||||
|
||||
QString LibraryDialog::getArgText(const CppcheckLibraryData::Function::Arg &arg)
|
||||
|
@ -345,8 +345,8 @@ QString LibraryDialog::getArgText(const CppcheckLibraryData::Function::Arg &arg)
|
|||
|
||||
void LibraryDialog::updateArguments(const CppcheckLibraryData::Function &function)
|
||||
{
|
||||
ui->arguments->clear();
|
||||
mUi->arguments->clear();
|
||||
foreach (const CppcheckLibraryData::Function::Arg &arg, function.args) {
|
||||
ui->arguments->addItem(getArgText(arg));
|
||||
mUi->arguments->addItem(getArgText(arg));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ private slots:
|
|||
void sortFunctions(bool);
|
||||
|
||||
private:
|
||||
Ui::LibraryDialog *ui;
|
||||
Ui::LibraryDialog *mUi;
|
||||
CppcheckLibraryData data;
|
||||
QString mFileName;
|
||||
bool ignoreChanges;
|
||||
|
|
|
@ -3,97 +3,97 @@
|
|||
|
||||
LibraryEditArgDialog::LibraryEditArgDialog(QWidget *parent, const CppcheckLibraryData::Function::Arg &arg) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::LibraryEditArgDialog),
|
||||
mUi(new Ui::LibraryEditArgDialog),
|
||||
minsizes(arg.minsizes)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->notbool->setChecked(arg.notbool);
|
||||
ui->notnull->setChecked(arg.notnull);
|
||||
ui->notuninit->setChecked(arg.notuninit);
|
||||
ui->strz->setChecked(arg.strz);
|
||||
ui->formatstr->setChecked(arg.formatstr);
|
||||
ui->valid->setText(arg.valid);
|
||||
mUi->setupUi(this);
|
||||
mUi->notbool->setChecked(arg.notbool);
|
||||
mUi->notnull->setChecked(arg.notnull);
|
||||
mUi->notuninit->setChecked(arg.notuninit);
|
||||
mUi->strz->setChecked(arg.strz);
|
||||
mUi->formatstr->setChecked(arg.formatstr);
|
||||
mUi->valid->setText(arg.valid);
|
||||
|
||||
ui->minsize1type->setEnabled(true);
|
||||
ui->minsize1arg->setEnabled(arg.minsizes.count() >= 1);
|
||||
ui->minsize1arg2->setEnabled(arg.minsizes.count() >= 1 && arg.minsizes[0].type == "mul");
|
||||
ui->minsize2type->setEnabled(arg.minsizes.count() >= 1);
|
||||
ui->minsize2arg->setEnabled(arg.minsizes.count() >= 2);
|
||||
ui->minsize2arg2->setEnabled(arg.minsizes.count() >= 2 && arg.minsizes[1].type == "mul");
|
||||
mUi->minsize1type->setEnabled(true);
|
||||
mUi->minsize1arg->setEnabled(arg.minsizes.count() >= 1);
|
||||
mUi->minsize1arg2->setEnabled(arg.minsizes.count() >= 1 && arg.minsizes[0].type == "mul");
|
||||
mUi->minsize2type->setEnabled(arg.minsizes.count() >= 1);
|
||||
mUi->minsize2arg->setEnabled(arg.minsizes.count() >= 2);
|
||||
mUi->minsize2arg2->setEnabled(arg.minsizes.count() >= 2 && arg.minsizes[1].type == "mul");
|
||||
|
||||
QStringList items;
|
||||
items << "None" << "argvalue" << "mul" << "sizeof" << "strlen";
|
||||
|
||||
ui->minsize1type->clear();
|
||||
ui->minsize1type->addItems(items);
|
||||
mUi->minsize1type->clear();
|
||||
mUi->minsize1type->addItems(items);
|
||||
if (arg.minsizes.count() >= 1) {
|
||||
ui->minsize1type->setCurrentIndex(items.indexOf(minsizes[0].type));
|
||||
ui->minsize1arg->setValue(minsizes[0].arg.toInt());
|
||||
mUi->minsize1type->setCurrentIndex(items.indexOf(minsizes[0].type));
|
||||
mUi->minsize1arg->setValue(minsizes[0].arg.toInt());
|
||||
if (arg.minsizes[0].type == "mul")
|
||||
ui->minsize1arg2->setValue(minsizes[0].arg2.toInt());
|
||||
mUi->minsize1arg2->setValue(minsizes[0].arg2.toInt());
|
||||
else
|
||||
ui->minsize1arg2->setValue(0);
|
||||
mUi->minsize1arg2->setValue(0);
|
||||
} else {
|
||||
ui->minsize1type->setCurrentIndex(0);
|
||||
ui->minsize1arg->setValue(0);
|
||||
ui->minsize1arg2->setValue(0);
|
||||
mUi->minsize1type->setCurrentIndex(0);
|
||||
mUi->minsize1arg->setValue(0);
|
||||
mUi->minsize1arg2->setValue(0);
|
||||
}
|
||||
|
||||
ui->minsize2type->clear();
|
||||
ui->minsize2type->addItems(items);
|
||||
mUi->minsize2type->clear();
|
||||
mUi->minsize2type->addItems(items);
|
||||
if (arg.minsizes.count() >= 2) {
|
||||
ui->minsize2type->setCurrentIndex(items.indexOf(minsizes[1].type));
|
||||
ui->minsize2arg->setValue(minsizes[1].arg.toInt());
|
||||
mUi->minsize2type->setCurrentIndex(items.indexOf(minsizes[1].type));
|
||||
mUi->minsize2arg->setValue(minsizes[1].arg.toInt());
|
||||
if (arg.minsizes[1].type == "mul")
|
||||
ui->minsize2arg2->setValue(minsizes[1].arg2.toInt());
|
||||
mUi->minsize2arg2->setValue(minsizes[1].arg2.toInt());
|
||||
else
|
||||
ui->minsize2arg2->setValue(0);
|
||||
mUi->minsize2arg2->setValue(0);
|
||||
} else {
|
||||
ui->minsize2type->setCurrentIndex(0);
|
||||
ui->minsize2arg->setValue(0);
|
||||
ui->minsize2arg2->setValue(0);
|
||||
mUi->minsize2type->setCurrentIndex(0);
|
||||
mUi->minsize2arg->setValue(0);
|
||||
mUi->minsize2arg2->setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
LibraryEditArgDialog::~LibraryEditArgDialog()
|
||||
{
|
||||
delete ui;
|
||||
delete mUi;
|
||||
}
|
||||
|
||||
CppcheckLibraryData::Function::Arg LibraryEditArgDialog::getArg() const
|
||||
{
|
||||
CppcheckLibraryData::Function::Arg ret;
|
||||
ret.notbool = ui->notbool->isChecked();
|
||||
ret.notnull = ui->notnull->isChecked();
|
||||
ret.notuninit = ui->notuninit->isChecked();
|
||||
ret.strz = ui->strz->isChecked();
|
||||
ret.formatstr = ui->formatstr->isChecked();
|
||||
if (ui->minsize1type->currentIndex() != 0) {
|
||||
ret.notbool = mUi->notbool->isChecked();
|
||||
ret.notnull = mUi->notnull->isChecked();
|
||||
ret.notuninit = mUi->notuninit->isChecked();
|
||||
ret.strz = mUi->strz->isChecked();
|
||||
ret.formatstr = mUi->formatstr->isChecked();
|
||||
if (mUi->minsize1type->currentIndex() != 0) {
|
||||
CppcheckLibraryData::Function::Arg::MinSize minsize1;
|
||||
minsize1.type = ui->minsize1type->currentText();
|
||||
minsize1.arg = QString::number(ui->minsize1arg->value());
|
||||
minsize1.type = mUi->minsize1type->currentText();
|
||||
minsize1.arg = QString::number(mUi->minsize1arg->value());
|
||||
if (minsize1.type == "mul")
|
||||
minsize1.arg2 = QString::number(ui->minsize1arg2->value());
|
||||
minsize1.arg2 = QString::number(mUi->minsize1arg2->value());
|
||||
ret.minsizes.append(minsize1);
|
||||
|
||||
if (ui->minsize2type->currentIndex() != 0) {
|
||||
if (mUi->minsize2type->currentIndex() != 0) {
|
||||
CppcheckLibraryData::Function::Arg::MinSize minsize2;
|
||||
minsize2.type = ui->minsize2type->currentText();
|
||||
minsize2.arg = QString::number(ui->minsize2arg->value());
|
||||
minsize2.type = mUi->minsize2type->currentText();
|
||||
minsize2.arg = QString::number(mUi->minsize2arg->value());
|
||||
if (minsize2.type == "mul")
|
||||
minsize2.arg2 = QString::number(ui->minsize2arg2->value());
|
||||
minsize2.arg2 = QString::number(mUi->minsize2arg2->value());
|
||||
ret.minsizes.append(minsize2);
|
||||
}
|
||||
}
|
||||
ret.valid = ui->valid->text();
|
||||
ret.valid = mUi->valid->text();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void LibraryEditArgDialog::minsizeChanged(int)
|
||||
{
|
||||
ui->minsize1arg->setEnabled(ui->minsize1type->currentIndex() != 0);
|
||||
ui->minsize1arg2->setEnabled(ui->minsize1type->currentText() == "mul");
|
||||
ui->minsize2type->setEnabled(ui->minsize1type->currentIndex() != 0);
|
||||
ui->minsize2arg->setEnabled(ui->minsize2type->currentIndex() != 0);
|
||||
ui->minsize2arg2->setEnabled(ui->minsize2type->currentText() == "mul");
|
||||
mUi->minsize1arg->setEnabled(mUi->minsize1type->currentIndex() != 0);
|
||||
mUi->minsize1arg2->setEnabled(mUi->minsize1type->currentText() == "mul");
|
||||
mUi->minsize2type->setEnabled(mUi->minsize1type->currentIndex() != 0);
|
||||
mUi->minsize2arg->setEnabled(mUi->minsize2type->currentIndex() != 0);
|
||||
mUi->minsize2arg2->setEnabled(mUi->minsize2type->currentText() == "mul");
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ private slots:
|
|||
void minsizeChanged(int);
|
||||
|
||||
private:
|
||||
Ui::LibraryEditArgDialog *ui;
|
||||
Ui::LibraryEditArgDialog *mUi;
|
||||
|
||||
QList<CppcheckLibraryData::Function::Arg::MinSize> minsizes;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue