From 9510f40db42c60d34577f79180d929a88d261781 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 14 Jul 2015 14:29:48 -0300 Subject: Remove quick edit dive site widget Voted down by common consent. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/locationinformation.cpp | 98 ------------------------------------------- qt-ui/locationinformation.h | 21 ---------- qt-ui/maintab.cpp | 14 ------- qt-ui/maintab.h | 1 - qt-ui/maintab.ui | 27 ++++-------- qt-ui/simpledivesiteedit.ui | 68 ------------------------------ 6 files changed, 8 insertions(+), 221 deletions(-) delete mode 100644 qt-ui/simpledivesiteedit.ui 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(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 @@ 0 0 449 - 751 + 758 @@ -167,15 +167,15 @@ + + 0 + 5 5 - - 0 - @@ -208,17 +208,6 @@ - - - - ... - - - - :/edit:/edit - - - @@ -658,8 +647,8 @@ 0 0 - 286 - 300 + 317 + 365 @@ -999,8 +988,8 @@ 0 0 - 297 - 177 + 331 + 220 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 @@ - - - SimpleDiveSiteEditDialog - - - - 0 - 0 - 449 - 338 - - - - Dialog - - - - - - Name - - - - - - - - - - Coordinates - - - - - - - - - - Description - - - - - - - - - - - - - Notes - - - - - - - Dive site quick edit. Hit ESC or click outside to close - - - - - - - - -- cgit v1.2.3-70-g09d2