summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 22:24:12 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 22:45:47 -0800
commit4e95beabc2fd7cdd2efcceb226417f84a903861f (patch)
tree0b8aa99e606a11476efc212a62f585c33355e1cf
parent616cb18b2919d8131c1520975d7c5eb7e8e4aaec (diff)
downloadsubsurface-4e95beabc2fd7cdd2efcceb226417f84a903861f.tar.gz
Remove coordinates from main tab
It seems to make sense to only have them on the dive site screen. For the main UI they were redundant (we have the map) and not all that useful. The only time people would want them is if they wanted to manually add GPS coordinates for a dive, but that should now be done via the dive site UI. There are a couple of FIXMEs in the code and a few code blocks that have been commented out as they will be needed in one form or another once this GPS handling is done on the dive site UI, which right now it is NOT. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/globe.cpp7
-rw-r--r--qt-ui/maintab.cpp38
-rw-r--r--qt-ui/maintab.h2
-rw-r--r--qt-ui/maintab.ui130
-rw-r--r--qt-ui/mainwindow.cpp5
-rw-r--r--qthelper.cpp2
6 files changed, 83 insertions, 101 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index 58e7dc620..256eff175 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -347,7 +347,12 @@ void GlobeGPS::mousePressEvent(QMouseEvent *event)
// there could be two scenarios that got us here; let's check if we are editing a dive
if (MainWindow::instance()->information()->isEditing() && clickOnGlobe) {
- MainWindow::instance()->information()->updateCoordinatesText(lat, lon);
+ //
+ // FIXME
+ // TODO
+ //
+ // this needs to do this on the dive site screen
+ // MainWindow::instance()->information()->updateCoordinatesText(lat, lon);
repopulateLabels();
} else if (clickOnGlobe) {
changeDiveGeoPosition(lon, lat, GeoDataCoordinates::Degree);
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index e2ccd44de..1fbb32fa8 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -72,7 +72,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
setEnabled(false);
ui.location->installEventFilter(this);
- ui.coordinates->installEventFilter(this);
ui.divemaster->installEventFilter(this);
ui.buddy->installEventFilter(this);
ui.suit->installEventFilter(this);
@@ -443,7 +442,6 @@ void MainTab::updateDiveInfo(bool clear)
ui.location->setText(ds->name);
else
ui.location->clear();
- updateGpsCoordinates();
// Subsurface always uses "local time" as in "whatever was the local time at the location"
// so all time stamps have no time zone information and are in UTC
QDateTime localTime = QDateTime::fromTime_t(displayed_dive.when - gettimezoneoffset(displayed_dive.when));
@@ -454,8 +452,6 @@ void MainTab::updateDiveInfo(bool clear)
setTabText(0, tr("Trip notes"));
currentTrip = *MainWindow::instance()->dive_list()->selectedTrips().begin();
// only use trip relevant fields
- ui.coordinates->setVisible(false);
- ui.CoordinatedLabel->setVisible(false);
ui.divemaster->setVisible(false);
ui.DivemasterLabel->setVisible(false);
ui.buddy->setVisible(false);
@@ -485,8 +481,6 @@ void MainTab::updateDiveInfo(bool clear)
setTabText(0, tr("Dive notes"));
currentTrip = NULL;
// make all the fields visible writeable
- ui.coordinates->setVisible(true);
- ui.CoordinatedLabel->setVisible(true);
ui.divemaster->setVisible(true);
ui.buddy->setVisible(true);
ui.suit->setVisible(true);
@@ -655,7 +649,6 @@ void MainTab::updateDiveInfo(bool clear)
clearStats();
clearEquipment();
ui.rating->setCurrentStars(0);
- ui.coordinates->clear();
ui.visibility->setCurrentStars(0);
ui.location->clear();
}
@@ -765,8 +758,6 @@ void MainTab::acceptChanges()
copy_samples(&displayed_dive.dc, &current_dive->dc);
}
struct dive *cd = current_dive;
- //Reset coordinates field, in case it contains garbage.
- updateGpsCoordinates();
// now check if something has changed and if yes, edit the selected dives that
// were identical with the master dive shown (and mark the divelist as changed)
if (!same_string(displayed_dive.buddy, cd->buddy))
@@ -794,17 +785,6 @@ void MainTab::acceptChanges()
time_t offset = cd->when - displayed_dive.when;
MODIFY_SELECTED_DIVES(mydive->when -= offset;);
}
- if (displayed_dive.latitude.udeg != cd->latitude.udeg ||
- displayed_dive.longitude.udeg != cd->longitude.udeg)
- MODIFY_SELECTED_DIVES(
- if (copyPaste ||
- (same_string(mydive->location, cd->location) &&
- mydive->latitude.udeg == cd->latitude.udeg &&
- mydive->longitude.udeg == cd->longitude.udeg))
- gpsHasChanged(mydive, cd, ui.coordinates->text(), 0);
- );
- if (!same_string(displayed_dive.location, cd->location))
- MODIFY_SELECTED_DIVES(EDIT_TEXT(location));
saveTags();
@@ -910,7 +890,6 @@ void MainTab::resetPallete()
ui.buddy->setPalette(p);
ui.notes->setPalette(p);
ui.location->setPalette(p);
- ui.coordinates->setPalette(p);
ui.divemaster->setPalette(p);
ui.suit->setPalette(p);
ui.airtemp->setPalette(p);
@@ -1148,8 +1127,17 @@ void MainTab::on_location_textChanged(const QString &text)
free(displayedTrip.location);
displayedTrip.location = strdup(ui.location->text().toUtf8().data());
} else {
- free(displayed_dive.location);
- displayed_dive.location = strdup(ui.location->text().toUtf8().data());
+ // this means we switched dive sites... this requires a lot more thinking
+ //
+ //
+ // FIXME
+ //
+ // TODO
+ //
+ //
+ //
+ // free(displayed_dive.location);
+ // displayed_dive.location = strdup(ui.location->text().toUtf8().data());
}
markChangedWidget(ui.location);
}
@@ -1195,6 +1183,7 @@ void MainTab::on_notes_textChanged()
markChangedWidget(ui.notes);
}
+#if 0 // we'll need something like this for the dive site management
void MainTab::on_coordinates_textChanged(const QString &text)
{
if (editMode == IGNORE || acceptingEdit == true)
@@ -1211,6 +1200,7 @@ void MainTab::on_coordinates_textChanged(const QString &text)
ui.coordinates->setPalette(p); // marks things red
}
}
+#endif
void MainTab::on_rating_valueChanged(int value)
{
@@ -1262,6 +1252,7 @@ void MainTab::editWeightWidget(const QModelIndex &index)
ui.weights->edit(index);
}
+#if 0 // we'll need this for dive sites
void MainTab::updateCoordinatesText(qreal lat, qreal lon)
{
int ulat = rint(lat * 1000000);
@@ -1283,6 +1274,7 @@ void MainTab::updateGpsCoordinates()
ui.coordinates->clear();
}
}
+#endif
void MainTab::escDetected()
{
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 505fa6f21..aebd51073 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -66,7 +66,6 @@ slots:
void rejectChanges();
void on_location_textChanged(const QString &text);
void on_location_editingFinished();
- void on_coordinates_textChanged(const QString &text);
void on_divemaster_textChanged();
void on_buddy_textChanged();
void on_suit_textChanged(const QString &text);
@@ -93,7 +92,6 @@ slots:
void escDetected(void);
void photoDoubleClicked(const QString filePath);
void removeSelectedPhotos();
- void updateGpsCoordinates();
void prepareDiveSiteEdit();
private:
Ui::MainTab ui;
diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui
index cdaab8386..659e790ef 100644
--- a/qt-ui/maintab.ui
+++ b/qt-ui/maintab.ui
@@ -22,7 +22,9 @@
<number>0</number>
</property>
<item row="2" column="1">
- <widget class="KMessageWidget" name="diveNotesMessage" native="true"/>
+ <widget class="KMessageWidget" name="diveNotesMessage" native="true">
+ <zorder>scrollArea</zorder>
+ </widget>
</item>
<item row="3" column="1">
<widget class="QScrollArea" name="scrollArea">
@@ -40,8 +42,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>443</width>
- <height>758</height>
+ <width>441</width>
+ <height>753</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -140,40 +142,6 @@
</layout>
</item>
<item>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="CoordinatedLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Coordinates</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="TypeLabel">
- <property name="text">
- <string>Dive mode</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLineEdit" name="coordinates">
- <property name="readOnly">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="DiveType"/>
- </item>
- </layout>
- </item>
- <item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="DivemasterLabel">
@@ -251,6 +219,7 @@
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
+ <zorder>tagWidget</zorder>
</widget>
</item>
<item row="1" column="1">
@@ -276,36 +245,50 @@
</layout>
</item>
<item>
- <widget class="QLabel" name="TagLabel">
- <property name="text">
- <string>Tags</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="TagWidget" name="tagWidget">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
- </property>
- <property name="lineWrapMode">
- <enum>QPlainTextEdit::NoWrap</enum>
- </property>
- </widget>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="1">
+ <widget class="QComboBox" name="DiveType"/>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="TagLabel">
+ <property name="text">
+ <string>Tags</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="TypeLabel">
+ <property name="text">
+ <string>Dive mode</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="TagWidget" name="tagWidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="verticalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="lineWrapMode">
+ <enum>QPlainTextEdit::NoWrap</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<widget class="QLabel" name="NotesLabel">
@@ -400,8 +383,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>443</width>
- <height>752</height>
+ <width>68</width>
+ <height>40</height>
</rect>
</property>
<layout class="QGridLayout" name="equipmentTabScrollAreaLayout">
@@ -456,8 +439,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>443</width>
- <height>752</height>
+ <width>441</width>
+ <height>363</height>
</rect>
</property>
<layout class="QGridLayout" name="diveInfoScrollAreaLayout">
@@ -773,8 +756,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>443</width>
- <height>752</height>
+ <width>446</width>
+ <height>215</height>
</rect>
</property>
<layout class="QGridLayout" name="statsScrollAreaLayout">
@@ -1036,7 +1019,6 @@
<tabstop>rating</tabstop>
<tabstop>visibility</tabstop>
<tabstop>suit</tabstop>
- <tabstop>tagWidget</tabstop>
<tabstop>notes</tabstop>
</tabstops>
<resources>
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 30ab5e5df..7776f312e 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -133,7 +133,10 @@ MainWindow::MainWindow() : QMainWindow(),
#ifdef NO_MARBLE
ui.menuView->removeAction(ui.actionViewGlobe);
#else
- connect(globe(), SIGNAL(coordinatesChanged()), information(), SLOT(updateGpsCoordinates()));
+ // FIXME
+ // TODO
+ // we need this on the dive sites
+ //connect(globe(), SIGNAL(coordinatesChanged()), information(), SLOT(updateGpsCoordinates()));
#endif
#ifdef NO_USERMANUAL
ui.menuHelp->removeAction(ui.actionUserManual);
diff --git a/qthelper.cpp b/qthelper.cpp
index acb1e103a..902dc5e6d 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -165,6 +165,7 @@ bool parseGpsText(const QString &gps_text, double *latitude, double *longitude)
pos == gps_text.size();
}
+#if 0 // we'll need something like this for the dive site management, eventually
bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out)
{
double latitude, longitude;
@@ -193,6 +194,7 @@ bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_te
dive->longitude.udeg = longudeg;
return true;
}
+#endif
QList<int> getDivesInTrip(dive_trip_t *trip)
{