diff --git a/Chronos.pro.user b/Chronos.pro.user index 278c4e0..b052a60 100644 --- a/Chronos.pro.user +++ b/Chronos.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/sources/mainwindow.cpp b/sources/mainwindow.cpp index cf25164..94db832 100644 --- a/sources/mainwindow.cpp +++ b/sources/mainwindow.cpp @@ -41,6 +41,9 @@ void MainWindow::init() { connect(ui->wed_button, &QPushButton::clicked, this, &MainWindow::edit); connect(ui->thu_button, &QPushButton::clicked, this, &MainWindow::edit); connect(ui->fri_button, &QPushButton::clicked, this, &MainWindow::edit); + + highlightDayOfWeek(); + if (QFile::exists(get_save_file_path())) { open_save(); } else { @@ -52,6 +55,33 @@ void MainWindow::init() { compute_time(); } +void MainWindow::highlightDayOfWeek() { + int dayOfWeek = QDate::currentDate().dayOfWeek(); + switch (dayOfWeek) { + case 1: { + ui->monLabel->setText(QString("> %1 <").arg(ui->monLabel->text())); + break; + } + case 2: { + ui->tueLabel->setText(QString("> %1 <").arg(ui->tueLabel->text())); + break; + } + case 3: { + ui->wedLabel->setText(QString("> %1 <").arg(ui->wedLabel->text())); + break; + } + case 4: { + ui->thuLabel->setText(QString("> %1 <").arg(ui->thuLabel->text())); + break; + } + case 5: { + ui->friLabel->setText(QString("> %1 <").arg(ui->friLabel->text())); + break; + } + default: break; + } +} + void MainWindow::set_date_to_now() { auto date = QDate::currentDate(); ui->dateEdit->setDate(date); @@ -131,6 +161,9 @@ void MainWindow::compute_time() { ui->thu_time_label->setText(Tools::double_to_string_time(current_week.getThu().get_total())); ui->fri_time_label->setText(Tools::double_to_string_time(current_week.getFri().get_total())); ui->total_time_label->setText(Tools::double_to_string_time(current_week.total())); + updateStartLabel(); + updateBreakLabel(); + updateEndLabel(); double late = 0.0; double overtime = 0.0; @@ -146,6 +179,30 @@ void MainWindow::compute_time() { ui->overtime_time_label->setText(Tools::double_to_string_time((overtime > 0.0) ? overtime : 0.0)); } +void MainWindow::updateStartLabel() { + ui->monStartLabel->setText(current_week.getMon().get_start().toString("HH:mm")); + ui->tueStartLabel->setText(current_week.getTue().get_start().toString("HH:mm")); + ui->wedStartLabel->setText(current_week.getWed().get_start().toString("HH:mm")); + ui->thuStartLabel->setText(current_week.getThu().get_start().toString("HH:mm")); + ui->friStartLabel->setText(current_week.getFri().get_start().toString("HH:mm")); +} + +void MainWindow::updateBreakLabel() { + ui->monBreakLabel->setText(QString("%1 min.").arg(current_week.getMon().get_time_break())); + ui->tueBreakLabel->setText(QString("%1 min.").arg(current_week.getTue().get_time_break())); + ui->wedBreakLabel->setText(QString("%1 min.").arg(current_week.getWed().get_time_break())); + ui->thuBreakLabel->setText(QString("%1 min.").arg(current_week.getThu().get_time_break())); + ui->friBreakLabel->setText(QString("%1 min.").arg(current_week.getFri().get_time_break())); +} + +void MainWindow::updateEndLabel() { + ui->monEndLabel->setText(current_week.getMon().get_end().toString("HH:mm")); + ui->tueEndLabel->setText(current_week.getTue().get_end().toString("HH:mm")); + ui->wedEndLabel->setText(current_week.getWed().get_end().toString("HH:mm")); + ui->thuEndLabel->setText(current_week.getThu().get_end().toString("HH:mm")); + ui->friEndLabel->setText(current_week.getFri().get_end().toString("HH:mm")); +} + void MainWindow::edit() { QString name = QObject::sender()->objectName(); switch (get_identifier(name)) { diff --git a/sources/mainwindow.h b/sources/mainwindow.h index 1a0efe9..4c64b3d 100644 --- a/sources/mainwindow.h +++ b/sources/mainwindow.h @@ -43,6 +43,13 @@ private: void init(); void open_save(); void save_to_file(); + + // UI Update + void updateStartLabel(); + void updateBreakLabel(); + void updateEndLabel(); + void highlightDayOfWeek(); + QString get_save_file_path(); Identifier get_identifier(QString objectName); Day modify_value(Day); diff --git a/ui/aboutbox.ui b/ui/aboutbox.ui index 15073ad..0dd8016 100644 --- a/ui/aboutbox.ui +++ b/ui/aboutbox.ui @@ -10,7 +10,7 @@ 0 0 707 - 363 + 381 @@ -22,7 +22,7 @@ 707 - 363 + 381 @@ -91,7 +91,7 @@ font-size: 12px; - Version: 1.0.0 (Beta 2) + Version: 1.0.0 (Beta 3) @@ -107,7 +107,7 @@ font-size: 12px; - Made with Qt 5.15.0 MinGW 64bit (C++17) + <html><head/><body><p>Made with Qt 5.15.0 MinGW 64bit (C++17) (<a href="https://github.com/alexlegarnd/Chronos"><span style=" text-decoration: underline; color:#0000ff;">Source Github</span></a>)</p></body></html> @@ -173,7 +173,23 @@ p, li { white-space: pre-wrap; } font-size: 12px; - Installer/Updater made with Delphi 10.3 Community + <html><head/><body><p>Installer made with Delphi 10.3 Community (<a href="https://github.com/alexlegarnd/chronos-installer"><span style=" text-decoration: underline; color:#0000ff;">Source Github</span></a>)</p></body></html> + + + + + + 30 + 310 + 541 + 21 + + + + font-size: 12px; + + + <html><head/><body><p>Installer Bootstrap made with Python 3 (<a href="https://github.com/alexlegarnd/chronos-installer-bootstrap"><span style=" text-decoration: underline; color:#0000ff;">Source Github</span></a>)</p></body></html> diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui index 14833d5..8e5342a 100644 --- a/ui/mainwindow.ui +++ b/ui/mainwindow.ui @@ -31,6 +31,12 @@ + + true + + + false + @@ -48,9 +54,9 @@ - 240 + 236 29 - 141 + 151 61 @@ -112,7 +118,7 @@ color: white; 40 29 - 141 + 161 61 @@ -253,7 +259,7 @@ color: white; 427 30 - 141 + 161 61 @@ -339,20 +345,17 @@ color: white; - 129 - 247 - 911 - 191 + 140 + 160 + 921 + 391 - - - 45 - - + + - + 0 @@ -391,6 +394,140 @@ color: white; + + + + Qt::Horizontal + + + + + + + + + + + font-size: 14px; + + + Arrivée + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + font-size: 14px; + + + Pause + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + font-size: 14px; + + + Départ + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + @@ -406,17 +543,17 @@ color: white; - + Qt::Vertical - + - + 0 @@ -455,6 +592,140 @@ color: white; + + + + Qt::Horizontal + + + + + + + + + + + font-size: 14px; + + + Arrivée + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + font-size: 14px; + + + Pause + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + font-size: 14px; + + + Départ + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + @@ -470,17 +741,17 @@ color: white; - + Qt::Vertical - + - + 0 @@ -519,6 +790,140 @@ color: white; + + + + Qt::Horizontal + + + + + + + + + + + font-size: 14px; + + + Arrivée + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + font-size: 14px; + + + Pause + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + font-size: 14px; + + + Départ + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + @@ -534,17 +939,17 @@ color: white; - + Qt::Vertical - + - + 0 @@ -583,6 +988,140 @@ color: white; + + + + Qt::Horizontal + + + + + + + + + + + font-size: 14px; + + + Arrivée + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + font-size: 14px; + + + Pause + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + font-size: 14px; + + + Départ + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + @@ -598,17 +1137,17 @@ color: white; - + Qt::Vertical - + - + 0 @@ -647,6 +1186,140 @@ color: white; + + + + Qt::Horizontal + + + + + + + + + + + font-size: 14px; + + + Arrivée + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + font-size: 14px; + + + Pause + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + font-size: 14px; + + + Départ + + + + + + + + 0 + 42 + + + + color: white; +font-size: 22px; + + + 00h00 + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + +