Compare commits
3 Commits
v1.0.0-bet
...
v1.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
257bc67f61 | ||
|
|
ff64fa14d3 | ||
|
|
63bd4b15f4 |
@@ -7,10 +7,10 @@ CONFIG += c++17
|
||||
# remove possible other optimization flags
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O1
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O2
|
||||
QMAKE_CXXFLAGS_RELEASE *= -O2
|
||||
|
||||
# add the desired -O3 if not present
|
||||
QMAKE_CXXFLAGS_RELEASE *= -O3
|
||||
# add the desired -O3 if not present, MinGW only
|
||||
# QMAKE_CXXFLAGS_RELEASE *= -O3
|
||||
|
||||
RC_ICONS = icon.ico
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.12.4, 2020-08-02T22:16:12. -->
|
||||
<!-- Written by QtCreator 4.12.4, 2020-08-28T14:45:30. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
@@ -74,17 +74,17 @@
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.0 MinGW 64-bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.0 MinGW 64-bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5150.win64_mingw81_kit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.0 MSVC2019 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.0 MSVC2019 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5150.win64_msvc2019_64_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="bool">true</value>
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
@@ -134,8 +134,8 @@
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="bool">true</value>
|
||||
<value type="int" key="EnableQmlDebugging">2</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
@@ -185,8 +185,8 @@
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="bool">true</value>
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\robof\OneDrive\Documents\build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Profile</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
@@ -320,7 +320,7 @@
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MinGW_64_bit-Release</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/robof/OneDrive/Documents/build-Chronos-Desktop_Qt_5_15_0_MSVC2019_64bit-Release</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
|
||||
@@ -6,9 +6,31 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->window_title->setText(this->windowTitle());
|
||||
this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
init();
|
||||
}
|
||||
|
||||
void MainWindow::mousePressEvent(QMouseEvent *event) {
|
||||
m_nMouseClick_X_Coordinate = event->x();
|
||||
m_nMouseClick_Y_Coordinate = event->y();
|
||||
}
|
||||
|
||||
void MainWindow::mouseMoveEvent(QMouseEvent *event) {
|
||||
if (isWidgetIsTitleBar()) {
|
||||
move(event->globalX() - m_nMouseClick_X_Coordinate ,
|
||||
event->globalY() - m_nMouseClick_Y_Coordinate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool MainWindow::isWidgetIsTitleBar() {
|
||||
return (m_nMouseClick_X_Coordinate >= xmin &&
|
||||
m_nMouseClick_X_Coordinate < xmax &&
|
||||
m_nMouseClick_Y_Coordinate >= ymin &&
|
||||
m_nMouseClick_Y_Coordinate < ymax);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
@@ -33,6 +55,10 @@ void MainWindow::init() {
|
||||
objectId.insert(ui->wed_button->objectName(), Identifier::wed);
|
||||
objectId.insert(ui->thu_button->objectName(), Identifier::thu);
|
||||
objectId.insert(ui->fri_button->objectName(), Identifier::fri);
|
||||
xmax = ui->window_title->x() + ui->window_title->width();
|
||||
xmin = ui->window_title->x();
|
||||
ymax = ui->window_title->x() + ui->window_title->height();
|
||||
ymin = ui->window_title->y();
|
||||
connect(ui->aboutButton, &QPushButton::clicked, this, &MainWindow::open_about);
|
||||
connect(ui->template_settings_button, &QPushButton::clicked, this, &MainWindow::edit_template);
|
||||
connect(ui->dateEdit, &QDateEdit::dateTimeChanged, this, &MainWindow::compute_week_number);
|
||||
@@ -41,6 +67,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 +81,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 +187,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 +205,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)) {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#define SAVE_FILE_VERSION 1
|
||||
#define KEY_SAVE_FILE_VERSION "version"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QGraphicsView>
|
||||
#include <QJsonArray>
|
||||
#include <QMainWindow>
|
||||
#include <QDir>
|
||||
@@ -43,6 +45,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);
|
||||
@@ -52,6 +61,16 @@ private:
|
||||
QMap<int, Week> weeks;
|
||||
QMap<QString, Identifier> objectId;
|
||||
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
int m_nMouseClick_X_Coordinate;
|
||||
int m_nMouseClick_Y_Coordinate;
|
||||
int xmax;
|
||||
int xmin;
|
||||
int ymax;
|
||||
int ymin;
|
||||
inline bool isWidgetIsTitleBar();
|
||||
|
||||
public slots:
|
||||
void compute_week_number(const QDateTime &dt);
|
||||
void compute_time();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>707</width>
|
||||
<height>363</height>
|
||||
<height>381</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@@ -22,7 +22,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>707</width>
|
||||
<height>363</height>
|
||||
<height>381</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -91,7 +91,7 @@
|
||||
<string notr="true">font-size: 12px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Version: 1.0.0 (Beta 2)</string>
|
||||
<string>Version: 1.0.0 (Beta 4)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
@@ -107,7 +107,7 @@
|
||||
<string notr="true">font-size: 12px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Made with Qt 5.15.0 MinGW 64bit (C++17)</string>
|
||||
<string><html><head/><body><p>Made with Qt 5.15.0 MSVC2019 64bit (C++17) (<a href="https://github.com/alexlegarnd/Chronos"><span style=" text-decoration: underline; color:#0000ff;">Source Github</span></a>)</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
@@ -122,6 +122,9 @@
|
||||
<property name="accessibleDescription">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-size: 12px;</string>
|
||||
</property>
|
||||
<property name="undoRedoEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@@ -132,7 +135,7 @@
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.5pt; font-weight:400; font-style:normal;">
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:12px; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Application icon: Alexis Delhaie (me)</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">About box banner: Alexis Delhaie (me)</span></p>
|
||||
@@ -173,7 +176,23 @@ p, li { white-space: pre-wrap; }
|
||||
<string notr="true">font-size: 12px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Installer/Updater made with Delphi 10.3 Community</string>
|
||||
<string><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></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>310</y>
|
||||
<width>541</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-size: 12px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><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></string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
847
ui/mainwindow.ui
847
ui/mainwindow.ui
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user