diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-07-14 14:29:48 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-14 14:44:39 -0700 |
commit | 9510f40db42c60d34577f79180d929a88d261781 (patch) | |
tree | d45319b09a1999428a0a736f3d73fb8c44fae318 /qt-ui | |
parent | 49ab30ae8b65c3ad443a5824ae5f9554e88c7a39 (diff) | |
download | subsurface-9510f40db42c60d34577f79180d929a88d261781.tar.gz |
Remove quick edit dive site widget
Voted down by common consent.
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/locationinformation.cpp | 98 | ||||
-rw-r--r-- | qt-ui/locationinformation.h | 21 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 14 | ||||
-rw-r--r-- | qt-ui/maintab.h | 1 | ||||
-rw-r--r-- | qt-ui/maintab.ui | 27 | ||||
-rw-r--r-- | qt-ui/simpledivesiteedit.ui | 68 |
6 files changed, 8 insertions, 221 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index b9d985bd7..47ceb654e 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -227,104 +227,6 @@ void LocationInformationWidget::resetPallete() ui.diveSiteNotes->setPalette(p); } -SimpleDiveSiteEditDialog::SimpleDiveSiteEditDialog(QWidget *parent) : - QDialog(parent, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::Popup), - ui(new Ui::SimpleDiveSiteEditDialog()), changed_dive_site(false) -{ - ui->setupUi(this); - ui->diveSiteDescription->installEventFilter(this); - ui->diveSiteNotes->installEventFilter(this); -} - -SimpleDiveSiteEditDialog::~SimpleDiveSiteEditDialog() -{ - delete ui; -} - -bool SimpleDiveSiteEditDialog::eventFilter(QObject *obj, QEvent *ev) -{ - if (ev->type() != QEvent::FocusOut) - return false; - - if (obj == ui->diveSiteDescription) { - diveSiteDescription_editingFinished(); - } else if (obj == ui->diveSiteNotes) { - diveSiteNotes_editingFinished(); - } - return false; -} - -void SimpleDiveSiteEditDialog::showEvent(QShowEvent *ev) -{ - const int heigth = 275; - const int width = 450; - - // Position. - QDialog::showEvent(ev); - QRect currGeometry = geometry(); - currGeometry.setX(QCursor::pos().x() + 15); - currGeometry.setY(QCursor::pos().y() - heigth / 2); - currGeometry.setWidth(width); - currGeometry.setHeight(heigth); - setGeometry(currGeometry); - ev->accept(); - - //Da - ui->diveSiteName->setText(displayed_dive_site.name); - ui->diveSiteNotes->setPlainText(displayed_dive_site.notes); - ui->diveSiteDescription->setPlainText(displayed_dive_site.description); - - const char *gps_text = printGPSCoords(displayed_dive_site.latitude.udeg, displayed_dive_site.longitude.udeg); - ui->diveSiteCoordinates->setText(QString(gps_text)); - free( (void*) gps_text); - - changed_dive_site = false; -} - -void SimpleDiveSiteEditDialog::on_diveSiteName_editingFinished() -{ - if (ui->diveSiteName->text() == displayed_dive_site.name) - return; - free(displayed_dive_site.name); - displayed_dive_site.name = copy_string(qPrintable(ui->diveSiteName->text())); - changed_dive_site = true; -} - -void SimpleDiveSiteEditDialog::on_diveSiteCoordinates_editingFinished() -{ - double lat, lon; - uint32_t uLat, uLon; - - parseGpsText(ui->diveSiteCoordinates->text(), &lat, &lon); - uLat = lat * 1000000; - uLon = lon * 1000000; - - if (uLat == displayed_dive_site.latitude.udeg && uLon == displayed_dive_site.longitude.udeg) - return; - - displayed_dive_site.latitude.udeg = uLat; - displayed_dive_site.longitude.udeg = uLon; - changed_dive_site = true; -} - -void SimpleDiveSiteEditDialog::diveSiteDescription_editingFinished() -{ - if (ui->diveSiteDescription->toPlainText() == displayed_dive_site.description) - return; - free(displayed_dive_site.description); - displayed_dive_site.description = copy_string(qPrintable(ui->diveSiteDescription->toPlainText())); - changed_dive_site = true; -} - -void SimpleDiveSiteEditDialog::diveSiteNotes_editingFinished() -{ - if (ui->diveSiteNotes->toPlainText() == displayed_dive_site.notes) - return; - free(displayed_dive_site.notes); - displayed_dive_site.notes = copy_string(qPrintable(ui->diveSiteNotes->toPlainText())); - changed_dive_site = true; -} - bool LocationManagementEditHelper::eventFilter(QObject *obj, QEvent *ev) { QListView *view = qobject_cast<QListView*>(obj); diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h index b1746f79e..b37731969 100644 --- a/qt-ui/locationinformation.h +++ b/qt-ui/locationinformation.h @@ -44,27 +44,6 @@ private: mode current_mode; }; - -#include "ui_simpledivesiteedit.h" -class SimpleDiveSiteEditDialog : public QDialog { -Q_OBJECT -public: - SimpleDiveSiteEditDialog(QWidget *parent); - virtual ~SimpleDiveSiteEditDialog(); - bool changed_dive_site; - bool eventFilter(QObject *obj, QEvent *ev); -public slots: - void on_diveSiteName_editingFinished(); - void on_diveSiteCoordinates_editingFinished(); - void diveSiteDescription_editingFinished(); - void diveSiteNotes_editingFinished(); -protected: - void showEvent(QShowEvent *ev); -private: - Ui::SimpleDiveSiteEditDialog *ui; - -}; - class LocationManagementEditHelper : public QObject { Q_OBJECT public: diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 2efaa520c..abb6af9bd 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -74,7 +74,6 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent), locationManagementEditHelper, &LocationManagementEditHelper::handleActivation); ui.location->setCompleter(completer); - connect(ui.addDiveSite, SIGNAL(clicked()), this, SLOT(showDiveSiteSimpleEdit())); connect(ui.geocodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode())); QAction *action = new QAction(tr("Apply changes"), this); @@ -250,27 +249,14 @@ void MainTab::setCurrentLocationIndex() } } -void MainTab::showDiveSiteSimpleEdit() -{ - if (ui.location->text().isEmpty()) - return; - SimpleDiveSiteEditDialog dlg(this); - dlg.exec(); - if (dlg.changed_dive_site) { - markChangedWidget(ui.location); - } -} - void MainTab::enableGeoLookupEdition() { ui.waitingSpinner->stop(); - ui.addDiveSite->show(); } void MainTab::disableGeoLookupEdition() { ui.waitingSpinner->start(); - ui.addDiveSite->hide(); } void MainTab::toggleTriggeredColumn() diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index 1e3f95033..bcfb3340e 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -98,7 +98,6 @@ slots: void enableGeoLookupEdition(); void disableGeoLookupEdition(); void setCurrentLocationIndex(); - void showDiveSiteSimpleEdit(); void reverseGeocode(); private: Ui::MainTab ui; diff --git a/qt-ui/maintab.ui b/qt-ui/maintab.ui index 3318bf788..c83d12ec3 100644 --- a/qt-ui/maintab.ui +++ b/qt-ui/maintab.ui @@ -56,7 +56,7 @@ <x>0</x> <y>0</y> <width>449</width> - <height>751</height> + <height>758</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -167,15 +167,15 @@ </item> <item> <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> <property name="leftMargin"> <number>5</number> </property> <property name="rightMargin"> <number>5</number> </property> - <property name="spacing"> - <number>0</number> - </property> <item> <layout class="QHBoxLayout" name="LocationLayout" stretch="0,1"> <item> @@ -209,17 +209,6 @@ <widget class="QLineEdit" name="location"/> </item> <item> - <widget class="QToolButton" name="addDiveSite"> - <property name="text"> - <string>...</string> - </property> - <property name="icon"> - <iconset resource="../subsurface.qrc"> - <normaloff>:/edit</normaloff>:/edit</iconset> - </property> - </widget> - </item> - <item> <widget class="QToolButton" name="geocodeButton"> <property name="text"> <string>...</string> @@ -658,8 +647,8 @@ <rect> <x>0</x> <y>0</y> - <width>286</width> - <height>300</height> + <width>317</width> + <height>365</height> </rect> </property> <layout class="QGridLayout" name="diveInfoScrollAreaLayout"> @@ -999,8 +988,8 @@ <rect> <x>0</x> <y>0</y> - <width>297</width> - <height>177</height> + <width>331</width> + <height>220</height> </rect> </property> <layout class="QHBoxLayout" name="horizontalLayout"> diff --git a/qt-ui/simpledivesiteedit.ui b/qt-ui/simpledivesiteedit.ui deleted file mode 100644 index 7153023da..000000000 --- a/qt-ui/simpledivesiteedit.ui +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>SimpleDiveSiteEditDialog</class> - <widget class="QDialog" name="SimpleDiveSiteEditDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>449</width> - <height>338</height> - </rect> - </property> - <property name="windowTitle"> - <string>Dialog</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Name</string> - </property> - </widget> - </item> - <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>Coordinates</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="diveSiteCoordinates"/> - </item> - <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="QPlainTextEdit" name="diveSiteNotes"/> - </item> - <item row="3" column="1"> - <widget class="QPlainTextEdit" name="diveSiteDescription"/> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Notes</string> - </property> - </widget> - </item> - <item row="0" column="0" colspan="2"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Dive site quick edit. Hit ESC or click outside to close</string> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> |