summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-01-10 07:09:17 +0800
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2020-03-06 10:00:13 +0100
commit2a97934db4c9e0bedf87649575cba527b874386f (patch)
tree5fe2ac4319a95c07ebf04df7f8c9eb5082811f01
parentc495a49b1b044ab54ee60d4b0db14caa3f8e3de1 (diff)
downloadsubsurface-2a97934db4c9e0bedf87649575cba527b874386f.tar.gz
Cleanup: Move stringToList to core/qthelper.cpp
The same code was used in desktop and undo commands. Let's unify. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--commands/command_edit.cpp9
-rw-r--r--core/qthelper.cpp8
-rw-r--r--core/qthelper.h1
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp8
4 files changed, 9 insertions, 17 deletions
diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp
index d55684814..80a7ac986 100644
--- a/commands/command_edit.cpp
+++ b/commands/command_edit.cpp
@@ -726,15 +726,6 @@ DiveField EditTags::fieldId() const
return DiveField::TAGS;
}
-// String list helper
-static QStringList stringToList(const QString &s)
-{
- QStringList res = s.split(",", QString::SkipEmptyParts);
- for (QString &str: res)
- str = str.trimmed();
- return res;
-}
-
// ***** Buddies *****
QStringList EditBuddies::data(struct dive *d) const
{
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 2bb2c5d72..b00201297 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -1219,6 +1219,14 @@ QString get_taglist_string(struct tag_entry *tag_list)
return ret;
}
+QStringList stringToList(const QString &s)
+{
+ QStringList res = s.split(",", QString::SkipEmptyParts);
+ for (QString &str: res)
+ str = str.trimmed();
+ return res;
+}
+
weight_t string_to_weight(const char *str)
{
const char *end;
diff --git a/core/qthelper.h b/core/qthelper.h
index 6dc6c4d6f..4c3a6aa19 100644
--- a/core/qthelper.h
+++ b/core/qthelper.h
@@ -29,6 +29,7 @@ QList<int> getDivesInTrip(struct dive_trip *trip);
QString get_gas_string(struct gasmix gas);
QString get_divepoint_gas_string(struct dive *d, const struct divedatapoint &dp);
QString get_taglist_string(struct tag_entry *tag_list);
+QStringList stringToList(const QString &s);
void read_hashes();
void write_hashes();
QString thumbnailFileName(const QString &filename);
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 85d64c66d..ca51feb05 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -631,14 +631,6 @@ void MainTab::divesEdited(int i)
ui.multiDiveWarningMessage->show();
}
-static QStringList stringToList(const QString &s)
-{
- QStringList res = s.split(",", QString::SkipEmptyParts);
- for (QString &str: res)
- str = str.trimmed();
- return res;
-}
-
void MainTab::on_buddy_editingFinished()
{
if (editMode == IGNORE_MODE || !current_dive)