Pointer + time delta
This commit is contained in:
30
Chronos.pro
30
Chronos.pro
@@ -3,23 +3,30 @@ greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
|
||||
|
||||
CONFIG += c++17
|
||||
|
||||
win32:VERSION = 2.2.0.0 # major.minor.patch.build
|
||||
else:VERSION = 2.2.0 # major.minor.patch
|
||||
|
||||
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
|
||||
|
||||
# remove possible other optimization flags
|
||||
win32 {
|
||||
message("Build for Windows")
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O1
|
||||
QMAKE_CXXFLAGS_RELEASE *= -O2
|
||||
DEFINES += APP_OS=\"\\\"Windows\\\"\"
|
||||
DEFINES += APP_OS_VERSION=\"\\\"$$system(wmic os get version /value)\\\"\"
|
||||
equals(QMAKE_TARGET.arch, arm64) {
|
||||
message("CPU Architecture : aarch64")
|
||||
# Add specific arm stuff here
|
||||
DEFINES += APP_ARCH=\"\\\"arm64\\\"\"
|
||||
}
|
||||
equals(QMAKE_TARGET.arch, x86_64) {
|
||||
message("CPU Architecture : x64")
|
||||
QMAKE_CXXFLAGS_RELEASE += -favor:INTEL64
|
||||
DEFINES += APP_ARCH=\"\\\"x64\\\"\"
|
||||
}
|
||||
RC_ICONS = icon.ico
|
||||
VERSION = 2.0.0.0
|
||||
QMAKE_TARGET_COMPANY = "Aurélie Delhaie"
|
||||
QMAKE_TARGET_COMPANY = "Aurelie Delhaie"
|
||||
QMAKE_TARGET_PRODUCT = "Chronos"
|
||||
QMAKE_TARGET_DESCRIPTION = "Chronos"
|
||||
}
|
||||
@@ -32,11 +39,23 @@ macx {
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O1
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O2
|
||||
QMAKE_CXXFLAGS_RELEASE *= -O3
|
||||
DEFINES += APP_OS=\"\\\"macOS\\\"\"
|
||||
DEFINES += APP_OS_VERSION=\"\\\"$$system(uname -r)\\\"\"
|
||||
equals(QMAKE_APPLE_DEVICE_ARCHS, arm64) {
|
||||
message("CPU Architecture : aarch64")
|
||||
DEFINES += APP_ARCH=\"\\\"aarch64\\\"\"
|
||||
QMAKE_CXXFLAGS_RELEASE += -mcpu=apple-a14
|
||||
}
|
||||
VERSION = 2.0.0
|
||||
}
|
||||
|
||||
linux-g++* {
|
||||
message("Build for Linux")
|
||||
DEFINES += APP_OS=\"\\\"$$system(cat /etc/issue | cut -d\' \' -f1)\\\"\"
|
||||
DEFINES += APP_OS_VERSION=\"\\\"$$system(uname -r)\\\"\"
|
||||
DEFINES += APP_ARCH=\"\\\"amd64\\\"\"
|
||||
QMAKE_CXXFLAGS_RELEASE *= -O3
|
||||
QMAKE_CXXFLAGS_RELEASE += -march=skylake
|
||||
VERSION = 1.1.0
|
||||
}
|
||||
|
||||
# add the desired -O3 if not present, MinGW only
|
||||
@@ -68,6 +87,7 @@ SOURCES += \
|
||||
sources/setdaydialog.cpp \
|
||||
sources/tools.cpp \
|
||||
sources/models/week.cpp \
|
||||
sources/weekoption.cpp \
|
||||
sources/welcome.cpp \
|
||||
sources/models/year.cpp
|
||||
|
||||
@@ -83,10 +103,12 @@ HEADERS += \
|
||||
sources/setdaydialog.h \
|
||||
sources/tools.h \
|
||||
sources/models/week.h \
|
||||
sources/weekoption.h \
|
||||
sources/welcome.h \
|
||||
sources/models/year.h
|
||||
|
||||
FORMS += \
|
||||
sources/weekoption.ui \
|
||||
ui/configurationdialog.ui \
|
||||
ui/breakdialog.ui \
|
||||
ui/aboutbox.ui \
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 5.0.2, 2022-01-09T21:20:38. -->
|
||||
<!-- Written by QtCreator 6.0.2, 2022-03-01T19:28:21. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{f1407b1e-b4d5-4aac-ba0d-b38072a0dfb8}</value>
|
||||
<value type="QByteArray">{dbe9fba1-e5a9-4d98-85bf-f46da0900eba}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
<value type="qlonglong">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
@@ -28,7 +28,7 @@
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
@@ -77,45 +77,40 @@
|
||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
||||
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
||||
<value type="int" key="ClangTools.ParallelJobs">4</value>
|
||||
<value type="int" key="ClangTools.ParallelJobs">8</value>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="CppEditor.QuickFix">
|
||||
<value type="bool" key="UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 6.2.0 for macOS</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 6.2.0 for macOS</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.620.clang_64_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.2.3 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.2.3 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.623.gcc_64_kit</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Volumes/Macintosh SSD/sources/Qt/build-Chronos-Qt_6_2_0_for_macOS-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Volumes/Macintosh SSD/sources/Qt/build-Chronos-Qt_6_2_0_for_macOS-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/aurelie/src/build-Chronos-Desktop_Qt_6_2_3_GCC_64bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/aurelie/src/build-Chronos-Desktop_Qt_6_2_3_GCC_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>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis">
|
||||
<value type="QString">arm-darwin-generic-mach_o-64bit</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
@@ -126,7 +121,7 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
@@ -134,28 +129,27 @@
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Volumes/Macintosh SSD/sources/Qt/build-Chronos-Qt_6_2_0_for_macOS-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Volumes/Macintosh SSD/sources/Qt/build-Chronos-Qt_6_2_0_for_macOS-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/aurelie/src/build-Chronos-Desktop_Qt_6_2_3_GCC_64bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/aurelie/src/build-Chronos-Desktop_Qt_6_2_3_GCC_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>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis">
|
||||
<value type="QString">arm-darwin-generic-mach_o-64bit</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
@@ -166,7 +160,7 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
@@ -174,6 +168,7 @@
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
@@ -182,20 +177,20 @@
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Volumes/Macintosh SSD/sources/Qt/build-Chronos-Qt_6_2_0_for_macOS-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Volumes/Macintosh SSD/sources/Qt/build-Chronos-Qt_6_2_0_for_macOS-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/aurelie/src/build-Chronos-Desktop_Qt_6_2_3_GCC_64bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/aurelie/src/build-Chronos-Desktop_Qt_6_2_3_GCC_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>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
@@ -206,7 +201,7 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
@@ -214,6 +209,7 @@
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
@@ -221,10 +217,10 @@
|
||||
<value type="int" key="QtQuickCompiler">0</value>
|
||||
<value type="int" key="SeparateDebugInfo">0</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
@@ -234,7 +230,7 @@
|
||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
@@ -242,21 +238,21 @@
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/Volumes/Macintosh SSD/sources/Qt/Chronos/Chronos.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Volumes/Macintosh SSD/sources/Qt/Chronos/Chronos.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/aurelie/src/Chronos/Chronos.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/aurelie/src/Chronos/Chronos.pro</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/Volumes/Macintosh SSD/sources/Qt/build-Chronos-Qt_6_2_0_for_macOS-Debug/Chronos.app/Contents/MacOS</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/aurelie/src/build-Chronos-Desktop_Qt_6_2_3_GCC_64bit-Debug</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
<value type="qlonglong">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
|
||||
BIN
icon-1.png
Normal file
BIN
icon-1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
@@ -11,8 +11,8 @@ AboutBox::AboutBox(QWidget *parent) :
|
||||
xmin = ui->frame->x();
|
||||
ymax = ui->frame->x() + ui->frame->height();
|
||||
ymin = ui->frame->y();
|
||||
ui->systemLabel->setText(QString("Built on %1 (%2-%3)").arg(QSysInfo::prettyProductName(), QSysInfo::kernelVersion(), QSysInfo::buildCpuArchitecture()));
|
||||
ui->versionLabel->setText(QString("Version: %1").arg(VERSION));
|
||||
ui->systemLabel->setText(QString("Built on %1 %2 (%3)").arg(APP_OS, APP_OS_VERSION, APP_ARCH));
|
||||
ui->versionLabel->setText(QString("Version: %1").arg(APP_VERSION));
|
||||
}
|
||||
|
||||
AboutBox::~AboutBox()
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef ABOUTBOX_H
|
||||
#define ABOUTBOX_H
|
||||
|
||||
#define VERSION "2.1.0"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMouseEvent>
|
||||
#include <iostream>
|
||||
|
||||
@@ -11,6 +11,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete week_template;
|
||||
foreach (Year *y, years) {
|
||||
delete y;
|
||||
}
|
||||
years.clear();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -35,6 +40,8 @@ void MainWindow::init() {
|
||||
objectId.insert(ui->fri_button->objectName(), Identifier::fri);
|
||||
connect(ui->aboutButton, &QPushButton::clicked, this, &MainWindow::open_about);
|
||||
connect(ui->template_settings_button, &QPushButton::clicked, this, &MainWindow::edit_template);
|
||||
connect(ui->today_button, &QPushButton::clicked, this, &MainWindow::set_date_to_now);
|
||||
connect(ui->week_options_button, &QPushButton::clicked, this, &MainWindow::set_week_options);
|
||||
connect(ui->dateEdit, &QDateEdit::dateTimeChanged, this, &MainWindow::compute_week_number);
|
||||
connect(ui->mon_button, &QPushButton::clicked, this, &MainWindow::edit);
|
||||
connect(ui->tue_button, &QPushButton::clicked, this, &MainWindow::edit);
|
||||
@@ -48,9 +55,9 @@ void MainWindow::init() {
|
||||
if (QFile::exists(get_save_file_path())) {
|
||||
open_save();
|
||||
} else {
|
||||
week_template = new Week();
|
||||
Welcome w(week_template);
|
||||
w.exec();
|
||||
week_template = w.get_result();
|
||||
saveLoaded = true;
|
||||
}
|
||||
if (saveLoaded) {
|
||||
@@ -65,7 +72,8 @@ void MainWindow::highlightDayOfWeek() {
|
||||
ui->wedLabel->setText("Mercredi");
|
||||
ui->thuLabel->setText("Jeudi");
|
||||
ui->friLabel->setText("Vendredi");
|
||||
if (todayWeekNumber == current_week.getWeekNumber()) {
|
||||
if (todayWeekNumber == current_week->getWeekNumber()) {
|
||||
ui->today_button->setDisabled(true);
|
||||
switch (dayOfWeek) {
|
||||
case 1: {
|
||||
ui->monLabel->setText(QString("> %1 <").arg(ui->monLabel->text()));
|
||||
@@ -89,6 +97,8 @@ void MainWindow::highlightDayOfWeek() {
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
} else {
|
||||
ui->today_button->setDisabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,8 +122,8 @@ void MainWindow::open_save() {
|
||||
week_template = Week::from_json(obj[KEY_TEMPLATE].toObject());
|
||||
QJsonArray arr = obj[KEY_YEARS].toArray();
|
||||
foreach (QJsonValue val, arr) {
|
||||
Year y = Year::from_json(val.toObject());
|
||||
years[y.getNumber()] = y;
|
||||
Year *y = Year::from_json(val.toObject());
|
||||
years[y->getNumber()] = y;
|
||||
}
|
||||
saveLoaded = true;
|
||||
}
|
||||
@@ -126,11 +136,11 @@ void MainWindow::panic_dialog(QString text) {
|
||||
|
||||
void MainWindow::save_to_file() {
|
||||
QJsonArray arr;
|
||||
foreach (Year y, years) {
|
||||
arr.append(y.to_json());
|
||||
foreach (Year *y, years) {
|
||||
arr.append(y->to_json());
|
||||
}
|
||||
QJsonObject obj {
|
||||
{KEY_TEMPLATE, week_template.to_json()},
|
||||
{KEY_TEMPLATE, week_template->to_json()},
|
||||
{KEY_YEARS, arr},
|
||||
{KEY_SAVE_FILE_VERSION, SAVE_FILE_VERSION}
|
||||
};
|
||||
@@ -150,19 +160,18 @@ void MainWindow::compute_week_number(const QDateTime &dt) {
|
||||
if (years.contains(y)) {
|
||||
current_year = years[y];
|
||||
} else {
|
||||
Year nYear(y);
|
||||
Year *nYear = new Year(y);
|
||||
years[y] = nYear;
|
||||
current_year = nYear;
|
||||
save_to_file();
|
||||
}
|
||||
|
||||
if (current_year.getWeeks().contains(n)) {
|
||||
auto weeks = current_year.getWeeks();
|
||||
current_week = weeks[n];
|
||||
if (current_year->hasWeek(n)) {
|
||||
current_week = current_year->getWeek(n);
|
||||
} else {
|
||||
current_week = Week(week_template);
|
||||
current_week.setWeekNumber(n);
|
||||
current_year.addWeek(current_week);
|
||||
current_week = new Week(week_template);
|
||||
current_week->setWeekNumber(n);
|
||||
current_year->addWeek(current_week);
|
||||
save_to_file();
|
||||
}
|
||||
compute_time();
|
||||
@@ -170,12 +179,12 @@ void MainWindow::compute_week_number(const QDateTime &dt) {
|
||||
}
|
||||
|
||||
void MainWindow::compute_time() {
|
||||
ui->mon_time_label->setText(Tools::double_to_string_time(current_week.getMon().get_total()));
|
||||
ui->tue_time_label->setText(Tools::double_to_string_time(current_week.getTue().get_total()));
|
||||
ui->wed_time_label->setText(Tools::double_to_string_time(current_week.getWed().get_total()));
|
||||
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()));
|
||||
ui->mon_time_label->setText(Tools::double_to_string_time(current_week->getMon()->get_total()));
|
||||
ui->tue_time_label->setText(Tools::double_to_string_time(current_week->getTue()->get_total()));
|
||||
ui->wed_time_label->setText(Tools::double_to_string_time(current_week->getWed()->get_total()));
|
||||
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();
|
||||
@@ -184,10 +193,12 @@ void MainWindow::compute_time() {
|
||||
double late = 0.0;
|
||||
double overtime = 0.0;
|
||||
int todayWeekNumber = QDate::currentDate().weekNumber();
|
||||
foreach (Week w, current_year.getWeeks()) {
|
||||
if (w.getWeekNumber() <= todayWeekNumber) {
|
||||
late += (week_template.total() - w.total());
|
||||
overtime += (w.total() - week_template.total());
|
||||
QMapIterator i = current_year->iterator();
|
||||
while (i.hasNext()) {
|
||||
Week *w = i.next().value();
|
||||
if (w->getWeekNumber() <= todayWeekNumber) {
|
||||
late += (week_template->total() - w->total()) - w->getTimeDeltaInHours();
|
||||
overtime += (w->total() - week_template->total()) + w->getTimeDeltaInHours();
|
||||
}
|
||||
}
|
||||
ui->late_time_label->setText(Tools::double_to_string_time((late > 0.0) ? late : 0.0));
|
||||
@@ -195,72 +206,64 @@ void MainWindow::compute_time() {
|
||||
}
|
||||
|
||||
void MainWindow::updateValidIcon() {
|
||||
ui->mondayValidate->setVisible(current_week.getMon().get_validate());
|
||||
ui->tuesdayValidate->setVisible(current_week.getTue().get_validate());
|
||||
ui->wednesdayValidate->setVisible(current_week.getWed().get_validate());
|
||||
ui->thurdayValidate->setVisible(current_week.getThu().get_validate());
|
||||
ui->fridayValidate->setVisible(current_week.getFri().get_validate());
|
||||
ui->mondayValidate->setVisible(current_week->getMon()->get_validate());
|
||||
ui->tuesdayValidate->setVisible(current_week->getTue()->get_validate());
|
||||
ui->wednesdayValidate->setVisible(current_week->getWed()->get_validate());
|
||||
ui->thurdayValidate->setVisible(current_week->getThu()->get_validate());
|
||||
ui->fridayValidate->setVisible(current_week->getFri()->get_validate());
|
||||
}
|
||||
|
||||
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"));
|
||||
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()));
|
||||
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"));
|
||||
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)) {
|
||||
case mon:
|
||||
current_week.setMon(modify_value(current_week.getMon()));
|
||||
modify_value(current_week->getMon());
|
||||
break;
|
||||
case tue:
|
||||
current_week.setTue(modify_value(current_week.getTue()));
|
||||
modify_value(current_week->getTue());
|
||||
break;
|
||||
case wed:
|
||||
current_week.setWed(modify_value(current_week.getWed()));
|
||||
modify_value(current_week->getWed());
|
||||
break;
|
||||
case thu:
|
||||
current_week.setThu(modify_value(current_week.getThu()));
|
||||
modify_value(current_week->getThu());
|
||||
break;
|
||||
case fri:
|
||||
current_week.setFri(modify_value(current_week.getFri()));
|
||||
modify_value(current_week->getFri());
|
||||
break;
|
||||
}
|
||||
auto weeks = current_year.getWeeks();
|
||||
weeks[current_week.getWeekNumber()] = current_week;
|
||||
current_year.setWeeks(weeks);
|
||||
years[current_year.getNumber()] = current_year;
|
||||
save_to_file();
|
||||
compute_time();
|
||||
}
|
||||
|
||||
Day MainWindow::modify_value(Day d) {
|
||||
bool isNotValidable = (current_week.getWeekNumber() > todayWeekNumber);
|
||||
void MainWindow::modify_value(Day *d) {
|
||||
bool isNotValidable = (current_week->getWeekNumber() > todayWeekNumber);
|
||||
SetDayDialog sdd(d, isNotValidable, this);
|
||||
int result = sdd.exec();
|
||||
if (result == QDialog::Accepted) {
|
||||
return sdd.get_result();
|
||||
}
|
||||
return d;
|
||||
sdd.exec();
|
||||
}
|
||||
|
||||
Identifier MainWindow::get_identifier(QString objectName) {
|
||||
@@ -271,7 +274,6 @@ void MainWindow::edit_template() {
|
||||
Welcome w(week_template);
|
||||
int res = w.exec();
|
||||
if (res == QDialog::Accepted) {
|
||||
week_template = w.get_result();
|
||||
save_to_file();
|
||||
compute_time();
|
||||
}
|
||||
@@ -281,3 +283,14 @@ void MainWindow::open_about() {
|
||||
AboutBox a(this);
|
||||
a.exec();
|
||||
}
|
||||
|
||||
void MainWindow::set_week_options()
|
||||
{
|
||||
WeekOption ow(current_week, this);
|
||||
int result = ow.exec();
|
||||
if (result == QDialog::Accepted) {
|
||||
current_week->setTimeDelta(ow.get_time_delta());
|
||||
save_to_file();
|
||||
compute_time();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "welcome.h"
|
||||
#include "tools.h"
|
||||
#include "aboutbox.h"
|
||||
#include "weekoption.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
@@ -59,23 +60,24 @@ private:
|
||||
|
||||
QString get_save_file_path();
|
||||
Identifier get_identifier(QString objectName);
|
||||
Day modify_value(Day);
|
||||
void modify_value(Day*);
|
||||
|
||||
Week week_template;
|
||||
Week current_week;
|
||||
Year current_year;
|
||||
QMap<int, Year> years;
|
||||
Week* week_template;
|
||||
Week* current_week;
|
||||
Year* current_year;
|
||||
QMap<int, Year*> years;
|
||||
QMap<QString, Identifier> objectId;
|
||||
int todayWeekNumber;
|
||||
int dayOfWeek;
|
||||
bool saveLoaded;
|
||||
|
||||
public slots:
|
||||
private slots:
|
||||
void compute_week_number(const QDateTime &dt);
|
||||
void compute_time();
|
||||
void set_date_to_now();
|
||||
void edit();
|
||||
void edit_template();
|
||||
void open_about();
|
||||
void set_week_options();
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
@@ -5,6 +5,12 @@ BreakPoint::BreakPoint()
|
||||
|
||||
}
|
||||
|
||||
BreakPoint::BreakPoint(BreakPoint *old)
|
||||
{
|
||||
this->start = old->start;
|
||||
this->end = old->end;
|
||||
}
|
||||
|
||||
BreakPoint::BreakPoint(QTime start, QTime end)
|
||||
{
|
||||
this->start = start;
|
||||
@@ -45,12 +51,12 @@ QJsonObject BreakPoint::to_json()
|
||||
return obj;
|
||||
}
|
||||
|
||||
BreakPoint BreakPoint::from_json(QJsonObject obj)
|
||||
BreakPoint* BreakPoint::from_json(QJsonObject obj)
|
||||
{
|
||||
BreakPoint result;
|
||||
BreakPoint *result = new BreakPoint();
|
||||
|
||||
result.start = QTime::fromString(obj["start"].toString(), Qt::DateFormat::ISODate);
|
||||
result.end = QTime::fromString(obj["end"].toString(), Qt::DateFormat::ISODate);
|
||||
result->start = QTime::fromString(obj["start"].toString(), Qt::DateFormat::ISODate);
|
||||
result->end = QTime::fromString(obj["end"].toString(), Qt::DateFormat::ISODate);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ private:
|
||||
|
||||
public:
|
||||
BreakPoint();
|
||||
BreakPoint(BreakPoint*);
|
||||
BreakPoint(QTime, QTime);
|
||||
|
||||
QTime getStart();
|
||||
@@ -23,7 +24,7 @@ public:
|
||||
void setEnd(QTime);
|
||||
|
||||
QJsonObject to_json();
|
||||
static BreakPoint from_json(QJsonObject);
|
||||
static BreakPoint* from_json(QJsonObject);
|
||||
};
|
||||
|
||||
#endif // BREAKPOINT_H
|
||||
|
||||
@@ -4,11 +4,29 @@ Day::Day()
|
||||
{
|
||||
start = QTime(9, 0, 0, 0);
|
||||
end = QTime(17, 15, 0, 0);
|
||||
BreakPoint lunch(QTime(12, 0, 0, 0), QTime(12, 45, 0, 0));
|
||||
BreakPoint *lunch = new BreakPoint(QTime(12, 0, 0, 0), QTime(12, 45, 0, 0));
|
||||
breaks.append(lunch);
|
||||
validate = false;
|
||||
}
|
||||
|
||||
Day::Day(Day *old)
|
||||
{
|
||||
start = QTime(9, 0, 0, 0);
|
||||
end = QTime(17, 15, 0, 0);
|
||||
BreakPoint *lunch = new BreakPoint(QTime(12, 0, 0, 0), QTime(12, 45, 0, 0));
|
||||
breaks.append(lunch);
|
||||
validate = false;
|
||||
update(old);
|
||||
}
|
||||
|
||||
Day::~Day()
|
||||
{
|
||||
foreach (BreakPoint *bp, breaks) {
|
||||
delete bp;
|
||||
}
|
||||
breaks.clear();
|
||||
}
|
||||
|
||||
float Day::get_total() {
|
||||
int sec = start.secsTo(end);
|
||||
int minutes = sec / 60;
|
||||
@@ -30,7 +48,7 @@ void Day::set_validate(bool value) {
|
||||
validate = value;
|
||||
}
|
||||
|
||||
void Day::setBreaks(QVector<BreakPoint> breaks)
|
||||
void Day::setBreaks(QVector<BreakPoint*> breaks)
|
||||
{
|
||||
this->breaks = breaks;
|
||||
}
|
||||
@@ -45,7 +63,7 @@ QTime Day::get_end()
|
||||
return end;
|
||||
}
|
||||
|
||||
QVector<BreakPoint> Day::getBreaks()
|
||||
QVector<BreakPoint*> Day::getBreaks()
|
||||
{
|
||||
return breaks;
|
||||
}
|
||||
@@ -53,8 +71,8 @@ QVector<BreakPoint> Day::getBreaks()
|
||||
QJsonObject Day::to_json()
|
||||
{
|
||||
QJsonArray arr;
|
||||
foreach (BreakPoint bp, breaks) {
|
||||
arr.append(bp.to_json());
|
||||
foreach (BreakPoint *bp, breaks) {
|
||||
arr.append(bp->to_json());
|
||||
}
|
||||
QJsonObject obj{
|
||||
{KEY_START, start.toString(Qt::DateFormat::ISODate)},
|
||||
@@ -66,18 +84,18 @@ QJsonObject Day::to_json()
|
||||
return obj;
|
||||
}
|
||||
|
||||
Day Day::from_json(QJsonObject obj)
|
||||
Day* Day::from_json(QJsonObject obj)
|
||||
{
|
||||
Day result;
|
||||
Day *result = new Day();
|
||||
|
||||
result.start = QTime::fromString(obj[KEY_START].toString(), Qt::DateFormat::ISODate);
|
||||
result.end = QTime::fromString(obj[KEY_END].toString(), Qt::DateFormat::ISODate);
|
||||
result.validate = obj[KEY_VALIDATE].toBool();
|
||||
result->start = QTime::fromString(obj[KEY_START].toString(), Qt::DateFormat::ISODate);
|
||||
result->end = QTime::fromString(obj[KEY_END].toString(), Qt::DateFormat::ISODate);
|
||||
result->validate = obj[KEY_VALIDATE].toBool();
|
||||
|
||||
result.breaks.clear();
|
||||
result->breaks.clear();
|
||||
QJsonArray arr = obj[KEY_BREAKS].toArray();
|
||||
foreach (QJsonValue val, arr) {
|
||||
result.breaks.append(BreakPoint::from_json(val.toObject()));
|
||||
result->breaks.append(BreakPoint::from_json(val.toObject()));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -90,8 +108,24 @@ bool Day::get_validate() {
|
||||
float Day::get_time_break()
|
||||
{
|
||||
float result = 0;
|
||||
foreach (BreakPoint bp, breaks) {
|
||||
result += bp.getDuration();
|
||||
foreach (BreakPoint* bp, breaks) {
|
||||
result += bp->getDuration();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void Day::update(Day *old)
|
||||
{
|
||||
this->start = old->start;
|
||||
this->end = old->end;
|
||||
this->validate = old->validate;
|
||||
|
||||
foreach (BreakPoint *bp, breaks) {
|
||||
delete bp;
|
||||
}
|
||||
breaks.clear();
|
||||
|
||||
foreach (BreakPoint *bp, old->breaks) {
|
||||
this->breaks.append(new BreakPoint(bp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,27 +19,30 @@ class Day
|
||||
private:
|
||||
QTime start;
|
||||
QTime end;
|
||||
QVector<BreakPoint> breaks;
|
||||
QVector<BreakPoint*> breaks;
|
||||
bool validate;
|
||||
|
||||
public:
|
||||
Day();
|
||||
Day(Day*);
|
||||
~Day();
|
||||
|
||||
void set_start(QTime value);
|
||||
void set_end(QTime value);
|
||||
void set_validate(bool);
|
||||
void setBreaks(QVector<BreakPoint>);
|
||||
void setBreaks(QVector<BreakPoint*>);
|
||||
|
||||
QTime get_start();
|
||||
QTime get_end();
|
||||
QVector<BreakPoint> getBreaks();
|
||||
QVector<BreakPoint*> getBreaks();
|
||||
bool get_validate();
|
||||
float get_time_break();
|
||||
void update(Day *);
|
||||
QJsonObject to_json();
|
||||
|
||||
float get_total();
|
||||
|
||||
static Day from_json(QJsonObject);
|
||||
static Day* from_json(QJsonObject);
|
||||
};
|
||||
|
||||
#endif // DAY_H
|
||||
|
||||
@@ -2,85 +2,135 @@
|
||||
|
||||
Week::Week()
|
||||
{
|
||||
mon = Day();
|
||||
tue = Day();
|
||||
wed = Day();
|
||||
thu = Day();
|
||||
fri = Day();
|
||||
mon = new Day();
|
||||
tue = new Day();
|
||||
wed = new Day();
|
||||
thu = new Day();
|
||||
fri = new Day();
|
||||
time_delta = 0;
|
||||
week_number = 0;
|
||||
}
|
||||
|
||||
Week Week::from_json(QJsonObject obj) {
|
||||
Week w;
|
||||
w.mon = Day::from_json(obj[MONDAY].toObject());
|
||||
w.tue = Day::from_json(obj[TUESDAY].toObject());
|
||||
w.wed = Day::from_json(obj[WEDNESDAY].toObject());
|
||||
w.thu = Day::from_json(obj[THURDAY].toObject());
|
||||
w.fri = Day::from_json(obj[FRIDAY].toObject());
|
||||
w.week_number = obj[WEEK_NUMBER].toInt();
|
||||
Week::Week(Week *old)
|
||||
{
|
||||
mon = new Day();
|
||||
tue = new Day();
|
||||
wed = new Day();
|
||||
thu = new Day();
|
||||
fri = new Day();
|
||||
time_delta = 0;
|
||||
week_number = 0;
|
||||
update(old);
|
||||
}
|
||||
|
||||
Week::~Week()
|
||||
{
|
||||
delete mon;
|
||||
delete tue;
|
||||
delete wed;
|
||||
delete thu;
|
||||
delete fri;
|
||||
}
|
||||
|
||||
Week* Week::from_json(QJsonObject obj) {
|
||||
Week *w = new Week();
|
||||
w->mon = Day::from_json(obj[MONDAY].toObject());
|
||||
w->tue = Day::from_json(obj[TUESDAY].toObject());
|
||||
w->wed = Day::from_json(obj[WEDNESDAY].toObject());
|
||||
w->thu = Day::from_json(obj[THURDAY].toObject());
|
||||
w->fri = Day::from_json(obj[FRIDAY].toObject());
|
||||
w->time_delta = obj[TIME_DELTA].toInt(0);
|
||||
w->week_number = obj[WEEK_NUMBER].toInt();
|
||||
return w;
|
||||
}
|
||||
|
||||
QJsonObject Week::to_json() {
|
||||
QJsonObject obj {
|
||||
{MONDAY, mon.to_json()},
|
||||
{TUESDAY, tue.to_json()},
|
||||
{WEDNESDAY, wed.to_json()},
|
||||
{THURDAY, thu.to_json()},
|
||||
{FRIDAY, fri.to_json()},
|
||||
{MONDAY, mon->to_json()},
|
||||
{TUESDAY, tue->to_json()},
|
||||
{WEDNESDAY, wed->to_json()},
|
||||
{THURDAY, thu->to_json()},
|
||||
{FRIDAY, fri->to_json()},
|
||||
{TIME_DELTA, time_delta},
|
||||
{WEEK_NUMBER, week_number}
|
||||
};
|
||||
return obj;
|
||||
}
|
||||
|
||||
double Week::total() {
|
||||
return mon.get_total() + tue.get_total() + wed.get_total() + thu.get_total() + fri.get_total();
|
||||
return mon->get_total() + tue->get_total() + wed->get_total() + thu->get_total() + fri->get_total();
|
||||
}
|
||||
|
||||
Day Week::getMon() {
|
||||
Day* Week::getMon() {
|
||||
return mon;
|
||||
}
|
||||
|
||||
Day Week::getTue() {
|
||||
Day* Week::getTue() {
|
||||
return tue;
|
||||
}
|
||||
|
||||
Day Week::getWed() {
|
||||
Day* Week::getWed() {
|
||||
return wed;
|
||||
}
|
||||
|
||||
Day Week::getThu() {
|
||||
Day* Week::getThu() {
|
||||
return thu;
|
||||
}
|
||||
|
||||
Day Week::getFri() {
|
||||
Day* Week::getFri() {
|
||||
return fri;
|
||||
}
|
||||
|
||||
void Week::update(Week *old)
|
||||
{
|
||||
mon = new Day(old->mon);
|
||||
tue = new Day(old->tue);
|
||||
wed = new Day(old->wed);
|
||||
thu = new Day(old->thu);
|
||||
fri = new Day(old->fri);
|
||||
time_delta = old->time_delta;
|
||||
week_number = old->week_number;
|
||||
}
|
||||
|
||||
int Week::getWeekNumber() {
|
||||
return week_number;
|
||||
}
|
||||
|
||||
void Week::setMon(Day value) {
|
||||
int Week::getTimeDelta()
|
||||
{
|
||||
return time_delta;
|
||||
}
|
||||
|
||||
float Week::getTimeDeltaInHours()
|
||||
{
|
||||
return time_delta/60.0;
|
||||
}
|
||||
|
||||
void Week::setMon(Day* value) {
|
||||
mon = value;
|
||||
}
|
||||
|
||||
void Week::setTue(Day value) {
|
||||
void Week::setTue(Day* value) {
|
||||
tue = value;
|
||||
}
|
||||
|
||||
void Week::setWed(Day value) {
|
||||
void Week::setWed(Day* value) {
|
||||
wed = value;
|
||||
}
|
||||
|
||||
void Week::setThu(Day value) {
|
||||
void Week::setThu(Day* value) {
|
||||
thu = value;
|
||||
}
|
||||
|
||||
void Week::setFri(Day value) {
|
||||
void Week::setFri(Day* value) {
|
||||
fri = value;
|
||||
}
|
||||
|
||||
void Week::setWeekNumber(int value) {
|
||||
week_number = value;
|
||||
}
|
||||
|
||||
void Week::setTimeDelta(int value)
|
||||
{
|
||||
time_delta = value;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define WEDNESDAY "wednesday"
|
||||
#define THURDAY "thurday"
|
||||
#define FRIDAY "friday"
|
||||
#define TIME_DELTA "timeDelta"
|
||||
#define WEEK_NUMBER "weekNumber"
|
||||
|
||||
#include <QJsonObject>
|
||||
@@ -15,31 +16,38 @@ class Week
|
||||
{
|
||||
public:
|
||||
Week();
|
||||
Week(Week*);
|
||||
~Week();
|
||||
double total();
|
||||
|
||||
void setMon(Day);
|
||||
void setTue(Day);
|
||||
void setWed(Day);
|
||||
void setThu(Day);
|
||||
void setFri(Day);
|
||||
void setMon(Day*);
|
||||
void setTue(Day*);
|
||||
void setWed(Day*);
|
||||
void setThu(Day*);
|
||||
void setFri(Day*);
|
||||
void setWeekNumber(int);
|
||||
void setTimeDelta(int);
|
||||
|
||||
Day getMon();
|
||||
Day getTue();
|
||||
Day getWed();
|
||||
Day getThu();
|
||||
Day getFri();
|
||||
Day* getMon();
|
||||
Day* getTue();
|
||||
Day* getWed();
|
||||
Day* getThu();
|
||||
Day* getFri();
|
||||
void update(Week *);
|
||||
int getWeekNumber();
|
||||
int getTimeDelta();
|
||||
float getTimeDeltaInHours();
|
||||
|
||||
static Week from_json(QJsonObject);
|
||||
static Week* from_json(QJsonObject);
|
||||
QJsonObject to_json();
|
||||
|
||||
private:
|
||||
Day mon;
|
||||
Day tue;
|
||||
Day wed;
|
||||
Day thu;
|
||||
Day fri;
|
||||
Day* mon;
|
||||
Day* tue;
|
||||
Day* wed;
|
||||
Day* thu;
|
||||
Day* fri;
|
||||
int time_delta;
|
||||
int week_number;
|
||||
};
|
||||
|
||||
|
||||
@@ -5,19 +5,35 @@ Year::Year()
|
||||
|
||||
}
|
||||
|
||||
Year::Year(Year *old)
|
||||
{
|
||||
this->number = old->number;
|
||||
foreach (int weekNumber, old->weeks.keys()) {
|
||||
weeks[weekNumber] = new Week(old->weeks[weekNumber]);
|
||||
}
|
||||
}
|
||||
|
||||
Year::~Year()
|
||||
{
|
||||
foreach (Week *w, weeks) {
|
||||
delete w;
|
||||
}
|
||||
weeks.clear();
|
||||
}
|
||||
|
||||
Year::Year(int number)
|
||||
{
|
||||
this->number = number;
|
||||
}
|
||||
|
||||
Year Year::from_json(QJsonObject obj)
|
||||
Year* Year::from_json(QJsonObject obj)
|
||||
{
|
||||
Year result;
|
||||
result.number = obj[KEY_NUMBER].toInt();
|
||||
Year *result = new Year();
|
||||
result->number = obj[KEY_NUMBER].toInt();
|
||||
QJsonArray arr = obj[KEY_WEEKS].toArray();
|
||||
foreach (QJsonValue val, arr) {
|
||||
Week w = Week::from_json(val.toObject());
|
||||
result.weeks[w.getWeekNumber()] = w;
|
||||
Week* w = Week::from_json(val.toObject());
|
||||
result->weeks[w->getWeekNumber()] = w;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -26,17 +42,28 @@ QJsonObject Year::to_json()
|
||||
{
|
||||
QJsonObject obj;
|
||||
QJsonArray arr;
|
||||
foreach (Week w, weeks) {
|
||||
arr.append(w.to_json());
|
||||
foreach (Week *w, weeks) {
|
||||
arr.append(w->to_json());
|
||||
}
|
||||
obj[KEY_NUMBER] = number;
|
||||
obj[KEY_WEEKS] = arr;
|
||||
return obj;
|
||||
}
|
||||
|
||||
QMap<int, Week> Year::getWeeks()
|
||||
Week *Year::getWeek(int weekNumber)
|
||||
{
|
||||
return weeks;
|
||||
return weeks[weekNumber];
|
||||
}
|
||||
|
||||
bool Year::hasWeek(int weekNumber)
|
||||
{
|
||||
return weeks.contains(weekNumber);
|
||||
}
|
||||
|
||||
QMapIterator<int, Week *> Year::iterator()
|
||||
{
|
||||
QMapIterator i(weeks);
|
||||
return i;
|
||||
}
|
||||
|
||||
int Year::getNumber()
|
||||
@@ -44,12 +71,7 @@ int Year::getNumber()
|
||||
return number;
|
||||
}
|
||||
|
||||
void Year::addWeek(Week w)
|
||||
void Year::addWeek(Week* w)
|
||||
{
|
||||
weeks[w.getWeekNumber()] = w;
|
||||
}
|
||||
|
||||
void Year::setWeeks(QMap<int, Week> weeks)
|
||||
{
|
||||
this->weeks = weeks;
|
||||
weeks[w->getWeekNumber()] = w;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QMouseEvent>
|
||||
#include <QMapIterator>
|
||||
|
||||
#include "week.h"
|
||||
|
||||
@@ -13,20 +15,23 @@ class Year
|
||||
{
|
||||
private:
|
||||
int number;
|
||||
QMap<int, Week> weeks;
|
||||
QMap<int, Week*> weeks;
|
||||
|
||||
public:
|
||||
Year();
|
||||
Year(Year*);
|
||||
~Year();
|
||||
Year(int number);
|
||||
|
||||
static Year from_json(QJsonObject);
|
||||
static Year* from_json(QJsonObject);
|
||||
QJsonObject to_json();
|
||||
|
||||
QMap<int, Week> getWeeks();
|
||||
Week *getWeek(int);
|
||||
bool hasWeek(int);
|
||||
QMapIterator<int, Week*> iterator();
|
||||
int getNumber();
|
||||
|
||||
void addWeek(Week w);
|
||||
void setWeeks(QMap<int, Week> weeks);
|
||||
void addWeek(Week* w);
|
||||
};
|
||||
|
||||
#endif // YEAR_H
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include "setdaydialog.h"
|
||||
#include "ui_setdaydialog.h"
|
||||
|
||||
SetDayDialog::SetDayDialog(Day d, bool isNotValidable, QWidget *parent) :
|
||||
SetDayDialog::SetDayDialog(Day *d, bool isNotValidable, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SetDayDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
copy = new Day(d);
|
||||
ui->validateButton->setEnabled(!isNotValidable);
|
||||
ui->validateButton->setVisible(!isNotValidable);
|
||||
this->d = d;
|
||||
@@ -14,43 +15,47 @@ SetDayDialog::SetDayDialog(Day d, bool isNotValidable, QWidget *parent) :
|
||||
|
||||
SetDayDialog::~SetDayDialog()
|
||||
{
|
||||
delete copy;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SetDayDialog::init() {
|
||||
ui->start_edit->setTime(d.get_start());
|
||||
ui->end_edit->setTime(d.get_end());
|
||||
ui->start_edit->setTime(copy->get_start());
|
||||
ui->end_edit->setTime(copy->get_end());
|
||||
updateBreakList();
|
||||
connect(ui->start_edit, &QTimeEdit::timeChanged, this, &SetDayDialog::compute_time);
|
||||
connect(ui->end_edit, &QTimeEdit::timeChanged, this, &SetDayDialog::compute_time);
|
||||
connect(ui->validateButton, &QPushButton::clicked, this, &SetDayDialog::validate);
|
||||
connect(ui->validateButton, &QPushButton::clicked, this, &SetDayDialog::validate_and_accept);
|
||||
connect(ui->pushButton, &QPushButton::clicked, this, &SetDayDialog::accept);
|
||||
connect(ui->addBreakButton, &QPushButton::clicked, this, &SetDayDialog::add_break_point);
|
||||
connect(ui->removeBreakButton, &QPushButton::clicked, this, &SetDayDialog::remove_break_point);
|
||||
connect(ui->breakList, &QListWidget::currentRowChanged, this, &SetDayDialog::break_selected);
|
||||
ui->total_label->setText(Tools::double_to_string_time(d.get_total()));
|
||||
ui->total_label->setText(Tools::double_to_string_time(d->get_total()));
|
||||
}
|
||||
|
||||
void SetDayDialog::updateBreakList()
|
||||
{
|
||||
ui->breakList->clear();
|
||||
foreach (BreakPoint bp, d.getBreaks()) {
|
||||
ui->breakList->addItem(QString("%1 -> %2").arg(bp.getStart().toString("hh:mm"), bp.getEnd().toString("hh:mm")));
|
||||
foreach (BreakPoint *bp, copy->getBreaks()) {
|
||||
ui->breakList->addItem(QString("%1 -> %2").arg(bp->getStart().toString("hh:mm"), bp->getEnd().toString("hh:mm")));
|
||||
}
|
||||
}
|
||||
|
||||
void SetDayDialog::compute_time() {
|
||||
d.set_validate(false);
|
||||
d.set_start(ui->start_edit->time());
|
||||
d.set_end(ui->end_edit->time());
|
||||
ui->total_label->setText(Tools::double_to_string_time(d.get_total()));
|
||||
copy->set_validate(false);
|
||||
copy->set_start(ui->start_edit->time());
|
||||
copy->set_end(ui->end_edit->time());
|
||||
ui->total_label->setText(Tools::double_to_string_time(copy->get_total()));
|
||||
}
|
||||
|
||||
Day SetDayDialog::get_result() {
|
||||
return d;
|
||||
void SetDayDialog::accept()
|
||||
{
|
||||
d->update(copy);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void SetDayDialog::validate() {
|
||||
d.set_validate(true);
|
||||
void SetDayDialog::validate_and_accept() {
|
||||
d->set_validate(true);
|
||||
accept();
|
||||
}
|
||||
|
||||
@@ -60,9 +65,9 @@ void SetDayDialog::add_break_point()
|
||||
int result = bd.exec();
|
||||
if (result == QDialog::Accepted) {
|
||||
BreakPoint bp = bd.get_result();
|
||||
auto breaks = d.getBreaks();
|
||||
breaks.append(bp);
|
||||
d.setBreaks(breaks);
|
||||
auto breaks = copy->getBreaks();
|
||||
breaks.append(new BreakPoint(bp));
|
||||
copy->setBreaks(breaks);
|
||||
updateBreakList();
|
||||
compute_time();
|
||||
}
|
||||
@@ -72,9 +77,11 @@ void SetDayDialog::remove_break_point()
|
||||
{
|
||||
int i = ui->breakList->currentRow();
|
||||
if (i > -1) {
|
||||
auto breaks = d.getBreaks();
|
||||
auto breaks = copy->getBreaks();
|
||||
BreakPoint *bp = breaks.at(i);
|
||||
breaks.removeAt(i);
|
||||
d.setBreaks(breaks);
|
||||
delete bp;
|
||||
copy->setBreaks(breaks);
|
||||
updateBreakList();
|
||||
compute_time();
|
||||
}
|
||||
|
||||
@@ -18,14 +18,13 @@ class SetDayDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SetDayDialog(Day d, bool isNotValidable, QWidget *parent = nullptr);
|
||||
explicit SetDayDialog(Day *d, bool isNotValidable, QWidget *parent = nullptr);
|
||||
~SetDayDialog();
|
||||
|
||||
Day get_result();
|
||||
|
||||
private slots:
|
||||
void compute_time();
|
||||
void validate();
|
||||
void validate_and_accept();
|
||||
void accept();
|
||||
void add_break_point();
|
||||
void remove_break_point();
|
||||
void break_selected(int);
|
||||
@@ -33,7 +32,8 @@ private slots:
|
||||
private:
|
||||
Ui::SetDayDialog *ui;
|
||||
|
||||
Day d;
|
||||
Day *copy;
|
||||
Day *d;
|
||||
|
||||
void init();
|
||||
void updateBreakList();
|
||||
|
||||
27
sources/weekoption.cpp
Normal file
27
sources/weekoption.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "weekoption.h"
|
||||
#include "ui_weekoption.h"
|
||||
|
||||
WeekOption::WeekOption(Week *w, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::WeekOption)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->time_delta = w->getTimeDelta();
|
||||
ui->time_delta_spinbox->setValue(time_delta);
|
||||
connect(ui->time_delta_spinbox, &QSpinBox::valueChanged, this, &WeekOption::set_time_delta);
|
||||
}
|
||||
|
||||
WeekOption::~WeekOption()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
int WeekOption::get_time_delta()
|
||||
{
|
||||
return this->time_delta;
|
||||
}
|
||||
|
||||
void WeekOption::set_time_delta(int value)
|
||||
{
|
||||
this->time_delta = value;
|
||||
}
|
||||
30
sources/weekoption.h
Normal file
30
sources/weekoption.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef WEEKOPTION_H
|
||||
#define WEEKOPTION_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "models/week.h"
|
||||
|
||||
namespace Ui {
|
||||
class WeekOption;
|
||||
}
|
||||
|
||||
class WeekOption : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WeekOption(Week *w, QWidget *parent = nullptr);
|
||||
~WeekOption();
|
||||
int get_time_delta();
|
||||
|
||||
private slots:
|
||||
void set_time_delta(int);
|
||||
|
||||
private:
|
||||
Ui::WeekOption *ui;
|
||||
|
||||
int time_delta;
|
||||
};
|
||||
|
||||
#endif // WEEKOPTION_H
|
||||
143
sources/weekoption.ui
Normal file
143
sources/weekoption.ui
Normal file
@@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WeekOption</class>
|
||||
<widget class="QDialog" name="WeekOption">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>372</width>
|
||||
<height>159</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>372</width>
|
||||
<height>159</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>372</width>
|
||||
<height>159</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<widget class="QSpinBox" name="time_delta_spinbox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<y>40</y>
|
||||
<width>81</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> min</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>101</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Réalignement</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>44</y>
|
||||
<width>131</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delta (en minutes)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="validate_button">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>120</y>
|
||||
<width>88</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Valider</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>142</x>
|
||||
<y>55</y>
|
||||
<width>131</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>16</y>
|
||||
<width>241</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>validate_button</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>WeekOption</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>313</x>
|
||||
<y>132</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>185</x>
|
||||
<y>79</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "welcome.h"
|
||||
#include "ui_welcome.h"
|
||||
|
||||
Welcome::Welcome(Week wtemplate, QWidget *parent) :
|
||||
Welcome::Welcome(Week *wtemplate, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::Welcome)
|
||||
{
|
||||
@@ -34,43 +34,39 @@ Week Welcome::get_result() {
|
||||
}
|
||||
|
||||
void Welcome::set_value_to_widget() {
|
||||
ui->mon_time_label->setText(Tools::double_to_string_time(w.getMon().get_total()));
|
||||
ui->tue_time_label->setText(Tools::double_to_string_time(w.getTue().get_total()));
|
||||
ui->wed_time_label->setText(Tools::double_to_string_time(w.getWed().get_total()));
|
||||
ui->thu_time_label->setText(Tools::double_to_string_time(w.getThu().get_total()));
|
||||
ui->fri_time_label->setText(Tools::double_to_string_time(w.getFri().get_total()));
|
||||
ui->total->setText(Tools::double_to_string_time(w.total()));
|
||||
ui->mon_time_label->setText(Tools::double_to_string_time(w->getMon()->get_total()));
|
||||
ui->tue_time_label->setText(Tools::double_to_string_time(w->getTue()->get_total()));
|
||||
ui->wed_time_label->setText(Tools::double_to_string_time(w->getWed()->get_total()));
|
||||
ui->thu_time_label->setText(Tools::double_to_string_time(w->getThu()->get_total()));
|
||||
ui->fri_time_label->setText(Tools::double_to_string_time(w->getFri()->get_total()));
|
||||
ui->total->setText(Tools::double_to_string_time(w->total()));
|
||||
}
|
||||
|
||||
void Welcome::edit() {
|
||||
QString name = QObject::sender()->objectName();
|
||||
switch (get_identifier(name)) {
|
||||
case mon:
|
||||
w.setMon(modify_value(w.getMon()));
|
||||
modify_value(w->getMon());
|
||||
break;
|
||||
case tue:
|
||||
w.setTue(modify_value(w.getTue()));
|
||||
modify_value(w->getTue());
|
||||
break;
|
||||
case wed:
|
||||
w.setWed(modify_value(w.getWed()));
|
||||
modify_value(w->getWed());
|
||||
break;
|
||||
case thu:
|
||||
w.setThu(modify_value(w.getThu()));
|
||||
modify_value(w->getThu());
|
||||
break;
|
||||
case fri:
|
||||
w.setFri(modify_value(w.getFri()));
|
||||
modify_value(w->getFri());
|
||||
break;
|
||||
}
|
||||
set_value_to_widget();
|
||||
}
|
||||
|
||||
Day Welcome::modify_value(Day d) {
|
||||
void Welcome::modify_value(Day *d) {
|
||||
SetDayDialog sdd(d, true, this);
|
||||
int result = sdd.exec();
|
||||
if (result == QDialog::Accepted) {
|
||||
return sdd.get_result();
|
||||
}
|
||||
return d;
|
||||
sdd.exec();
|
||||
}
|
||||
|
||||
Identifier Welcome::get_identifier(QString objectName) {
|
||||
|
||||
@@ -28,7 +28,7 @@ class Welcome : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Welcome(Week tpl, QWidget *parent = nullptr);
|
||||
explicit Welcome(Week *tpl, QWidget *parent = nullptr);
|
||||
~Welcome();
|
||||
|
||||
Week get_result();
|
||||
@@ -36,13 +36,13 @@ public:
|
||||
private:
|
||||
Ui::Welcome *ui;
|
||||
|
||||
Week w;
|
||||
Week *w;
|
||||
QMap<QString, Identifier> objectId;
|
||||
|
||||
void init();
|
||||
void set_value_to_widget();
|
||||
Identifier get_identifier(QString objectName);
|
||||
Day modify_value(Day);
|
||||
void modify_value(Day*);
|
||||
|
||||
public slots:
|
||||
void edit();
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<x>230</x>
|
||||
<y>9</y>
|
||||
<width>20</width>
|
||||
<height>81</height>
|
||||
@@ -54,9 +54,9 @@
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>209</x>
|
||||
<x>249</x>
|
||||
<y>19</y>
|
||||
<width>151</width>
|
||||
<width>155</width>
|
||||
<height>62</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -94,7 +94,7 @@
|
||||
<string notr="true">font-size: 14px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Retard</string>
|
||||
<string>Retard (Total)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -118,7 +118,7 @@ color: white;</string>
|
||||
<rect>
|
||||
<x>13</x>
|
||||
<y>19</y>
|
||||
<width>161</width>
|
||||
<width>210</width>
|
||||
<height>62</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -156,7 +156,7 @@ color: white;</string>
|
||||
<string notr="true">font-size: 14px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Temps total</string>
|
||||
<string>Temps total (Semaine)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -178,7 +178,7 @@ color: white;</string>
|
||||
<widget class="QWidget" name="layoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>400</x>
|
||||
<x>440</x>
|
||||
<y>20</y>
|
||||
<width>161</width>
|
||||
<height>62</height>
|
||||
@@ -218,7 +218,7 @@ color: white;</string>
|
||||
<string notr="true">font-size: 14px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Avance</string>
|
||||
<string>Avance (Total)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -240,7 +240,7 @@ color: white;</string>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>380</x>
|
||||
<x>420</x>
|
||||
<y>10</y>
|
||||
<width>20</width>
|
||||
<height>81</height>
|
||||
@@ -1570,10 +1570,10 @@ font-size: 22px;</string>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>790</x>
|
||||
<y>20</y>
|
||||
<x>800</x>
|
||||
<y>10</y>
|
||||
<width>111</width>
|
||||
<height>60</height>
|
||||
<height>90</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@@ -1633,6 +1633,16 @@ font-size: 22px;</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="today_button">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Aujourd'hui</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="Line" name="line_27">
|
||||
@@ -1648,6 +1658,19 @@ font-size: 22px;</string>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="week_options_button">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>570</x>
|
||||
<y>530</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>layoutWidget</zorder>
|
||||
<zorder>line</zorder>
|
||||
<zorder>layoutWidget</zorder>
|
||||
@@ -1658,6 +1681,7 @@ font-size: 22px;</string>
|
||||
<zorder>layoutWidget</zorder>
|
||||
<zorder>aboutButton</zorder>
|
||||
<zorder>line_27</zorder>
|
||||
<zorder>week_options_button</zorder>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
@@ -316,22 +316,5 @@ color: rgb(255, 255, 255);</string>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>SetDayDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>357</x>
|
||||
<y>151</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>209</x>
|
||||
<y>88</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user