GUI: Renamed private variables

This commit is contained in:
Daniel Marjamäki 2018-06-18 14:11:34 +02:00
parent 7d00b30488
commit dbc19d6503
2 changed files with 23 additions and 23 deletions

View File

@ -47,7 +47,7 @@ public:
LibraryDialog::LibraryDialog(QWidget *parent) : LibraryDialog::LibraryDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),
mUi(new Ui::LibraryDialog), mUi(new Ui::LibraryDialog),
ignoreChanges(false) mIgnoreChanges(false)
{ {
mUi->setupUi(this); mUi->setupUi(this);
mUi->buttonSave->setEnabled(false); mUi->buttonSave->setEnabled(false);
@ -112,22 +112,22 @@ void LibraryDialog::openCfg()
return; return;
} }
ignoreChanges = true; mIgnoreChanges = true;
data.swap(tempdata); mData.swap(tempdata);
mFileName = selectedFile; mFileName = selectedFile;
mUi->buttonSave->setEnabled(false); mUi->buttonSave->setEnabled(false);
mUi->buttonSaveAs->setEnabled(true); mUi->buttonSaveAs->setEnabled(true);
mUi->filter->clear(); mUi->filter->clear();
mUi->functions->clear(); mUi->functions->clear();
for (CppcheckLibraryData::Function &function : data.functions) { for (CppcheckLibraryData::Function &function : mData.functions) {
mUi->functions->addItem(new FunctionListItem(mUi->functions, mUi->functions->addItem(new FunctionListItem(mUi->functions,
&function, &function,
false)); false));
} }
mUi->sortFunctions->setEnabled(!data.functions.empty()); mUi->sortFunctions->setEnabled(!mData.functions.empty());
mUi->filter->setEnabled(!data.functions.empty()); mUi->filter->setEnabled(!mData.functions.empty());
mUi->addFunction->setEnabled(true); mUi->addFunction->setEnabled(true);
ignoreChanges = false; mIgnoreChanges = false;
} }
void LibraryDialog::saveCfg() void LibraryDialog::saveCfg()
@ -137,7 +137,7 @@ void LibraryDialog::saveCfg()
QFile file(mFileName); QFile file(mFileName);
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream ts(&file); QTextStream ts(&file);
ts << data.toString() << '\n'; ts << mData.toString() << '\n';
mUi->buttonSave->setEnabled(false); mUi->buttonSave->setEnabled(false);
} else { } else {
QMessageBox msg(QMessageBox::Critical, QMessageBox msg(QMessageBox::Critical,
@ -181,18 +181,18 @@ void LibraryDialog::addFunction()
arg.nr = i; arg.nr = i;
f.args.append(arg); f.args.append(arg);
} }
data.functions.append(f); mData.functions.append(f);
mUi->functions->addItem(new FunctionListItem(mUi->functions, &data.functions.back(), false)); mUi->functions->addItem(new FunctionListItem(mUi->functions, &mData.functions.back(), false));
mUi->buttonSave->setEnabled(true); mUi->buttonSave->setEnabled(true);
mUi->sortFunctions->setEnabled(!data.functions.empty()); mUi->sortFunctions->setEnabled(!mData.functions.empty());
mUi->filter->setEnabled(!data.functions.empty()); mUi->filter->setEnabled(!mData.functions.empty());
} }
delete d; delete d;
} }
void LibraryDialog::editFunctionName(QListWidgetItem* item) void LibraryDialog::editFunctionName(QListWidgetItem* item)
{ {
if (ignoreChanges) if (mIgnoreChanges)
return; return;
QString functionName = item->text(); QString functionName = item->text();
CppcheckLibraryData::Function * const function = dynamic_cast<FunctionListItem*>(item)->function; CppcheckLibraryData::Function * const function = dynamic_cast<FunctionListItem*>(item)->function;
@ -201,9 +201,9 @@ void LibraryDialog::editFunctionName(QListWidgetItem* item)
function->name = functionName; function->name = functionName;
mUi->buttonSave->setEnabled(true); mUi->buttonSave->setEnabled(true);
} else { } else {
ignoreChanges = true; mIgnoreChanges = true;
item->setText(function->name); item->setText(function->name);
ignoreChanges = false; mIgnoreChanges = false;
} }
} }
} }
@ -232,7 +232,7 @@ void LibraryDialog::selectFunction()
return; return;
} }
ignoreChanges = true; mIgnoreChanges = true;
mUi->comments->setPlainText(function->comments); mUi->comments->setPlainText(function->comments);
mUi->comments->setEnabled(true); mUi->comments->setEnabled(true);
@ -249,7 +249,7 @@ void LibraryDialog::selectFunction()
mUi->arguments->setEnabled(true); mUi->arguments->setEnabled(true);
mUi->editArgButton->setEnabled(true); mUi->editArgButton->setEnabled(true);
ignoreChanges = false; mIgnoreChanges = false;
} }
void LibraryDialog::sortFunctions(bool sort) void LibraryDialog::sortFunctions(bool sort)
@ -257,17 +257,17 @@ void LibraryDialog::sortFunctions(bool sort)
if (sort) { if (sort) {
mUi->functions->sortItems(); mUi->functions->sortItems();
} else { } else {
ignoreChanges = true; mIgnoreChanges = true;
CppcheckLibraryData::Function *selfunction = currentFunction(); CppcheckLibraryData::Function *selfunction = currentFunction();
mUi->functions->clear(); mUi->functions->clear();
for (CppcheckLibraryData::Function &function : data.functions) { for (CppcheckLibraryData::Function &function : mData.functions) {
mUi->functions->addItem(new FunctionListItem(mUi->functions, mUi->functions->addItem(new FunctionListItem(mUi->functions,
&function, &function,
selfunction == &function)); selfunction == &function));
} }
if (!mUi->filter->text().isEmpty()) if (!mUi->filter->text().isEmpty())
filterFunctions(mUi->filter->text()); filterFunctions(mUi->filter->text());
ignoreChanges = false; mIgnoreChanges = false;
} }
} }
@ -288,7 +288,7 @@ void LibraryDialog::filterFunctions(QString filter)
void LibraryDialog::changeFunction() void LibraryDialog::changeFunction()
{ {
if (ignoreChanges) if (mIgnoreChanges)
return; return;
CppcheckLibraryData::Function *function = currentFunction(); CppcheckLibraryData::Function *function = currentFunction();

View File

@ -53,9 +53,9 @@ private slots:
private: private:
Ui::LibraryDialog *mUi; Ui::LibraryDialog *mUi;
CppcheckLibraryData data; CppcheckLibraryData mData;
QString mFileName; QString mFileName;
bool ignoreChanges; bool mIgnoreChanges;
static QString getArgText(const CppcheckLibraryData::Function::Arg &arg); static QString getArgText(const CppcheckLibraryData::Function::Arg &arg);
CppcheckLibraryData::Function *currentFunction(); CppcheckLibraryData::Function *currentFunction();