aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-07-08 18:45:20 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-09 08:34:00 -0700
commitdbc33cb81a606146f609ba2f8699c6a4c13fe4ce (patch)
tree8c5f2143def21a81cf4ec6a9935b6061a28105c2 /qt-ui
parent0054304cc84578309427a73e5b7d3199b786df10 (diff)
downloadsubsurface-dbc33cb81a606146f609ba2f8699c6a4c13fe4ce.tar.gz
Correctly save the tags on the dive.
Very good patch, lots of removed lines. :) Only try to add the tags when user accepts, discards the test to see if the tags were changed or not, delete the old list and copy the new one always. only bug that's appearing now: taglist is still empty after save we need to reselect the dive to make it appear, fixing that on the next patch. 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/maintab.cpp31
-rw-r--r--qt-ui/maintab.h1
2 files changed, 4 insertions, 28 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index ad672ce36..524966093 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -970,24 +970,6 @@ void MainTab::on_timeEdit_timeChanged(const QTime &time)
markChangedWidget(ui.timeEdit);
}
-bool MainTab::tagsChanged(dive *a, dive *b)
-{
- char bufA[1024], bufB[1024];
- taglist_get_tagstring(a->tag_list, bufA, sizeof(bufA));
- taglist_get_tagstring(b->tag_list, bufB, sizeof(bufB));
- QString tagStringA(bufA);
- QString tagStringB(bufB);
- QStringList text_list = tagStringA.split(",", QString::SkipEmptyParts);
- for (int i = 0; i < text_list.size(); i++)
- text_list[i] = text_list[i].trimmed();
- QString textA = text_list.join(", ");
- text_list = tagStringB.split(",", QString::SkipEmptyParts);
- for (int i = 0; i < text_list.size(); i++)
- text_list[i] = text_list[i].trimmed();
- QString textB = text_list.join(", ");
- return textA != textB;
-}
-
// changing the tags on multiple dives is semantically strange - what's the right thing to do?
void MainTab::saveTags()
{
@@ -997,21 +979,16 @@ void MainTab::saveTags()
taglist_free(mydive->tag_list);
mydive->tag_list = NULL;
Q_FOREACH (tag, ui.tagWidget->getBlockStringList())
- taglist_add_tag(&mydive->tag_list, tag.toUtf8().data()););
+ taglist_add_tag(&mydive->tag_list, tag.toUtf8().data());
+ );
+ qDebug() << "Save tags called";
}
void MainTab::on_tagWidget_textChanged()
{
if (editMode == IGNORE)
return;
- QString tag;
- if (displayed_dive.tag_list != current_dive->tag_list)
- taglist_free(displayed_dive.tag_list);
- displayed_dive.tag_list = NULL;
- Q_FOREACH (tag, ui.tagWidget->getBlockStringList())
- taglist_add_tag(&displayed_dive.tag_list, tag.toUtf8().data());
- if (tagsChanged(&displayed_dive, current_dive))
- markChangedWidget(ui.tagWidget);
+ markChangedWidget(ui.tagWidget);
}
void MainTab::on_location_textChanged(const QString &text)
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 3eb5596fa..1493d6d97 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -102,7 +102,6 @@ private:
bool modified;
void resetPallete();
void saveTags();
- bool tagsChanged(struct dive *a, struct dive *b);
void updateGpsCoordinates(const struct dive *dive);
void markChangedWidget(QWidget *w);
};