aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-26 14:54:16 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-26 15:48:33 -0700
commit1e2349e7945b0f56fef503179dd0550db0137495 (patch)
tree7194004c83195ace443eabed66c4eb34fe7ed292 /qt-ui
parent7c037c8d0550665f6b7718d13c4a2a091b5f814b (diff)
downloadsubsurface-1e2349e7945b0f56fef503179dd0550db0137495.tar.gz
Added code for TimeEdit
This makes the TimeEdit work again. 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/maintab.cpp14
-rw-r--r--qt-ui/maintab.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index c64ef5b14..15759d7ec 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -75,6 +75,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui.airtemp->installEventFilter(this);
ui.watertemp->installEventFilter(this);
ui.dateEdit->installEventFilter(this);
+ ui.timeEdit->installEventFilter(this);
ui.tagWidget->installEventFilter(this);
QList<QObject *> statisticsTabWidgets = ui.statisticsTab->children();
@@ -391,7 +392,7 @@ void MainTab::updateDiveInfo(int dive)
if (d) {
updateGpsCoordinates(d);
ui.dateEdit->setDate(QDateTime::fromTime_t(d->when).date());
- //TODO: set also the time when the widget is ready.
+ ui.timeEdit->setTime(QDateTime::fromTime_t(d->when).time());
if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) {
setTabText(0, tr("Trip Notes"));
// only use trip relevant fields
@@ -789,6 +790,7 @@ void MainTab::resetPallete()
ui.airtemp->setPalette(p);
ui.watertemp->setPalette(p);
ui.dateEdit->setPalette(p);
+ ui.timeEdit->setPalette(p);
ui.tagWidget->setPalette(p);
}
@@ -956,6 +958,16 @@ void MainTab::on_dateEdit_dateChanged(const QDateTime &datetime)
markChangedWidget(ui.dateEdit);
}
+void MainTab::on_timeEdit_timeChanged(const QTime &time)
+{
+ if (editMode == NONE)
+ return;
+ QDateTime dateTime = QDateTime::fromTime_t(editedDive.when);
+ dateTime.setTime(time);
+ editedDive.when = dateTime.toTime_t();
+ markChangedWidget(ui.timeEdit);
+}
+
bool MainTab::tagsChanged(dive *a, dive *b)
{
char bufA[1024], bufB[1024];
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index e296f1470..1e7b5d3a3 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -69,6 +69,7 @@ slots:
void on_watertemp_textChanged(const QString &text);
void validate_temp_field(QLineEdit *tempField, const QString &text);
void on_dateEdit_dateChanged(const QDateTime &datetime);
+ void on_timeEdit_timeChanged(const QTime & time);
void on_rating_valueChanged(int value);
void on_visibility_valueChanged(int value);
void on_tagWidget_textChanged();