summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-07-29 13:06:30 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-29 09:38:10 -0700
commit357f5c19dacfb02c241f6c7b94e40bd2d92bc964 (patch)
tree07000fc79bd89b5eb7c8c87809c682d7966033c6 /qt-ui
parent8c8657f9965ccebc481a741bd8d525f13ff5b8b0 (diff)
downloadsubsurface-357f5c19dacfb02c241f6c7b94e40bd2d92bc964.tar.gz
C++ Correctness and code cleanup.
Use const-reference where we can gain a bit of speed from that and clear an else { if {}} by using else if. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/groupedlineedit.cpp2
-rw-r--r--qt-ui/mainwindow.cpp10
2 files changed, 5 insertions, 7 deletions
diff --git a/qt-ui/groupedlineedit.cpp b/qt-ui/groupedlineedit.cpp
index 28758e02f..4867089f4 100644
--- a/qt-ui/groupedlineedit.cpp
+++ b/qt-ui/groupedlineedit.cpp
@@ -106,7 +106,7 @@ void GroupedLineEdit::removeAllColors()
QStringList GroupedLineEdit::getBlockStringList()
{
QStringList retList;
- foreach (Private::Block block, d->blocks)
+ foreach (const Private::Block &block, d->blocks)
retList.append(block.text);
return retList;
}
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 194ea1acb..bbee51b8b 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1025,18 +1025,16 @@ void MainWindow::removeRecentFile(QStringList failedFiles)
}
}
- foreach (QString file, failedFiles)
+ foreach (const QString &file, failedFiles)
files.removeAll(file);
for (int c = 1; c <= 4; c++) {
QString key = QString("File_%1").arg(c);
- if (files.count() >= c) {
+ if (files.count() >= c)
s.setValue(key, files.at(c - 1));
- } else {
- if (s.contains(key))
- s.remove(key);
- }
+ else if (s.contains(key))
+ s.remove(key);
}
s.endGroup();