From 9dc32de878fa86c9aa575b5a4938b0e1bfdf57bf Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 1 Jun 2015 22:30:33 -0300 Subject: Remove Combobox from LocationManagement I tought about it a bit, and the combobox of the location management was a bit overkill - we already have another combobox to select the divesite and also the plus button to add one. If the user wanna edit the current divesite, he can go to menu and edit it. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/globe.h | 2 +- qt-ui/locationInformation.ui | 78 ++++++++++++++----------------------------- qt-ui/locationinformation.cpp | 17 ++++------ 3 files changed, 33 insertions(+), 64 deletions(-) (limited to 'qt-ui') 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 @@ Dive Site - - 12 - - - 0 - - - 0 - - - 0 - - - 2 - - - 5 - + + + - + - Current Location + Name - - + + + + + - Name + Coordinates - - + + - + Description - - + + - + + + + Notes + + + + Qt::Vertical @@ -75,32 +70,9 @@ - + - - - - Notes - - - - - - - - - - - - - Coordinates - - - - - - 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(); -- cgit v1.2.3-70-g09d2