1.实现配置文件应用。

This commit is contained in:
luocai 2024-06-21 11:33:11 +08:00
parent d9a9815a89
commit bd97f3a380
6 changed files with 20 additions and 1 deletions

View File

@ -2,6 +2,7 @@
#include "AsyncEvent.h"
#include "BoostLog.h"
#include "CategoryLogSinkBackend.h"
#include "Configuration.h"
#include "Database.h"
#include "DeviceDiscovery.h"
#include "VideoFrameProvider.h"
@ -18,6 +19,7 @@
constexpr uint32_t ImageSliceSize = 2048;
Application::Application(int &argc, char **argv) : m_app(std::make_shared<QApplication>(argc, argv)) {
m_app->setApplicationVersion(QString("v%1_%2 build: %3 %4").arg(APP_VERSION, GIT_COMMIT_ID, __DATE__, __TIME__));
QFont font;
font.setPointSize(16);
m_app->setFont(font);

View File

@ -1,9 +1,13 @@
project(Analyser VERSION 0.2 LANGUAGES C CXX)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Quick QuickTemplates2 Widgets SerialPort)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Quick QuickTemplates2 Widgets SerialPort)
configure_file(Configuration.h.in Configuration.h)
add_executable(Analyser Analyser.rc
main.cpp
Application.h Application.cpp
@ -40,6 +44,7 @@ endif()
target_include_directories(Analyser
PRIVATE ${FFmpeg_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
)
target_link_directories(Analyser

View File

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

View File

@ -1,11 +1,15 @@
#include "Application.h"
#include "BoostLog.h"
#include "Configuration.h"
#include "DeviceDiscovery.h"
#include "Widget.h"
int main(int argc, char *argv[]) {
using namespace Amass;
boost::log::initialize("logs/app");
LOG(info) << "Compiled on: " << __DATE__ << " " << __TIME__ << std::endl;
LOG(info) << "Git commit ID: " << GIT_COMMIT_ID << std::endl;
LOG(info) << "Program version: " << APP_VERSION << std::endl;
auto app = Singleton<Application>::instance<Construct>(argc, argv);
app->initializeLogger();

View File

@ -7,7 +7,7 @@ Window {
width: 1120
height: 640
visible: true
title: qsTr("L015上位机工具")
title: qsTr("L015上位机工具 "+Qt.application.version)
OperationItem {
id: operationItem

View File

@ -19,6 +19,12 @@ set(FFmpeg_ROOT ${Libraries_ROOT}/ffmpeg-7.0.1-full_build-shared)
set(FFmpeg_INCLUDE_DIR ${FFmpeg_ROOT}/include)
set(FFmpeg_LIB_DIR ${FFmpeg_ROOT}/lib)
execute_process(
COMMAND D:/msys64/usr/bin/git rev-parse --short HEAD
OUTPUT_VARIABLE GIT_COMMIT_ID
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_subdirectory(${Projects_ROOT}/Kylin/Universal Universal)
add_subdirectory(${Projects_ROOT}/Kylin/Encrypt Encrypt)
add_subdirectory(${Projects_ROOT}/Kylin/QtComponets QtComponets)