added write beta
authorNicola De Filippo <nicola@nicoladefilippo.it>
Tue, 1 Dec 2009 14:39:51 +0000 (15:39 +0100)
committerNicola De Filippo <nicola@nicoladefilippo.it>
Tue, 1 Dec 2009 14:39:51 +0000 (15:39 +0100)
dialogday.cpp

index 52a6435..cfeadea 100644 (file)
@@ -1,5 +1,6 @@
 #include "dialogday.h"
 #include "ui_dialogday.h"
+#include <QDebug>
 
 DialogDay::DialogDay(QWidget *parent) :
     QDialog(parent),
@@ -40,10 +41,40 @@ void DialogDay::enableSecond(bool enable)
 
 TimeTable DialogDay::getTimes(TimeTable timetable)
 {
-    DialogDay day;
-    if (day.exec() == QDialog::Accepted) {
+
+    m_ui->timeEditEntrance->setTime(timetable.entrance);
+    m_ui->timeEditExit->setTime(timetable.exit);
+    m_ui->checkBoxFirst->setChecked(false);
+    m_ui->checkBoxSecond->setChecked(false);
+
+    if (timetable.firstPause != timetable.endFirstPause) {
+        m_ui->checkBoxFirst->setChecked(true);
+        m_ui->timeEditFBegin->setTime(timetable.firstPause);
+        m_ui->timeEditEndF->setTime(timetable.endFirstPause);
+    }
+    if (timetable.secondPause != timetable.endSecondPause) {
+        m_ui->checkBoxSecond->setChecked(true);
+        m_ui->timeEditSBegin->setTime(timetable.secondPause);
+        m_ui->timeEditEndS->setTime(timetable.endSecondPause);
+    }
+
+
+    if (this->exec() == QDialog::Accepted) {
+
+            timetable.entrance = m_ui->timeEditEntrance->time();
+            timetable.exit = m_ui->timeEditExit->time();
+        if (m_ui->checkBoxFirst->isChecked()) {
+            timetable.firstPause = m_ui->timeEditFBegin->time();
+            timetable.endFirstPause = m_ui->timeEditEndF->time();
+        }
+        if (m_ui->checkBoxSecond->isChecked()) {
+            timetable.secondPause = m_ui->timeEditSBegin->time();
+            timetable.endSecondPause = m_ui->timeEditEndS->time();
+        }
         return timetable;
     }
     timetable.setWrong(true);
     return timetable;
 }
+
+