From f74081a06ac5ebcfef65dcddfc3c48e644c5ef0e Mon Sep 17 00:00:00 2001 From: amass <168062547@qq.com> Date: Thu, 5 Sep 2024 22:33:07 +0800 Subject: [PATCH] adapt linux. --- Analyser/CMakeLists.txt | 7 ++++++- Analyser/ModuleCommunication.cpp | 3 +++ Analyser/VideoPlayer.cpp | 4 ++-- Analyser/main.cpp | 1 - Analyser/qml/Main.qml | 6 ++---- Peripheral/CMakeLists.txt | 5 +---- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Analyser/CMakeLists.txt b/Analyser/CMakeLists.txt index e778631..4aa1e6f 100644 --- a/Analyser/CMakeLists.txt +++ b/Analyser/CMakeLists.txt @@ -36,6 +36,11 @@ target_compile_definitions(Analyser PRIVATE _CRT_SECURE_NO_WARNINGS ) +if(UNIX) + set_target_properties(Analyser PROPERTIES + SUFFIX .AppImage + ) +endif() if(CMAKE_BUILD_TYPE STREQUAL "Release") set_property(TARGET Analyser PROPERTY WIN32_EXECUTABLE true @@ -56,13 +61,13 @@ target_link_libraries(Analyser PRIVATE Fluentplugin PRIVATE Encrypt PRIVATE Database - PRIVATE Ws2_32 PRIVATE Peripheral PRIVATE avcodec PRIVATE swscale PRIVATE avutil PRIVATE avdevice PRIVATE avformat + $<$:Ws2_32> PRIVATE Qt${QT_VERSION_MAJOR}::Quick PRIVATE Qt${QT_VERSION_MAJOR}::QuickTemplates2 PRIVATE Qt${QT_VERSION_MAJOR}::SerialPort diff --git a/Analyser/ModuleCommunication.cpp b/Analyser/ModuleCommunication.cpp index f46ceca..82f1311 100644 --- a/Analyser/ModuleCommunication.cpp +++ b/Analyser/ModuleCommunication.cpp @@ -5,6 +5,8 @@ #include #ifdef WIN32 #include +#else +#include #endif static inline uint8_t xor_checksum_byte(const uint8_t *data, uint32_t len) { @@ -19,6 +21,7 @@ ModuleCommunication::ModuleCommunication(QObject *parent) : QObject{parent} { } bool ModuleCommunication::open(const QString &portName, int baudRate) { + if (portName.isEmpty()) return false; bool ret = true; m_serialPort = std::make_shared(portName); m_serialPort->setBaudRate(baudRate); diff --git a/Analyser/VideoPlayer.cpp b/Analyser/VideoPlayer.cpp index 2de211b..80f9b74 100644 --- a/Analyser/VideoPlayer.cpp +++ b/Analyser/VideoPlayer.cpp @@ -2,8 +2,8 @@ #include "BoostLog.h" #include extern "C" { -#include "libavdevice/avdevice.h" -#include "libavformat/avformat.h" +#include +#include } VideoPlayer::VideoPlayer() { diff --git a/Analyser/main.cpp b/Analyser/main.cpp index ad20f62..d28978f 100644 --- a/Analyser/main.cpp +++ b/Analyser/main.cpp @@ -1,7 +1,6 @@ #include "Application.h" #include "BoostLog.h" #include "Configuration.h" -#include "DeviceDiscovery.h" #include int main(int argc, char *argv[]) { diff --git a/Analyser/qml/Main.qml b/Analyser/qml/Main.qml index 1f6a80c..8df45bb 100644 --- a/Analyser/qml/Main.qml +++ b/Analyser/qml/Main.qml @@ -116,10 +116,8 @@ Window { info_bar.showSuccess(tip,2000,detailMessage) } else if (level === App.Warnging) { info_bar.showWarning(tip,2000,detailMessage) - } else if (level === 1) { - statusTip.icon = "../resources/warning.svg" - statusTip.color = "#FAFAD2" - statusTip.show(tip, 2000) + } else if (level === App.Error) { + info_bar.showError(tip,2000,detailMessage) } else if (level === 2) { info_bar.showInfo(tip,2000,detailMessage) resultBrowser.append(tip+":"+detailMessage) diff --git a/Peripheral/CMakeLists.txt b/Peripheral/CMakeLists.txt index e266180..3e49664 100644 --- a/Peripheral/CMakeLists.txt +++ b/Peripheral/CMakeLists.txt @@ -15,9 +15,6 @@ target_include_directories(Peripheral target_link_libraries(Peripheral PUBLIC Universal PRIVATE Encrypt - PRIVATE Mfreadwrite - PRIVATE Mf - PRIVATE mfplat - PRIVATE mfuuid + $<$:Mfreadwrite Mf mfplat mfuuid> PRIVATE Qt${QT_VERSION_MAJOR}::SerialPort )