summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-01-07 11:12:48 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-01-11 06:07:13 +0100
commite85ecdd9254a8bd222ccb2dfed7d3b3bb96c8294 (patch)
tree0483cdb3c5770ca75eeeb0cc2de787b0e7bdbd3c /profile-widget
parent86ef9fce7517313570838ca8e853132876035611 (diff)
downloadsubsurface-e85ecdd9254a8bd222ccb2dfed7d3b3bb96c8294.tar.gz
Introduce helper function empty_string()
There are ca. 50 constructs of the kind same_string(s, "") to test for empty or null strings. Replace them by the new helper function empty_string(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/diveeventitem.cpp2
-rw-r--r--profile-widget/profilewidget2.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp
index 949c31c8c..28be9827c 100644
--- a/profile-widget/diveeventitem.cpp
+++ b/profile-widget/diveeventitem.cpp
@@ -80,7 +80,7 @@ void DiveEventItem::setupPixmap()
#define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(sz_pix, sz_pix, Qt::KeepAspectRatio, Qt::SmoothTransformation)
#define EVENT_PIXMAP_BIGGER(PIX) QPixmap(QString(PIX)).scaled(sz_bigger, sz_bigger, Qt::KeepAspectRatio, Qt::SmoothTransformation)
- if (same_string(internalEvent->name, "")) {
+ if (empty_string(internalEvent->name)) {
setPixmap(EVENT_PIXMAP(":status-warning-icon"));
} else if (internalEvent->type == SAMPLE_EVENT_BOOKMARK) {
setPixmap(EVENT_PIXMAP(":dive-bookmark-icon"));
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 97e69fb82..976f29d07 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -718,7 +718,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
while (event) {
// if print mode is selected only draw headings, SP change, gas events or bookmark event
if (printMode) {
- if (same_string(event->name, "") ||
+ if (empty_string(event->name) ||
!(strcmp(event->name, "heading") == 0 ||
(same_string(event->name, "SP change") && event->time.seconds == 0) ||
event_is_gaschange(event) ||
@@ -1488,7 +1488,7 @@ void ProfileWidget2::hideEvents()
if (QMessageBox::question(this,
TITLE_OR_TEXT(tr("Hide events"), tr("Hide all %1 events?").arg(event->name)),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
- if (!same_string(event->name, "")) {
+ if (!empty_string(event->name)) {
for (int i = 0; i < evn_used; i++) {
if (same_string(event->name, ev_namelist[i].ev_name)) {
ev_namelist[i].plot_ev = false;