summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-03-09 15:22:52 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-10 07:47:05 -0700
commit30c5a027caad423fdfba47912bc97ecdc091f3f1 (patch)
treee9373973144a18ec9dd3cd6e03411aeb1b7c15b7
parent6fbf5b33ccafd1c404162029ac60e8446c36a77e (diff)
downloadsubsurface-30c5a027caad423fdfba47912bc97ecdc091f3f1.tar.gz
Clone a bit of code to mark the Location Widget changed
This code is the same that is used on the MainTab, but since they are different objects, I can't just call it. so I'm duplicating them for the time being. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/simplewidgets.cpp18
-rw-r--r--qt-ui/simplewidgets.h4
2 files changed, 20 insertions, 2 deletions
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index 8a808d2a2..edee3ec49 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -667,7 +667,7 @@ void MultiFilter::closeFilter()
#include <QDebug>
#include <QShowEvent>
-LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent)
+LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBox(parent), modified(false)
{
ui.setupUi(this);
ui.diveSiteMessage->setText("You are editing the Dive Site");
@@ -755,3 +755,19 @@ void LocationInformationWidget::rejectChanges()
void LocationInformationWidget::showEvent(QShowEvent *ev) {
ui.diveSiteMessage->setCloseButtonVisible(false);
}
+
+void LocationInformationWidget::markChangedWidget(QWidget *w)
+{
+ QPalette p;
+ qreal h, s, l, a;
+ enableEdition();
+ qApp->palette().color(QPalette::Text).getHslF(&h, &s, &l, &a);
+ p.setBrush(QPalette::Base, (l <= 0.3) ? QColor(Qt::yellow).lighter() : (l <= 0.6) ? QColor(Qt::yellow).light() : /* else */ QColor(Qt::yellow).darker(300));
+ w->setPalette(p);
+ modified = true;
+}
+
+void LocationInformationWidget::enableEdition()
+{
+
+}
diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h
index d0cb60508..f9e4b466d 100644
--- a/qt-ui/simplewidgets.h
+++ b/qt-ui/simplewidgets.h
@@ -230,13 +230,15 @@ public slots:
void setLocationId(uint32_t uuid);
void updateGpsCoordinates(void);
-
+ void markChangedWidget(QWidget *w);
+ void enableEdition();
signals:
void informationManagementEnded();
private:
struct dive_site *currentDs;
Ui::LocationInformation ui;
+ bool modified;
};
bool isGnome3Session();