summaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-05-10 21:37:18 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-11 01:57:00 -0700
commitcf848e52330fa0bca2ccc0fb5de5f2a4033fbafa (patch)
tree7801e74e8ecc0be25849993294154c8322bd42b8 /qthelper.cpp
parent3b7624ff464b323fc3c271787a36faa1e97a7b27 (diff)
downloadsubsurface-cf848e52330fa0bca2ccc0fb5de5f2a4033fbafa.tar.gz
Correct the usage of std::string and QString
QStrings shouldn't be == "" to check for empty string, use .isEmpty() QStrings shouldn't be != "" to check for non empty, use .size() std::string shouldn't be cleared with = "", use .clear() Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index f265833b4..a421d7f66 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -66,17 +66,17 @@ const DiveComputerNode *DiveComputerList::get(QString m)
void DiveComputerList::addDC(QString m, uint32_t d, QString n, QString s, QString f)
{
- if (m == "" || d == 0)
+ if (m.isEmpty() || d == 0)
return;
const DiveComputerNode *existNode = this->getExact(m, d);
DiveComputerNode newNode(m, d, s, f, n);
if (existNode) {
if (newNode.changesValues(*existNode)) {
- if (n != "" && existNode->nickName != n)
+ if (n.size() && existNode->nickName != n)
qDebug("new nickname %s for DC model %s deviceId 0x%x", n.toUtf8().data(), m.toUtf8().data(), d);
- if (f != "" && existNode->firmware != f)
+ if (f.size() && existNode->firmware != f)
qDebug("new firmware version %s for DC model %s deviceId 0x%x", f.toUtf8().data(), m.toUtf8().data(), d);
- if (s != "" && existNode->serialNumber != s)
+ if (s.size() && existNode->serialNumber != s)
qDebug("new serial number %s for DC model %s deviceId 0x%x", s.toUtf8().data(), m.toUtf8().data(), d);
} else {
return;
@@ -127,7 +127,7 @@ bool parseGpsText(const QString &gps_text, double *latitude, double *longitude)
trHemisphere[3] = MainWindow::instance()->information()->trHemisphere("W");
QString regExp;
/* an empty string is interpreted as 0.0,0.0 and therefore "no gps location" */
- if (gps_text.trimmed() == "") {
+ if (gps_text.trimmed().isEmpty()) {
*latitude = 0.0;
*longitude = 0.0;
return true;