Permalink
Browse files

select time page tweaks

  • Loading branch information...
1 parent 8040e84 commit 892474d888cd297cb3342f7a3ed966a7f9d74208 @gnuvince committed Apr 22, 2011
Showing with 28 additions and 4 deletions.
  1. +1 −1 Makefile
  2. +21 −2 pages/selecttimepage.cpp
  3. +5 −0 pages/selecttimepage.h
  4. +1 −1 qrc_icones.cpp
View
@@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: projet
-# Generated by qmake (2.01a) (Qt 4.7.2) on: Thu Apr 21 15:48:36 2011
+# Generated by qmake (2.01a) (Qt 4.7.2) on: Thu Apr 21 20:15:23 2011
# Project: projet.pro
# Template: app
# Command: /usr/bin/qmake -spec /usr/share/qt/mkspecs/linux-g++-64 QMLJSDEBUGGER_PATH=/usr/share/qtcreator/qml/qmljsdebugger -o Makefile projet.pro
@@ -4,6 +4,8 @@
#include "page.h"
#include "selecttimepage.h"
+#define TIME_FORMAT "dd MMM yyyy hh:mm"
+
SelectTimePage::SelectTimePage(QWidget *parent) :
Page(parent)
{
@@ -12,8 +14,20 @@ SelectTimePage::SelectTimePage(QWidget *parent) :
QHBoxLayout *startLayout = new QHBoxLayout(this);
QHBoxLayout *endLayout = new QHBoxLayout(this);
- QDateTimeEdit *startTime = new QDateTimeEdit(this);
- QDateTimeEdit *endTime = new QDateTimeEdit(this);
+ startTime = new QDateTimeEdit(this);
+ endTime = new QDateTimeEdit(this);
+
+ startTime->setDisplayFormat(QString(TIME_FORMAT));
+ endTime->setDisplayFormat(QString(TIME_FORMAT));
+
+ connect(startTime, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(setMinimalEndDateTime(QDateTime)));
+
+ QDateTime today;
+ today = QDateTime::currentDateTime();
+ QTime now = today.time();
+ now.setHMS(now.hour()+1, 0, 0);
+ today.setTime(now);
+ emit startTime->setDateTime(today);
startLayout->addWidget(new QLabel(trUtf8("Départ:"), this));
startLayout->addWidget(startTime);
@@ -42,3 +56,8 @@ SelectTimePage::SelectTimePage(QWidget *parent) :
connect(btnMenu, SIGNAL(clicked()), SIGNAL(Menu()));
connect(btnNext, SIGNAL(clicked()), SIGNAL(Next()));
}
+
+void SelectTimePage::setMinimalEndDateTime(QDateTime time) {
+ QDateTime fifteenMinutesPast = time.addSecs(15 * 60);
+ endTime->setMinimumDateTime(fifteenMinutesPast);
+}
@@ -14,6 +14,11 @@ class SelectTimePage : public Page
signals:
public slots:
+ void setMinimalEndDateTime(QDateTime time);
+
+private:
+ QDateTimeEdit *startTime;
+ QDateTimeEdit *endTime;
};
View
@@ -1,7 +1,7 @@
/****************************************************************************
** Resource object code
**
-** Created: Fri Apr 15 14:06:18 2011
+** Created: Thu Apr 21 20:15:49 2011
** by: The Resource Compiler for Qt version 4.7.2
**
** WARNING! All changes made in this file will be lost!

0 comments on commit 892474d

Please sign in to comment.