整理对话框布局。

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") {
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(); // 等待设备重新上线后,发起广播。由搜索服务触发重连

View File

@ -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.";

View File

@ -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;

View File

@ -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, "网络设置", "设备已离线!")
@ -180,7 +182,6 @@ ApplicationWindow {
if (component.status === Component.Ready) {
let dialog = component.createObject(window, {
"type": type,
"height": 200,
"titleText": title,
"text": message
})
@ -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()
})

View File

@ -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,6 +87,7 @@ Dialog {
}
onClicked: control.reject()
}
}
onTypeChanged: {
if (type === MessageDialog.Type.Successful || type === MessageDialog.Type.Ok) {
image.source = "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg"