X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=badgewindow.cpp;h=395d1d07d12fe659edb645a98fe1dda065a72c7c;hb=d62f2ad6c451eedf03a2f9f71ab1f9dccf7ee79a;hp=c809c27ec650baca0b889b9a31f2a6b0b34ebdd0;hpb=8fd98e81a2084c15c2c6b40d8b9a6cea18d67eca;p=badge diff --git a/badgewindow.cpp b/badgewindow.cpp index c809c27..395d1d0 100644 --- a/badgewindow.cpp +++ b/badgewindow.cpp @@ -1,13 +1,88 @@ #include "badgewindow.h" #include "ui_badgewindow.h" +#include "dialogday.h" +#include +#include "badgedata.h" +#include "dialogsearch.h" +#include +#include + BadgeWindow::BadgeWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::BadgeWindow) { ui->setupUi(this); + setAttribute(Qt::WA_Maemo5StackedWindow); ui->menuBar->addAction(ui->actionSearch); ui->menuBar->addAction(ui->actionInfo); +#ifndef Q_WS_MAEMO_5 ui->menuBar->addAction(ui->actionClose); +#endif + connect(ui->actionSearch, SIGNAL(triggered()), this, SLOT(search())); + connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(close())); + connect(ui->actionInfo, SIGNAL(triggered()), this, SLOT(info())); + + + showMaximized(); +} + + + +void BadgeWindow::selectedDay(QDate date) +{ + DialogDay day; + BadgeData data; + + TimeTable tt; + tt.day = date; + if (data.getTimetable(tt) == false) { + tt.entrance = QTime::currentTime(); + tt.exit = QTime::currentTime(); + tt.firstPause = QTime::currentTime(); + tt.endFirstPause = QTime::currentTime(); + tt.secondPause = QTime::currentTime(); + tt.endSecondPause = QTime::currentTime(); + } + + tt = day.getTimes(tt); + if (tt.wrong() != TimeTable::WRONG) { + BadgeData data; + data.setTimetable(tt); + } + +} + +void BadgeWindow::search() +{ + DialogSearch searchDialog; + QTime total; + QString message; + QString hours; + QString minutes; + bool ok; + + total = searchDialog.totalHours(ok); + if (ok) { + hours.setNum(total.hour()); + minutes.setNum(total.minute()); + message = "Total time is: " + hours + " hours and " + minutes + " minutes"; + QMessageBox::information(this, tr("Badge"), tr(message.toLatin1())); + } + +} + +void BadgeWindow::info() +{ + QMessageBox::aboutQt(this); + QMaemo5InformationBox::information(this, tr("(c) 2009 Nicola De Filippo - nicola@nicoladefilippo.it\n" + "This program is licensed to you under terms of the GNU General Public\n" + "License Version 2 as published by Free Software Foundation. This gives\n" + "you legal permission to copy, distribute and/or modify this software under\n" + "certain conditions. For details, see the file 'COPYING' that came with this\n" + "software distribution. If you did not get the file, send email to author.\n\n" + "The program is provided AS IS with No WARRANTY OF ANY KIND,\n" + "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND\n" + "FITNESS FOR PARTICULAR PURPOSE")); } BadgeWindow::~BadgeWindow()