1 // akis.vasilias@vasilias-lights.gr
5 #include "myreportdialog.h"
7 Leleja::Leleja(QWidget
*parent
)
10 std::cout
<< "Leleja::Leleja()\n";
14 // Create the report dialog, although
15 // we keep it hidden for the time being.
16 myreportdialog
= new MyReportDialog(this);
17 myreportdialog
->setGeometry(200, 200, 200, 200);
18 myreportdialog
->setWindowTitle(tr("Report"));
21 dayinDateEdit
->setDate(QDate::currentDate());
22 leleDateEdit
->setDate(QDate::currentDate());
24 // Connect signals to slots
25 connect(exitButton
, SIGNAL(clicked()), this, SLOT(close()));
30 std::cout
<< "Leleja::~Leleja()\n";
32 delete myreportdialog
;
35 void Leleja::on_calcButton_clicked()
43 std::cout
<< "on_calcButton_clicked()\n";
46 dayinDate
= dayinDateEdit
->date();
47 leleDate
= leleDateEdit
->date();
50 daysOff
= daysoffLineEdit
->text().toInt();
51 totalDays
= dayinDate
.daysTo(leleDate
);
52 daysLeft
= QDate::currentDate().daysTo(leleDate
) - daysOff
;
55 std::cout
<< "Leleja::totalDays = " << totalDays
<< std::endl
;
56 std::cout
<< "Lelela::daysLeft = " << daysLeft
<< std::endl
;
57 std::cout
<< "Leleja::daysOff = " << daysOff
<< std::endl
;
59 // Validate user input
60 if (dayinDate
> QDate::currentDate()) {
61 QMessageBox::warning(this, tr("Leleja reloaded"),
62 tr("You haven't joined the army yet!\n"),
68 QMessageBox::warning(this, tr("Leleja reloaded"),
69 tr("You are a citizen!\n"),
74 // Pass parameters to report dialog
75 myreportdialog
->setDaysLeft(daysLeft
);
76 myreportdialog
->setDaysOff(daysOff
);
77 myreportdialog
->setDaysTotal(totalDays
);
80 if (!myreportdialog
->isVisible())
81 myreportdialog
->show();
83 emit myreportdialog
->redrawContent();
84 myreportdialog
->repaint();