mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Handle palette change for dive site selection
If you select a dive site with a different uuid than your current dive.dive_site_uuid, you should get a different pallete to state clearly that something changed. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7d863b5c28
commit
e4c0ee32cd
4 changed files with 24 additions and 3 deletions
|
@ -488,6 +488,7 @@ void DiveLocationLineEdit::itemActivated(const QModelIndex& index)
|
||||||
qDebug() << "Setting a Existing dive site";
|
qDebug() << "Setting a Existing dive site";
|
||||||
if(view->isVisible())
|
if(view->isVisible())
|
||||||
view->hide();
|
view->hide();
|
||||||
|
emit diveSiteSelected(currUuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveLocationLineEdit::refreshDiveSiteCache()
|
void DiveLocationLineEdit::refreshDiveSiteCache()
|
||||||
|
@ -580,11 +581,21 @@ void DiveLocationLineEdit::showPopup()
|
||||||
if (!view->isVisible()) {
|
if (!view->isVisible()) {
|
||||||
setTemporaryDiveSiteName(text());
|
setTemporaryDiveSiteName(text());
|
||||||
proxy->invalidate();
|
proxy->invalidate();
|
||||||
view->setCurrentIndex( view->model()->index(0,1));
|
view->setCurrentIndex(view->model()->index(0,1));
|
||||||
view->show();
|
view->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DiveLocationLineEdit::DiveSiteType DiveLocationLineEdit::currDiveSiteType() const
|
||||||
|
{
|
||||||
|
return currType;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t DiveLocationLineEdit::currDiveSiteUuid() const
|
||||||
|
{
|
||||||
|
return currUuid;
|
||||||
|
}
|
||||||
|
|
||||||
DiveLocationListView::DiveLocationListView(QWidget *parent)
|
DiveLocationListView::DiveLocationListView(QWidget *parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,9 @@ public:
|
||||||
DiveSiteType currDiveSiteType() const;
|
DiveSiteType currDiveSiteType() const;
|
||||||
uint32_t currDiveSiteUuid() const;
|
uint32_t currDiveSiteUuid() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void diveSiteSelected(uint32_t uuid);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent *ev);
|
void keyPressEvent(QKeyEvent *ev);
|
||||||
void focusOutEvent(QFocusEvent *ev);
|
void focusOutEvent(QFocusEvent *ev);
|
||||||
|
|
|
@ -1509,7 +1509,7 @@ void MainTab::on_location_textChanged()
|
||||||
markChangedWidget(ui.location);
|
markChangedWidget(ui.location);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTab::on_location_editingFinished()
|
void MainTab::on_location_diveSiteSelected()
|
||||||
{
|
{
|
||||||
if (editMode == IGNORE || acceptingEdit == true)
|
if (editMode == IGNORE || acceptingEdit == true)
|
||||||
return;
|
return;
|
||||||
|
@ -1519,6 +1519,13 @@ void MainTab::on_location_editingFinished()
|
||||||
markChangedWidget(ui.location);
|
markChangedWidget(ui.location);
|
||||||
emit diveSiteChanged(0);
|
emit diveSiteChanged(0);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
if (ui.location->currDiveSiteUuid() != displayed_dive.dive_site_uuid) {
|
||||||
|
markChangedWidget(ui.location);
|
||||||
|
} else {
|
||||||
|
QPalette p;
|
||||||
|
ui.location->setPalette(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTrip) {
|
if (currentTrip) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ slots:
|
||||||
void updateDiveInfo(bool clear = false);
|
void updateDiveInfo(bool clear = false);
|
||||||
void acceptChanges();
|
void acceptChanges();
|
||||||
void rejectChanges();
|
void rejectChanges();
|
||||||
void on_location_editingFinished();
|
void on_location_diveSiteSelected();
|
||||||
void on_location_textChanged();
|
void on_location_textChanged();
|
||||||
void on_divemaster_textChanged();
|
void on_divemaster_textChanged();
|
||||||
void on_buddy_textChanged();
|
void on_buddy_textChanged();
|
||||||
|
|
Loading…
Add table
Reference in a new issue