整理对话框布局。

This commit is contained in:
luocai 2024-08-30 14:47:03 +08:00
parent e3d599fdf7
commit aa3f4ebb29
5 changed files with 76 additions and 96 deletions

View File

@ -558,9 +558,6 @@ QString DeviceConnection::handleCommand(const std::string_view &replyText, const
} else if (value == "2") { } else if (value == "2") {
LOG(info) << "md5 check finished"; LOG(info) << "md5 check finished";
m_otaProgress = 99; m_otaProgress = 99;
if (m_otaTimer != nullptr) {
m_otaTimer->stop();
}
emit otaProgressChanged(true, m_otaProgress, "设备正在升级中,请稍后......"); emit otaProgressChanged(true, m_otaProgress, "设备正在升级中,请稍后......");
QTimer::singleShot(0, this, [this]() { QTimer::singleShot(0, this, [this]() {
m_commandSocket->close(); // 等待设备重新上线后,发起广播。由搜索服务触发重连 m_commandSocket->close(); // 等待设备重新上线后,发起广播。由搜索服务触发重连

View File

@ -99,14 +99,6 @@ std::shared_ptr<DeviceConnection> DeviceListModel::device(int index) {
return ret; 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() { void DeviceListModel::startSearchDevice() {
if (m_timerId >= 0) { if (m_timerId >= 0) {
LOG(error) << "app is searching device."; LOG(error) << "app is searching device.";

View File

@ -31,7 +31,6 @@ public:
QHash<int, QByteArray> roleNames() const final; QHash<int, QByteArray> roleNames() const final;
Q_INVOKABLE QVariantMap get(int index) const; Q_INVOKABLE QVariantMap get(int index) const;
std::shared_ptr<DeviceConnection> device(int index); std::shared_ptr<DeviceConnection> device(int index);
Q_INVOKABLE bool deviceConnected(int index);
void startSearchDevice(); void startSearchDevice();
bool isSearching() const; bool isSearching() const;
float searchProgress() const; float searchProgress() const;

View File

@ -80,7 +80,9 @@ ApplicationWindow {
deviceList.currentIndex = index deviceList.currentIndex = index
} }
onDoubleClicked: { onDoubleClicked: {
if (App.devices.deviceConnected(index)) { if (!softwareVersion.includes("R003")) {
showMessageDialog(2, "网络设置", "当前设备不支持有线网络设置!")
} else if (onlineStatus) {
networkPopup.open() networkPopup.open()
} else { } else {
showMessageDialog(2, "网络设置", "设备已离线!") showMessageDialog(2, "网络设置", "设备已离线!")
@ -180,7 +182,6 @@ ApplicationWindow {
if (component.status === Component.Ready) { if (component.status === Component.Ready) {
let dialog = component.createObject(window, { let dialog = component.createObject(window, {
"type": type, "type": type,
"height": 200,
"titleText": title, "titleText": title,
"text": message "text": message
}) })
@ -200,8 +201,7 @@ ApplicationWindow {
dialog.visible = true dialog.visible = true
dialog.accepted.connect(function () { dialog.accepted.connect(function () {
let fileUrl = isQt5 ? dialog.fileUrl.toString() : dialog.selectedFile.toString() let fileUrl = isQt5 ? dialog.fileUrl.toString() : dialog.selectedFile.toString()
let localFilePath = fileUrl.startsWith( let localFilePath = fileUrl.startsWith("file:///") ? fileUrl.substring(8) : fileUrl
"file:///") ? fileUrl.substring(8) : fileUrl
onSelected(localFilePath) onSelected(localFilePath)
dialog.destroy() dialog.destroy()
}) })

View File

@ -1,9 +1,11 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
Dialog { Dialog {
id: control id: control
width: 320 width: 320
padding: 30
parent: Overlay.overlay parent: Overlay.overlay
anchors.centerIn: Overlay.overlay anchors.centerIn: Overlay.overlay
modal: true modal: true
@ -21,46 +23,37 @@ Dialog {
Warning, Warning,
Failed Failed
} }
contentItem: ColumnLayout {
id: layout
IconButton { IconButton {
anchors.right: parent.right Layout.leftMargin: 30
anchors.rightMargin: 7 Layout.rightMargin: 6
anchors.top: parent.top Layout.alignment: Qt.AlignRight
anchors.topMargin: 10
source: "../resources/popup_close.svg" source: "../resources/popup_close.svg"
onClicked: control.close() onClicked: control.close()
} }
RowLayout {
Layout.leftMargin: 30
Image { Image {
id: image id: image
Layout.rightMargin: 6
width: 18 width: 18
height: 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" source: "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg"
} }
Text { Text {
id: titleLabel id: titleLabel
anchors.left: parent.left
anchors.leftMargin: 60
anchors.top: parent.top
anchors.topMargin: 40
font.family: control.font.family font.family: control.font.family
font.pixelSize: 16 font.pixelSize: 16
color: "#0A1F44" color: "#0A1F44"
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
}
Text { Label {
id: textLabel id: textLabel
anchors.left: parent.left Layout.leftMargin: 30 + image.width+image.Layout.rightMargin+layout.spacing
anchors.leftMargin: 60 Layout.maximumWidth: control.width-Layout.leftMargin-control.rightPadding-control.rightInset-50
anchors.right: parent.right
anchors.rightMargin: 40
anchors.top: parent.top
anchors.topMargin: 76
font.family: control.font.family font.family: control.font.family
font.pixelSize: 14 font.pixelSize: 14
color: "#53627C" color: "#53627C"
@ -71,12 +64,10 @@ Dialog {
Button { Button {
id: cancelButton id: cancelButton
width: 72 Layout.alignment: Qt.AlignRight
height: 40 Layout.rightMargin: 6
anchors.right: parent.right Layout.preferredWidth: 72
anchors.rightMargin: 15 Layout.preferredHeight: 40
anchors.bottom: parent.bottom
anchors.bottomMargin: 15
font.family: control.font.family font.family: control.font.family
text: "关闭" text: "关闭"
font.pixelSize: 14 font.pixelSize: 14
@ -96,6 +87,7 @@ Dialog {
} }
onClicked: control.reject() onClicked: control.reject()
} }
}
onTypeChanged: { onTypeChanged: {
if (type === MessageDialog.Type.Successful || type === MessageDialog.Type.Ok) { if (type === MessageDialog.Type.Successful || type === MessageDialog.Type.Ok) {
image.source = "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg" image.source = "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg"