From 7c52ae5db1d28f250d3c2c453ecd8cd99f31855e Mon Sep 17 00:00:00 2001 From: revenmartin Date: Tue, 25 May 2021 23:42:19 +0800 Subject: [PATCH] ControlDialog: Symmetrical widgets --- qml/ControlDialog.qml | 26 +++++++++++--------------- qml/StandardItem.qml | 7 ------- qml/main.qml | 2 +- src/capplications.cpp | 6 ++++++ 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/qml/ControlDialog.qml b/qml/ControlDialog.qml index 9cbc245..7fffd34 100644 --- a/qml/ControlDialog.qml +++ b/qml/ControlDialog.qml @@ -10,13 +10,9 @@ import FishUI 1.0 as FishUI ControlCenterDialog { id: control - width: 450 - height: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2 - minimumWidth: 450 - maximumWidth: 450 - minimumHeight: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2 - maximumHeight: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2 + width: 500 + height: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 3 property var margin: 4 * Screen.devicePixelRatio property point position: Qt.point(0, 0) @@ -80,7 +76,7 @@ ControlCenterDialog { anchors.topMargin: FishUI.Units.largeSpacing * 1.5 anchors.rightMargin: FishUI.Units.largeSpacing * 1.5 anchors.bottomMargin: FishUI.Units.largeSpacing - spacing: FishUI.Units.largeSpacing + spacing: FishUI.Units.largeSpacing * 1.5 Item { id: topItem @@ -148,7 +144,7 @@ ControlCenterDialog { } Item { - id: controlItem + id: cardItems Layout.fillWidth: true height: 110 visible: wirelessItem.visible || bluetoothItem.visible @@ -160,7 +156,7 @@ ControlCenterDialog { CardItem { id: wirelessItem Layout.fillHeight: true - Layout.preferredWidth: contentItem.width / 3 - FishUI.Units.largeSpacing * 2 + Layout.fillWidth: true icon: FishUI.Theme.darkMode || checked ? "qrc:/images/dark/network-wireless-connected-100.svg" : "qrc:/images/light/network-wireless-connected-100.svg" visible: network.wirelessHardwareEnabled @@ -175,7 +171,7 @@ ControlCenterDialog { CardItem { id: bluetoothItem Layout.fillHeight: true - Layout.preferredWidth: contentItem.width / 3 - FishUI.Units.largeSpacing * 2 + Layout.fillWidth: true icon: FishUI.Theme.darkMode || checked ? "qrc:/images/dark/bluetooth-symbolic.svg" : "qrc:/images/light/bluetooth-symbolic.svg" checked: false @@ -186,7 +182,7 @@ ControlCenterDialog { CardItem { id: darkModeItem Layout.fillHeight: true - Layout.preferredWidth: contentItem.width / 3 - FishUI.Units.largeSpacing * 2 + Layout.fillWidth: true icon: FishUI.Theme.darkMode || checked ? "qrc:/images/dark/dark-mode.svg" : "qrc:/images/light/dark-mode.svg" checked: FishUI.Theme.darkMode @@ -194,10 +190,6 @@ ControlCenterDialog { text: FishUI.Theme.darkMode ? qsTr("On") : qsTr("Off") onClicked: appearance.switchDarkMode(!FishUI.Theme.darkMode) } - - Item { - Layout.fillWidth: true - } } } @@ -295,8 +287,11 @@ ControlCenterDialog { } RowLayout { + spacing: 0 + Label { id: timeLabel + leftPadding: FishUI.Units.smallSpacing / 2 Timer { interval: 1000 @@ -341,6 +336,7 @@ ControlCenterDialog { Label { text: battery.chargePercent + "%" color: FishUI.Theme.textColor + rightPadding: FishUI.Units.smallSpacing / 2 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter } } diff --git a/qml/StandardItem.qml b/qml/StandardItem.qml index 4aabae1..ca78235 100644 --- a/qml/StandardItem.qml +++ b/qml/StandardItem.qml @@ -59,12 +59,5 @@ Item { return "transparent" } - - Behavior on color { - ColorAnimation { - duration: 125 - easing.type: Easing.InOutCubic - } - } } } diff --git a/qml/main.qml b/qml/main.qml index c7736fe..203a205 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -16,7 +16,7 @@ Item { id: background anchors.fill: parent color: FishUI.Theme.backgroundColor - opacity: FishUI.Theme.darkMode ? 0.6 : 0.8 + opacity: FishUI.Theme.darkMode ? 0.6 : 0.7 Behavior on color { ColorAnimation { diff --git a/src/capplications.cpp b/src/capplications.cpp index 1f480a5..cd3ed08 100644 --- a/src/capplications.cpp +++ b/src/capplications.cpp @@ -203,6 +203,12 @@ QStringList CApplications::commandFromPid(quint32 pid) cmd.replace('\0', ' '); QString command = QString::fromLocal8Bit(cmd).trimmed(); + + // There may be parameters. + if (command.split(' ').size() > 1) { + command = command.split(' ').first(); + } + return { command, name }; } }