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