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>
This commit is contained in:
Tomaz Canabrava 2014-06-26 14:54:16 -03:00 committed by Dirk Hohndel
parent 7c037c8d05
commit 1e2349e794
2 changed files with 14 additions and 1 deletions

View file

@ -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];

View file

@ -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();