show version for updater.
All checks were successful
Build Applications / Build (push) Successful in 6m12s
Windows CI / build (push) Successful in 7m58s

This commit is contained in:
luocai 2024-11-21 09:31:41 +08:00
parent fd72d00925
commit c846ae81a0
3 changed files with 16 additions and 1 deletions

View File

@ -1,9 +1,13 @@
set(APPLICATION_NAME "掌静脉升级工具")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets SerialPort)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets SerialPort)
configure_file(Configuration.h.in Configuration.h)
set(PROJECT_SOURCES OtaUpdate.rc
main.cpp
Widget.cpp
@ -15,6 +19,10 @@ qt_add_executable(SmartLockerUpdater
${PROJECT_SOURCES}
)
target_include_directories(SmartLockerUpdater
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(SmartLockerUpdater
PRIVATE Peripheral
PRIVATE Qt${QT_VERSION_MAJOR}::Widgets

View File

@ -0,0 +1,3 @@
#define APPLICATION_NAME "@APPLICATION_NAME@"
#define GIT_COMMIT_ID "@GIT_COMMIT_ID@"
#define APP_VERSION "@PROJECT_VERSION@"

View File

@ -1,4 +1,5 @@
#include "BoostLog.h"
#include "Configuration.h"
#include "Widget.h"
#include <QApplication>
#include <QFont>
@ -7,11 +8,14 @@ int main(int argc, char *argv[]) {
boost::log::initialize("logs/app");
QApplication a(argc, argv);
a.setApplicationName(APPLICATION_NAME);
a.setApplicationVersion(QString("v%1_%2 build: %3 %4").arg(APP_VERSION, GIT_COMMIT_ID, __DATE__, __TIME__));
QFont font;
font.setPointSize(16);
a.setFont(font);
Widget w;
w.setWindowTitle("掌静脉模组升级工具");
w.setWindowTitle(QString("%1 %2").arg(a.applicationName()).arg(a.applicationVersion()));
w.setMinimumWidth(520);
w.setMinimumHeight(100);
w.show();