Skip to content

Commit b4cf79f

Browse files
committed
GUI: Refactorizations
1 parent dfc48be commit b4cf79f

13 files changed

Lines changed: 63 additions & 64 deletions

gui/applicationlist.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ bool ApplicationList::loadSettings()
5252
bool succeeded = true;
5353
if (!names.empty() && !paths.empty() && params.empty()) {
5454
for (int i = 0; i < paths.length(); i++)
55-
params << "";
55+
params << QString();
5656
succeeded = false;
5757
}
5858

gui/checkthread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void CheckThread::run()
104104
a = addonPath + '/' + addon + '/' + addon + ".py";
105105
else
106106
continue;
107-
QString dumpFile = QString::fromStdString(file + ".dump");
107+
QString dumpFile = file + ".dump";
108108
QString cmd = "python " + a + ' ' + dumpFile;
109109
qDebug() << cmd;
110110
process.start(cmd);

gui/common.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
QString getPath(const QString &type)
2727
{
2828
QSettings settings;
29-
QString path = settings.value(type, "").toString();
29+
QString path = settings.value(type, QString()).toString();
3030
if (path.isEmpty()) {
3131
// if not set, fallback to last check path hoping that it will be close enough
32-
path = settings.value(SETTINGS_LAST_CHECK_PATH, "").toString();
32+
path = settings.value(SETTINGS_LAST_CHECK_PATH, QString()).toString();
3333
if (path.isEmpty())
3434
// if not set, return user's home directory as the best we can do for now
3535
return QDir::homePath();

gui/fileviewdialog.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,5 @@ void FileViewDialog::loadTextFile(const QString &filename, QTextEdit *edit)
6767
QByteArray filedata = file.readAll();
6868
file.close();
6969

70-
QString filestringdata(filedata);
71-
edit->setPlainText(filestringdata);
70+
edit->setPlainText(filedata);
7271
}

gui/logview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void LogView::clearButtonClicked()
6666
void LogView::saveButtonClicked()
6767
{
6868
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Log"),
69-
"", tr("Text files (*.txt *.log);;All files (*.*)"));
69+
QString(), tr("Text files (*.txt *.log);;All files (*.*)"));
7070
if (!fileName.isEmpty()) {
7171
QFile file(fileName);
7272
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {

gui/mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ void MainWindow::analyzeFiles()
554554
{
555555
QStringList selected = selectFilesToAnalyze(QFileDialog::ExistingFiles);
556556

557-
const QString file0 = (selected.size() ? selected[0].toLower() : "");
557+
const QString file0 = (selected.size() ? selected[0].toLower() : QString());
558558
if (file0.endsWith(".sln") || file0.endsWith(".vcxproj") || file0.endsWith(compile_commands_json)) {
559559
ImportProject p;
560560
p.import(selected[0].toStdString());

gui/projectfile.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ bool ProjectFile::read(const QString &filename)
156156
void ProjectFile::readRootPath(QXmlStreamReader &reader)
157157
{
158158
QXmlStreamAttributes attribs = reader.attributes();
159-
QString name = attribs.value("", RootPathNameAttrib).toString();
159+
QString name = attribs.value(QString(), RootPathNameAttrib).toString();
160160
if (!name.isEmpty())
161161
mRootPath = name;
162162
}
@@ -223,7 +223,7 @@ void ProjectFile::readIncludeDirs(QXmlStreamReader &reader)
223223
// Read dir-elements
224224
if (reader.name().toString() == DirElementName) {
225225
QXmlStreamAttributes attribs = reader.attributes();
226-
QString name = attribs.value("", DirNameAttrib).toString();
226+
QString name = attribs.value(QString(), DirNameAttrib).toString();
227227
if (!name.isEmpty())
228228
mIncludeDirs << name;
229229
}
@@ -260,7 +260,7 @@ void ProjectFile::readDefines(QXmlStreamReader &reader)
260260
// Read define-elements
261261
if (reader.name().toString() == DefineName) {
262262
QXmlStreamAttributes attribs = reader.attributes();
263-
QString name = attribs.value("", DefineNameAttrib).toString();
263+
QString name = attribs.value(QString(), DefineNameAttrib).toString();
264264
if (!name.isEmpty())
265265
mDefines << name;
266266
}
@@ -298,7 +298,7 @@ void ProjectFile::readCheckPaths(QXmlStreamReader &reader)
298298
// Read dir-elements
299299
if (reader.name().toString() == PathName) {
300300
QXmlStreamAttributes attribs = reader.attributes();
301-
QString name = attribs.value("", PathNameAttrib).toString();
301+
QString name = attribs.value(QString(), PathNameAttrib).toString();
302302
if (!name.isEmpty())
303303
mPaths << name;
304304
}
@@ -335,14 +335,14 @@ void ProjectFile::readExcludes(QXmlStreamReader &reader)
335335
// Read exclude-elements
336336
if (reader.name().toString() == ExcludePathName) {
337337
QXmlStreamAttributes attribs = reader.attributes();
338-
QString name = attribs.value("", ExcludePathNameAttrib).toString();
338+
QString name = attribs.value(QString(), ExcludePathNameAttrib).toString();
339339
if (!name.isEmpty())
340340
mExcludedPaths << name;
341341
}
342342
// Read ignore-elements - deprecated but support reading them
343343
else if (reader.name().toString() == IgnorePathName) {
344344
QXmlStreamAttributes attribs = reader.attributes();
345-
QString name = attribs.value("", IgnorePathNameAttrib).toString();
345+
QString name = attribs.value(QString(), IgnorePathNameAttrib).toString();
346346
if (!name.isEmpty())
347347
mExcludedPaths << name;
348348
}

gui/resultstree.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ QString ResultsTree::severityToTranslatedString(Severity::SeverityType severity)
316316

317317
case Severity::none:
318318
default:
319-
return "";
319+
return QString();
320320
}
321321
}
322322

@@ -1033,7 +1033,7 @@ QString ResultsTree::severityToIcon(Severity::SeverityType severity) const
10331033
case Severity::information:
10341034
return ":images/dialog-information.png";
10351035
default:
1036-
return "";
1036+
return QString();
10371037
}
10381038
}
10391039

gui/resultsview.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void ResultsView::clear(bool results)
7777
mUI.mTree->clear();
7878
}
7979

80-
mUI.mDetails->setText("");
80+
mUI.mDetails->setText(QString());
8181

8282
mStatistics->clear();
8383

@@ -363,7 +363,7 @@ void ResultsView::readErrorsXml(const QString &filename)
363363
foreach (item, errors) {
364364
mUI.mTree->addErrorItem(item);
365365
}
366-
mUI.mTree->setCheckDirectory("");
366+
mUI.mTree->setCheckDirectory(QString());
367367
}
368368

369369
void ResultsView::updateDetails(const QModelIndex &index)
@@ -372,7 +372,7 @@ void ResultsView::updateDetails(const QModelIndex &index)
372372
QStandardItem *item = model->itemFromIndex(index);
373373

374374
if (!item) {
375-
mUI.mDetails->setText("");
375+
mUI.mDetails->setText(QString());
376376
return;
377377
}
378378

@@ -384,7 +384,7 @@ void ResultsView::updateDetails(const QModelIndex &index)
384384

385385
// If there is no severity data then it is a parent item without summary and message
386386
if (!data.contains("severity")) {
387-
mUI.mDetails->setText("");
387+
mUI.mDetails->setText(QString());
388388
return;
389389
}
390390

@@ -395,7 +395,7 @@ void ResultsView::updateDetails(const QModelIndex &index)
395395
.arg(tr("Message")).arg(message);
396396

397397
const QString file0 = data["file0"].toString();
398-
if (file0 != "" && Path::isHeader(data["file"].toString().toStdString()))
398+
if (!file0.isEmpty() && Path::isHeader(data["file"].toString().toStdString()))
399399
formattedMsg += QString("\n\n%1: %2").arg(tr("First included by")).arg(QDir::toNativeSeparators(file0));
400400

401401
if (mUI.mTree->showIdColumn())

gui/statsdialog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ void StatsDialog::setProject(const ProjectFile* projectFile)
4747
mUI.mIncludePaths->setText(projectFile->getIncludeDirs().join(";"));
4848
mUI.mDefines->setText(projectFile->getDefines().join(";"));
4949
} else {
50-
mUI.mProject->setText("");
51-
mUI.mPaths->setText("");
52-
mUI.mIncludePaths->setText("");
53-
mUI.mDefines->setText("");
50+
mUI.mProject->setText(QString());
51+
mUI.mPaths->setText(QString());
52+
mUI.mIncludePaths->setText(QString());
53+
mUI.mDefines->setText(QString());
5454
}
5555
}
5656

0 commit comments

Comments
 (0)