整理对话框布局。
This commit is contained in:
parent
e3d599fdf7
commit
aa3f4ebb29
@ -558,9 +558,6 @@ QString DeviceConnection::handleCommand(const std::string_view &replyText, const
|
||||
} else if (value == "2") {
|
||||
LOG(info) << "md5 check finished";
|
||||
m_otaProgress = 99;
|
||||
if (m_otaTimer != nullptr) {
|
||||
m_otaTimer->stop();
|
||||
}
|
||||
emit otaProgressChanged(true, m_otaProgress, "设备正在升级中,请稍后......");
|
||||
QTimer::singleShot(0, this, [this]() {
|
||||
m_commandSocket->close(); // 等待设备重新上线后,发起广播。由搜索服务触发重连
|
||||
|
@ -99,14 +99,6 @@ std::shared_ptr<DeviceConnection> DeviceListModel::device(int index) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool DeviceListModel::deviceConnected(int index) {
|
||||
bool ret = false;
|
||||
if (index >= 0 && index < m_devices.size()) {
|
||||
ret = m_devices.at(index)->isConnected();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DeviceListModel::startSearchDevice() {
|
||||
if (m_timerId >= 0) {
|
||||
LOG(error) << "app is searching device.";
|
||||
|
@ -31,7 +31,6 @@ public:
|
||||
QHash<int, QByteArray> roleNames() const final;
|
||||
Q_INVOKABLE QVariantMap get(int index) const;
|
||||
std::shared_ptr<DeviceConnection> device(int index);
|
||||
Q_INVOKABLE bool deviceConnected(int index);
|
||||
void startSearchDevice();
|
||||
bool isSearching() const;
|
||||
float searchProgress() const;
|
||||
|
14
qml/Main.qml
14
qml/Main.qml
@ -22,7 +22,7 @@ ApplicationWindow {
|
||||
deviceList.currentIndex = -1
|
||||
App.startSearchDevice()
|
||||
App.collector.stop() // 停止数据采集
|
||||
App.collector.path=""
|
||||
App.collector.path = ""
|
||||
}
|
||||
}
|
||||
Label {
|
||||
@ -80,7 +80,9 @@ ApplicationWindow {
|
||||
deviceList.currentIndex = index
|
||||
}
|
||||
onDoubleClicked: {
|
||||
if (App.devices.deviceConnected(index)) {
|
||||
if (!softwareVersion.includes("R003")) {
|
||||
showMessageDialog(2, "网络设置", "当前设备不支持有线网络设置!")
|
||||
} else if (onlineStatus) {
|
||||
networkPopup.open()
|
||||
} else {
|
||||
showMessageDialog(2, "网络设置", "设备已离线!")
|
||||
@ -91,7 +93,7 @@ ApplicationWindow {
|
||||
onCurrentIndexChanged: {
|
||||
App.connectToDevice(deviceList.currentIndex)
|
||||
App.collector.stop() // 停止数据采集
|
||||
App.collector.path=""
|
||||
App.collector.path = ""
|
||||
}
|
||||
ProgressBar {
|
||||
anchors.left: parent.left
|
||||
@ -180,7 +182,6 @@ ApplicationWindow {
|
||||
if (component.status === Component.Ready) {
|
||||
let dialog = component.createObject(window, {
|
||||
"type": type,
|
||||
"height": 200,
|
||||
"titleText": title,
|
||||
"text": message
|
||||
})
|
||||
@ -188,7 +189,7 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
function showFileDialog(nameFilters,onSelected){
|
||||
function showFileDialog(nameFilters, onSelected) {
|
||||
let dialog = null
|
||||
if (isQt5) {
|
||||
dialog = Qt.createQmlObject("import QtQuick.Dialogs 1.3; FileDialog {}", window, "myDynamicSnippet")
|
||||
@ -200,8 +201,7 @@ ApplicationWindow {
|
||||
dialog.visible = true
|
||||
dialog.accepted.connect(function () {
|
||||
let fileUrl = isQt5 ? dialog.fileUrl.toString() : dialog.selectedFile.toString()
|
||||
let localFilePath = fileUrl.startsWith(
|
||||
"file:///") ? fileUrl.substring(8) : fileUrl
|
||||
let localFilePath = fileUrl.startsWith("file:///") ? fileUrl.substring(8) : fileUrl
|
||||
onSelected(localFilePath)
|
||||
dialog.destroy()
|
||||
})
|
||||
|
@ -1,9 +1,11 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
Dialog {
|
||||
id: control
|
||||
width: 320
|
||||
padding: 30
|
||||
parent: Overlay.overlay
|
||||
anchors.centerIn: Overlay.overlay
|
||||
modal: true
|
||||
@ -21,46 +23,37 @@ Dialog {
|
||||
Warning,
|
||||
Failed
|
||||
}
|
||||
contentItem: ColumnLayout {
|
||||
id: layout
|
||||
IconButton {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 7
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 10
|
||||
Layout.leftMargin: 30
|
||||
Layout.rightMargin: 6
|
||||
Layout.alignment: Qt.AlignRight
|
||||
source: "../resources/popup_close.svg"
|
||||
onClicked: control.close()
|
||||
}
|
||||
RowLayout {
|
||||
Layout.leftMargin: 30
|
||||
Image {
|
||||
id: image
|
||||
Layout.rightMargin: 6
|
||||
width: 18
|
||||
height: 18
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 30
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 40
|
||||
source: "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: titleLabel
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 60
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 40
|
||||
font.family: control.font.family
|
||||
font.pixelSize: 16
|
||||
color: "#0A1F44"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
}
|
||||
Label {
|
||||
id: textLabel
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 60
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 40
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 76
|
||||
Layout.leftMargin: 30 + image.width+image.Layout.rightMargin+layout.spacing
|
||||
Layout.maximumWidth: control.width-Layout.leftMargin-control.rightPadding-control.rightInset-50
|
||||
font.family: control.font.family
|
||||
font.pixelSize: 14
|
||||
color: "#53627C"
|
||||
@ -71,12 +64,10 @@ Dialog {
|
||||
|
||||
Button {
|
||||
id: cancelButton
|
||||
width: 72
|
||||
height: 40
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 15
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 15
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Layout.rightMargin: 6
|
||||
Layout.preferredWidth: 72
|
||||
Layout.preferredHeight: 40
|
||||
font.family: control.font.family
|
||||
text: "关闭"
|
||||
font.pixelSize: 14
|
||||
@ -96,12 +87,13 @@ Dialog {
|
||||
}
|
||||
onClicked: control.reject()
|
||||
}
|
||||
}
|
||||
onTypeChanged: {
|
||||
if (type === MessageDialog.Type.Successful || type === MessageDialog.Type.Ok) {
|
||||
image.source = "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg"
|
||||
} else if (type === MessageDialog.Type.Warning) {
|
||||
image.source = "qrc:/qt/qml/AntiClipSettings/resources/warning.svg"
|
||||
} else if(type === MessageDialog.Type.Failed){
|
||||
} else if (type === MessageDialog.Type.Failed) {
|
||||
image.source = "qrc:/qt/qml/AntiClipSettings/resources/prompt_delete.svg"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user