diff --git a/.DS_Store b/.DS_Store index bd784f0..f69dba3 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Chronos.pro b/Chronos.pro index 545f10e..1632b66 100644 --- a/Chronos.pro +++ b/Chronos.pro @@ -1,17 +1,36 @@ QT += core gui -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 5): QT += widgets CONFIG += c++17 # remove possible other optimization flags -QMAKE_CXXFLAGS_RELEASE -= -O -QMAKE_CXXFLAGS_RELEASE -= -O1 -QMAKE_CXXFLAGS_RELEASE *= -O2 +win32 { + message("Build for Windows") + QMAKE_CXXFLAGS_RELEASE -= -O + QMAKE_CXXFLAGS_RELEASE -= -O1 + QMAKE_CXXFLAGS_RELEASE *= -O2 + + RC_ICONS = icon.ico +} + +macx { + message("Build for macOS") + ICON = icon.icns + QMAKE_INFO_PLIST = Info.plist + QMAKE_CXXFLAGS_RELEASE -= -O + QMAKE_CXXFLAGS_RELEASE -= -O1 + QMAKE_CXXFLAGS_RELEASE -= -O2 + QMAKE_CXXFLAGS_RELEASE *= -O3 + equals(QMAKE_APPLE_DEVICE_ARCHS, arm64) { + message("CPU Architecture : aarch64") + QMAKE_CXXFLAGS_RELEASE += -mcpu=apple-a14 + } +} # add the desired -O3 if not present, MinGW only # QMAKE_CXXFLAGS_RELEASE *= -O3 -RC_ICONS = icon.ico + # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings diff --git a/Chronos.pro.user b/Chronos.pro.user index efec190..2f32edf 100644 --- a/Chronos.pro.user +++ b/Chronos.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -144,7 +144,9 @@ true QtProjectManager.QMakeBuildStep false - + + arm-darwin-generic-mach_o-64bit + true @@ -244,7 +246,7 @@ true false true - /Volumes/Macintosh SSD/sources/Qt/build-Chronos-Qt_6_2_0_for_macOS-Debug/Chronos.app/Contents/MacOS + /Volumes/Macintosh SSD/sources/Qt/build-Chronos-Qt_6_2_0_for_macOS-Release/Chronos.app/Contents/MacOS 1 diff --git a/Info.plist b/Info.plist new file mode 100644 index 0000000..26ddb73 --- /dev/null +++ b/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleExecutable + Chronos + CFBundleIconFile + + CFBundleIdentifier + com.aureliedelhaie.Chronos + CFBundlePackageType + APPL + CFBundleSignature + ???? + LSMinimumSystemVersion + 10.14 + NSPrincipalClass + NSApplication + NSSupportsAutomaticGraphicsSwitching + + CFBundleIconFile + icon.icns + + diff --git a/icon.icns b/icon.icns new file mode 100644 index 0000000..ac4b2ff Binary files /dev/null and b/icon.icns differ diff --git a/sources/aboutbox.cpp b/sources/aboutbox.cpp index 9b68d69..fd62a7b 100644 --- a/sources/aboutbox.cpp +++ b/sources/aboutbox.cpp @@ -11,6 +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)); } AboutBox::~AboutBox() diff --git a/sources/aboutbox.h b/sources/aboutbox.h index d20317b..295a4b7 100644 --- a/sources/aboutbox.h +++ b/sources/aboutbox.h @@ -1,9 +1,12 @@ #ifndef ABOUTBOX_H #define ABOUTBOX_H +#define VERSION "2.0.0" + #include #include #include +#include namespace Ui { class AboutBox; diff --git a/sources/mainwindow.cpp b/sources/mainwindow.cpp index 400e623..841ac01 100644 --- a/sources/mainwindow.cpp +++ b/sources/mainwindow.cpp @@ -104,6 +104,10 @@ void MainWindow::open_save() { delete file; QJsonObject obj = QJsonDocument::fromJson(json.toUtf8()).object(); + if (obj[KEY_SAVE_FILE_VERSION] != SAVE_FILE_VERSION) { + panic_dialog("Your save file version does not match the supported version." + " Please update this file and restart the application"); + } week_template = Week::from_json(obj[KEY_TEMPLATE].toObject()); QJsonArray arr = obj[KEY_YEARS].toArray(); foreach (QJsonValue val, arr) { diff --git a/ui/aboutbox.ui b/ui/aboutbox.ui index 7838975..6ec0c11 100644 --- a/ui/aboutbox.ui +++ b/ui/aboutbox.ui @@ -166,32 +166,22 @@ background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:1, stop:0 rgb - + font-size: 12px; - Version: 2.0.0 + Version: ... - + font-size: 12px; - <html><head/><body><p>Made with Qt</p></body></html> - - - - - - - font-size: 12px; - - - <html><head/><body><p>Save Updater: Rust (<a href="https://github.com/mojitaurelie/chronos-save-updater"><span style=" text-decoration: underline; color:#0068da;">https://github.com/mojitaurelie/chronos-save-updater</span></a>)</p></body></html> + <html><head/><body><p>...</p></body></html>