From 3d68e5638fd5f84e34dfa937657c43c2ea000520 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Thu, 1 Oct 2015 17:41:38 -0300 Subject: [PATCH 1/4] Add a new QLineEdit to set the Dive Trip Location
This is different from a Dive Site, as it's not a dive site. It's just a normal string currently, while a dive site has gps coordinates. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/maintab.cpp | 6 ++ qt-ui/maintab.ui | 161 +++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 142 insertions(+), 25 deletions(-) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index a192385..df813bc 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -541,6 +541,9 @@ void MainTab::updateDiveInfo(bool clear) ui.TypeLabel->setVisible(false); ui.waterTempLabel->setVisible(false); ui.watertemp->setVisible(false); + ui.diveTripLocation->show(); + ui.location->hide(); + ui.editDiveSiteButton->hide(); // rename the remaining fields and fill data from selected trip ui.LocationLabel->setText(tr("Trip location")); ui.locationTags->clear(); @@ -554,6 +557,9 @@ void MainTab::updateDiveInfo(bool clear) setTabText(0, tr("Notes")); currentTrip = NULL; // make all the fields visible writeable + ui.diveTripLocation->hide(); + ui.location->show(); + ui.editDiveSiteButton->show(); ui.divemaster->setVisible(true); ui.buddy->setVisible(true); ui.suit->setVisible(true); diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui index 28c9645..2c515a2 100644 --- a/qt-ui/maintab.ui +++ b/qt-ui/maintab.ui @@ -21,14 +21,23 @@ <string>General notes about the current selection</string> </attribute> <layout class="QGridLayout" name="diveNotesLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>5</number> + </property> + <property name="topMargin"> + <number>5</number> + </property> + <property name="rightMargin"> + <number>5</number> + </property> + <property name="bottomMargin"> <number>5</number> </property> <property name="spacing"> <number>0</number> </property> <item row="2" column="1"> - <widget class="KMessageWidget" name="diveNotesMessage" native="true"/> + <widget class="KMessageWidget" name="diveNotesMessage"/> </item> <item row="3" column="1"> <widget class="QScrollArea" name="scrollArea"> @@ -46,12 +55,21 @@ <rect> <x>0</x> <y>0</y> - <width>449</width> - <height>772</height> + <width>445</width> + <height>726</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -209,6 +227,9 @@ </item> </layout> </item> + <item> + <widget class="QLineEdit" name="diveTripLocation"/> + </item> </layout> </item> <item> @@ -440,7 +461,16 @@ <property name="spacing"> <number>0</number> </property> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> </layout> @@ -464,11 +494,20 @@ <string>Used equipment in the current selection</string> </attribute> <layout class="QGridLayout" name="equiptmentTabLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>5</number> + </property> + <property name="topMargin"> + <number>5</number> + </property> + <property name="rightMargin"> + <number>5</number> + </property> + <property name="bottomMargin"> <number>5</number> </property> <item row="0" column="0"> - <widget class="KMessageWidget" name="diveEquipmentMessage" native="true"/> + <widget class="KMessageWidget" name="diveEquipmentMessage"/> </item> <item row="1" column="0"> <widget class="QScrollArea" name="scrollArea_2"> @@ -486,12 +525,21 @@ <rect> <x>0</x> <y>0</y> - <width>100</width> - <height>30</height> + <width>70</width> + <height>16</height> </rect> </property> <layout class="QGridLayout" name="equipmentTabScrollAreaLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>0</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="spacing"> @@ -503,7 +551,16 @@ <property name="spacing"> <number>0</number> </property> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -532,11 +589,20 @@ <string>Dive information</string> </attribute> <layout class="QGridLayout" name="diveInfoLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>5</number> + </property> + <property name="topMargin"> + <number>5</number> + </property> + <property name="rightMargin"> + <number>5</number> + </property> + <property name="bottomMargin"> <number>5</number> </property> <item row="0" column="0"> - <widget class="KMessageWidget" name="diveInfoMessage" native="true"/> + <widget class="KMessageWidget" name="diveInfoMessage"/> </item> <item row="1" column="0"> <widget class="QScrollArea" name="scrollArea_3"> @@ -554,12 +620,21 @@ <rect> <x>0</x> <y>0</y> - <width>211</width> - <height>250</height> + <width>287</width> + <height>320</height> </rect> </property> <layout class="QGridLayout" name="diveInfoScrollAreaLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>0</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="spacing"> @@ -858,7 +933,16 @@ <string>Simple statistics about the selection</string> </attribute> <layout class="QGridLayout" name="statsLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>5</number> + </property> + <property name="topMargin"> + <number>5</number> + </property> + <property name="rightMargin"> + <number>5</number> + </property> + <property name="bottomMargin"> <number>5</number> </property> <item row="1" column="1"> @@ -877,12 +961,21 @@ <rect> <x>0</x> <y>0</y> - <width>225</width> - <height>166</height> + <width>297</width> + <height>187</height> </rect> </property> <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -1046,7 +1139,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="KMessageWidget" name="diveStatisticsMessage" native="true"/> + <widget class="KMessageWidget" name="diveStatisticsMessage"/> </item> </layout> </widget> @@ -1058,7 +1151,16 @@ <string>All photos from the current selection</string> </attribute> <layout class="QVBoxLayout" name="photosLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>5</number> + </property> + <property name="topMargin"> + <number>5</number> + </property> + <property name="rightMargin"> + <number>5</number> + </property> + <property name="bottomMargin"> <number>5</number> </property> <item> @@ -1081,7 +1183,16 @@ <property name="spacing"> <number>0</number> </property> - <property name="margin"> + <property name="leftMargin"> + <number>5</number> + </property> + <property name="topMargin"> + <number>5</number> + </property> + <property name="rightMargin"> + <number>5</number> + </property> + <property name="bottomMargin"> <number>5</number> </property> <item> @@ -1093,7 +1204,7 @@ <customwidgets> <customwidget> <class>KMessageWidget</class> - <extends>QWidget</extends> + <extends>QFrame</extends> <header>kmessagewidget.h</header> <container>1</container> </customwidget> -- 2.6.0
From b6a737aad46676e070fc484d4f591070ab7c3163 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Thu, 1 Oct 2015 17:52:00 -0300 Subject: [PATCH 2/4] Update the Dive Site Location when editing Simple. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/maintab.cpp | 12 +++++++----- qt-ui/maintab.h | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index df813bc..70a5bad 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1502,14 +1502,16 @@ void MainTab::on_location_diveSiteSelected() } } + updateDisplayedDiveSite(); +} + +void MainTab::on_diveTripLocation_textChanged(const QString& text) +{ if (currentTrip) { free(displayedTrip.location); - displayedTrip.location = strdup(qPrintable(ui.location->text())); - markChangedWidget(ui.location); - return; + displayedTrip.location = strdup(qPrintable(text)); + markChangedWidget(ui.diveTripLocation); } - - updateDisplayedDiveSite(); } void MainTab::on_suit_textChanged(const QString &text) diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index 1fffc21..b4bd338 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -72,6 +72,7 @@ slots: void on_divemaster_textChanged(); void on_buddy_textChanged(); void on_suit_textChanged(const QString &text); + void on_diveTripLocation_textChanged(const QString& text); void on_notes_textChanged(); void on_airtemp_textChanged(const QString &text); void divetype_Changed(int); -- 2.6.0
From 2ba13c5870b568d62a6d0d63d94f4e8273353887 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Thu, 1 Oct 2015 17:54:13 -0300 Subject: [PATCH 3/4] Hide trip location when launching subsurface it was ugly to show trip and dive location when no dive was selected. Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/maintab.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 70a5bad..33c5055 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -202,6 +202,8 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), ui.location, &DiveLocationLineEdit::fixPopupPosition); acceptingEdit = false; + + ui.diveTripLocation->hide(); } MainTab::~MainTab() -- 2.6.0
From afa33c00348eca3bc9d0326004974921c4ec9179 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Thu, 1 Oct 2015 18:11:03 -0300 Subject: [PATCH 4/4] Make Dive Trip Location Edit work again. :D Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/maintab.cpp | 4 +++- qt-ui/maintab.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 33c5055..8ec339e 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -548,6 +548,7 @@ void MainTab::updateDiveInfo(bool clear) ui.editDiveSiteButton->hide(); // rename the remaining fields and fill data from selected trip ui.LocationLabel->setText(tr("Trip location")); + ui.diveTripLocation->setText(currentTrip->location); ui.locationTags->clear(); //TODO: Fix this. //ui.location->setText(currentTrip->location); @@ -1154,6 +1155,7 @@ void MainTab::resetPallete() ui.dateEdit->setPalette(p); ui.timeEdit->setPalette(p); ui.tagWidget->setPalette(p); + ui.diveTripLocation->setPalette(p); } #define EDIT_TEXT2(what, text) \ @@ -1507,7 +1509,7 @@ void MainTab::on_location_diveSiteSelected() updateDisplayedDiveSite(); } -void MainTab::on_diveTripLocation_textChanged(const QString& text) +void MainTab::on_diveTripLocation_textEdited(const QString& text) { if (currentTrip) { free(displayedTrip.location); diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index b4bd338..9cd1403 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -72,7 +72,7 @@ slots: void on_divemaster_textChanged(); void on_buddy_textChanged(); void on_suit_textChanged(const QString &text); - void on_diveTripLocation_textChanged(const QString& text); + void on_diveTripLocation_textEdited(const QString& text); void on_notes_textChanged(); void on_airtemp_textChanged(const QString &text); void divetype_Changed(int); -- 2.6.0
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
