Skip to content

Commit

Permalink
select time page tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
gnuvince committed Apr 22, 2011
1 parent 8040e84 commit 892474d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
############################################################################# #############################################################################
# Makefile for building: projet # 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 # Project: projet.pro
# Template: app # 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 # Command: /usr/bin/qmake -spec /usr/share/qt/mkspecs/linux-g++-64 QMLJSDEBUGGER_PATH=/usr/share/qtcreator/qml/qmljsdebugger -o Makefile projet.pro
Expand Down
23 changes: 21 additions & 2 deletions pages/selecttimepage.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "page.h" #include "page.h"
#include "selecttimepage.h" #include "selecttimepage.h"


#define TIME_FORMAT "dd MMM yyyy hh:mm"

SelectTimePage::SelectTimePage(QWidget *parent) : SelectTimePage::SelectTimePage(QWidget *parent) :
Page(parent) Page(parent)
{ {
Expand All @@ -12,8 +14,20 @@ SelectTimePage::SelectTimePage(QWidget *parent) :
QHBoxLayout *startLayout = new QHBoxLayout(this); QHBoxLayout *startLayout = new QHBoxLayout(this);
QHBoxLayout *endLayout = new QHBoxLayout(this); QHBoxLayout *endLayout = new QHBoxLayout(this);


QDateTimeEdit *startTime = new QDateTimeEdit(this); startTime = new QDateTimeEdit(this);
QDateTimeEdit *endTime = 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(new QLabel(trUtf8("Départ:"), this));
startLayout->addWidget(startTime); startLayout->addWidget(startTime);
Expand Down Expand Up @@ -42,3 +56,8 @@ SelectTimePage::SelectTimePage(QWidget *parent) :
connect(btnMenu, SIGNAL(clicked()), SIGNAL(Menu())); connect(btnMenu, SIGNAL(clicked()), SIGNAL(Menu()));
connect(btnNext, SIGNAL(clicked()), SIGNAL(Next())); connect(btnNext, SIGNAL(clicked()), SIGNAL(Next()));
} }

void SelectTimePage::setMinimalEndDateTime(QDateTime time) {
QDateTime fifteenMinutesPast = time.addSecs(15 * 60);
endTime->setMinimumDateTime(fifteenMinutesPast);
}
5 changes: 5 additions & 0 deletions pages/selecttimepage.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class SelectTimePage : public Page
signals: signals:


public slots: public slots:
void setMinimalEndDateTime(QDateTime time);

private:
QDateTimeEdit *startTime;
QDateTimeEdit *endTime;


}; };


Expand Down
2 changes: 1 addition & 1 deletion qrc_icones.cpp
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** Resource object code ** 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 ** by: The Resource Compiler for Qt version 4.7.2
** **
** WARNING! All changes made in this file will be lost! ** WARNING! All changes made in this file will be lost!
Expand Down

0 comments on commit 892474d

Please sign in to comment.