summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-models/divelocationmodel.cpp1
-rw-r--r--qt-ui/globe.h2
-rw-r--r--qt-ui/locationInformation.ui78
-rw-r--r--qt-ui/locationinformation.cpp17
4 files changed, 34 insertions, 64 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index d45df349c..42f283f1e 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -1,5 +1,6 @@
#include "divelocationmodel.h"
#include "dive.h"
+#include <QDebug>
bool dive_site_less_than(dive_site *a, dive_site *b)
{
diff --git a/qt-ui/globe.h b/qt-ui/globe.h
index 5cdaa1c18..ab03e1266 100644
--- a/qt-ui/globe.h
+++ b/qt-ui/globe.h
@@ -39,7 +39,7 @@ private:
bool doubleClick;
signals:
- void coordinatesChanged(void);
+ void coordinatesChanged();
public
slots:
diff --git a/qt-ui/locationInformation.ui b/qt-ui/locationInformation.ui
index c4638642c..5c69351ac 100644
--- a/qt-ui/locationInformation.ui
+++ b/qt-ui/locationInformation.ui
@@ -17,52 +17,47 @@
<string>Dive Site</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <property name="leftMargin">
- <number>12</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <property name="horizontalSpacing">
- <number>2</number>
- </property>
- <property name="verticalSpacing">
- <number>5</number>
- </property>
+ <item row="0" column="0" colspan="2">
+ <widget class="KMessageWidget" name="diveSiteMessage" native="true"/>
+ </item>
<item row="1" column="0">
- <widget class="QLabel" name="label_5">
+ <widget class="QLabel" name="label">
<property name="text">
- <string>Current Location</string>
+ <string>Name</string>
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QLabel" name="label">
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="diveSiteName"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_2">
<property name="text">
- <string>Name</string>
+ <string>Coordinates</string>
</property>
</widget>
</item>
- <item row="0" column="0" colspan="3">
- <widget class="KMessageWidget" name="diveSiteMessage" native="true"/>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="diveSiteCoordinates"/>
</item>
- <item row="5" column="0">
+ <item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
- <item row="4" column="1">
- <widget class="QLineEdit" name="diveSiteCoordinates"/>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="diveSiteDescription"/>
</item>
- <item row="7" column="0">
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Notes</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -75,32 +70,9 @@
</property>
</spacer>
</item>
- <item row="6" column="1" rowspan="2" colspan="2">
+ <item row="4" column="1" rowspan="2">
<widget class="QPlainTextEdit" name="diveSiteNotes"/>
</item>
- <item row="6" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Notes</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLineEdit" name="diveSiteName"/>
- </item>
- <item row="5" column="1">
- <widget class="QLineEdit" name="diveSiteDescription"/>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Coordinates</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="currentLocation"/>
- </item>
</layout>
</widget>
<customwidgets>
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp
index 25d3ddecb..fe00bf514 100644
--- a/qt-ui/locationinformation.cpp
+++ b/qt-ui/locationinformation.cpp
@@ -28,8 +28,6 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
ui.diveSiteMessage->setText(tr("Dive site management"));
ui.diveSiteMessage->addAction(closeAction);
- ui.currentLocation->setModel(LocationInformationModel::instance());
- connect(ui.currentLocation, SIGNAL(currentIndexChanged(int)), this, SLOT(setCurrentDiveSite(int)));
connect(this, SIGNAL(startFilterDiveSite(uint32_t)), MultiFilterSortModel::instance(), SLOT(startFilterDiveSite(uint32_t)));
connect(this, SIGNAL(stopFilterDiveSite()), MultiFilterSortModel::instance(), SLOT(stopFilterDiveSite()));
}
@@ -54,13 +52,6 @@ void LocationInformationWidget::setCurrentDiveSiteByUuid(uint32_t uuid)
displayed_dive_site = *currentDs;
- if (ui.currentLocation->currentText() != displayed_dive_site.name) {
- // this will trigger setCurrentDiveSite again, and thus,
- // will gethere with the correct uuid.
- ui.currentLocation->setCurrentText(displayed_dive_site.name);
- return;
- }
-
if (displayed_dive_site.name)
ui.diveSiteName->setText(displayed_dive_site.name);
else
@@ -206,7 +197,13 @@ void LocationInformationWidget::on_diveSiteName_textChanged(const QString& text)
// This needs to be changed directly into the model so that
// the changes are replyed on the ComboBox with the current selection.
- QModelIndex idx = ui.currentLocation->model()->index(ui.currentLocation->currentIndex(),0);
+ int i;
+ struct dive_site *ds;
+ for_each_dive_site(i,ds)
+ if (ds->uuid == currentDs->uuid)
+ break;
+
+ QModelIndex idx = LocationInformationModel::instance()->index(i,0);
LocationInformationModel::instance()->setData(idx, text, Qt::EditRole);
markChangedWidget(ui.diveSiteName);
emit coordinatesChanged();