兼容Qt5。
This commit is contained in:
parent
f4c6a048f5
commit
a43b65f513
@ -1,4 +1,4 @@
|
||||
#include "Application.h"
|
||||
#include "Application.h"
|
||||
#include "BoostLog.h"
|
||||
#include "Configuration.h"
|
||||
#include "H264Palyer.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifndef APPLICATION_H
|
||||
#ifndef APPLICATION_H
|
||||
#define APPLICATION_H
|
||||
|
||||
#include "DataCollection.h"
|
||||
|
@ -20,6 +20,8 @@ if (Qt6_FOUND)
|
||||
BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN10
|
||||
)
|
||||
else()
|
||||
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(BOOST_ROOT ${Libraries_ROOT}/boost_1_83_0_msvc2022_64bit)
|
||||
|
@ -1,3 +1,3 @@
|
||||
#define APPLICATION_NAME "@APPLICATION_NAME@"
|
||||
#define APPLICATION_NAME "@APPLICATION_NAME@"
|
||||
#define GIT_COMMIT_ID "@GIT_COMMIT_ID@"
|
||||
#define APP_VERSION "@PROJECT_VERSION@"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifndef __DATASTRUCTURE_H__
|
||||
#ifndef __DATASTRUCTURE_H__
|
||||
#define __DATASTRUCTURE_H__
|
||||
|
||||
#include <QObject>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "DeviceConnection.h"
|
||||
#include "DeviceConnection.h"
|
||||
#include "BoostLog.h"
|
||||
#include "StringUtility.h"
|
||||
#include <QPointF>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifndef DEVICECONNECTION_H
|
||||
#ifndef DEVICECONNECTION_H
|
||||
#define DEVICECONNECTION_H
|
||||
|
||||
#include "DataStructure.h"
|
||||
|
@ -9,9 +9,10 @@ Column {
|
||||
property bool canEmpty: false
|
||||
property var regularExpression : /^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$/
|
||||
TextField {
|
||||
height: 36
|
||||
height: 40
|
||||
width: 350
|
||||
id: input
|
||||
selectByMouse: true
|
||||
onTextChanged: {
|
||||
validate()
|
||||
}
|
||||
|
34
qml/Main.qml
34
qml/Main.qml
@ -1,5 +1,6 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Controls.Material 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import AntiClipSettings 1.0
|
||||
|
||||
@ -76,7 +77,7 @@ ApplicationWindow {
|
||||
deviceList.currentIndex = index
|
||||
}
|
||||
onDoubleClicked: {
|
||||
if(App.devices.deviceConnected(index)){
|
||||
if (App.devices.deviceConnected(index)) {
|
||||
networkPopup.open()
|
||||
} else {
|
||||
showMessageDialog(2, "网络设置", "设备已离线!")
|
||||
@ -141,7 +142,7 @@ ApplicationWindow {
|
||||
return
|
||||
}
|
||||
if (App.collector.path.length <= 0) {
|
||||
showFolderDialog((folder)=>{
|
||||
showFolderDialog(folder => {
|
||||
App.collector.path = folder
|
||||
App.collector.start(App.devices.get(deviceList.currentIndex).ip)
|
||||
})
|
||||
@ -183,19 +184,24 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
function showFolderDialog(onSelected){
|
||||
var dialog = Qt.createQmlObject("import QtQuick.Dialogs; FolderDialog {}",window,"myDynamicSnippet");
|
||||
if (dialog) {
|
||||
dialog.visible = true;
|
||||
dialog.accepted.connect(function() {
|
||||
onSelected(dialog.selectedFolder)
|
||||
dialog.destroy();
|
||||
});
|
||||
dialog.rejected.connect(function() {
|
||||
dialog.destroy();
|
||||
});
|
||||
function showFolderDialog(onSelected) {
|
||||
let dialog = null
|
||||
if (isQt5) {
|
||||
dialog = Qt.createQmlObject("import Qt.labs.platform 1.1; FolderDialog {}", window, "myDynamicSnippet")
|
||||
} else {
|
||||
console.error("Failed to create FolderDialog object");
|
||||
dialog = Qt.createQmlObject("import QtQuick.Dialogs; FolderDialog {}", window, "myDynamicSnippet")
|
||||
}
|
||||
if (dialog) {
|
||||
dialog.visible = true
|
||||
dialog.accepted.connect(function () {
|
||||
onSelected(isQt5 ? dialog.folder : dialog.selectedFolder)
|
||||
dialog.destroy()
|
||||
})
|
||||
dialog.rejected.connect(function () {
|
||||
dialog.destroy()
|
||||
})
|
||||
} else {
|
||||
console.error("Failed to create FolderDialog object")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Dialogs
|
||||
import QtQuick.Dialogs 1.3
|
||||
import AntiClipSettings 1.0
|
||||
|
||||
Popup {
|
||||
@ -26,10 +26,10 @@ Popup {
|
||||
IconButton {
|
||||
source: "../resources/popup_close.svg"
|
||||
onClicked: {
|
||||
if(otaFinished){
|
||||
if (otaFinished) {
|
||||
root.close()
|
||||
}else{
|
||||
showMessageDialog(2,"OTA升级","设备正在升级中,请耐心等待...")
|
||||
} else {
|
||||
showMessageDialog(2, "OTA升级", "设备正在升级中,请耐心等待...")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,14 +97,14 @@ Popup {
|
||||
nameFilters: ["OTA文件 (*.bin)"]
|
||||
|
||||
onAccepted: {
|
||||
var fileUrl = fileDialog.selectedFile.toString()
|
||||
let fileUrl = isQt5 ? fileDialog.fileUrl.toString() : fileDialog.selectedFile.toString()
|
||||
var localFilePath = fileUrl.startsWith(
|
||||
"file:///") ? fileUrl.substring(8) : fileUrl
|
||||
otaFile.text = localFilePath
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if(!isQt5){
|
||||
currentFolder= StandardPaths.standardLocations(
|
||||
if (!isQt5) {
|
||||
currentFolder = StandardPaths.standardLocations(
|
||||
StandardPaths.DesktopLocation)[0]
|
||||
}
|
||||
}
|
||||
@ -112,19 +112,20 @@ Popup {
|
||||
|
||||
Connections {
|
||||
target: App
|
||||
function onCurrentDeviceOtaProgressChanged (status, progress, message) {
|
||||
if(progress<0)progress=0
|
||||
otaFinished = !status || (progress>=100)
|
||||
function onCurrentDeviceOtaProgressChanged(status, progress, message) {
|
||||
if (progress < 0)
|
||||
progress = 0
|
||||
otaFinished = !status || (progress >= 100)
|
||||
progressBar.value = progress
|
||||
progressText.text = `${progress}%`
|
||||
otaMessage.text = message
|
||||
if(progress>=100){
|
||||
if (progress >= 100) {
|
||||
otaMessage.color = "green"
|
||||
}
|
||||
}
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if(!visible){
|
||||
if (!visible) {
|
||||
progressBar.value = 0
|
||||
otaMessage.color = "black"
|
||||
progressText.text = "0%"
|
||||
|
Loading…
Reference in New Issue
Block a user