ControlDialog: Symmetrical widgets

pull/7/head
revenmartin 5 years ago
parent df46a93ec6
commit 7c52ae5db1

@ -10,13 +10,9 @@ import FishUI 1.0 as FishUI
ControlCenterDialog { ControlCenterDialog {
id: control id: control
width: 450
height: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2
minimumWidth: 450 width: 500
maximumWidth: 450 height: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 3
minimumHeight: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2
maximumHeight: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2
property var margin: 4 * Screen.devicePixelRatio property var margin: 4 * Screen.devicePixelRatio
property point position: Qt.point(0, 0) property point position: Qt.point(0, 0)
@ -80,7 +76,7 @@ ControlCenterDialog {
anchors.topMargin: FishUI.Units.largeSpacing * 1.5 anchors.topMargin: FishUI.Units.largeSpacing * 1.5
anchors.rightMargin: FishUI.Units.largeSpacing * 1.5 anchors.rightMargin: FishUI.Units.largeSpacing * 1.5
anchors.bottomMargin: FishUI.Units.largeSpacing anchors.bottomMargin: FishUI.Units.largeSpacing
spacing: FishUI.Units.largeSpacing spacing: FishUI.Units.largeSpacing * 1.5
Item { Item {
id: topItem id: topItem
@ -148,7 +144,7 @@ ControlCenterDialog {
} }
Item { Item {
id: controlItem id: cardItems
Layout.fillWidth: true Layout.fillWidth: true
height: 110 height: 110
visible: wirelessItem.visible || bluetoothItem.visible visible: wirelessItem.visible || bluetoothItem.visible
@ -160,7 +156,7 @@ ControlCenterDialog {
CardItem { CardItem {
id: wirelessItem id: wirelessItem
Layout.fillHeight: true 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" icon: FishUI.Theme.darkMode || checked ? "qrc:/images/dark/network-wireless-connected-100.svg"
: "qrc:/images/light/network-wireless-connected-100.svg" : "qrc:/images/light/network-wireless-connected-100.svg"
visible: network.wirelessHardwareEnabled visible: network.wirelessHardwareEnabled
@ -175,7 +171,7 @@ ControlCenterDialog {
CardItem { CardItem {
id: bluetoothItem id: bluetoothItem
Layout.fillHeight: true 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" icon: FishUI.Theme.darkMode || checked ? "qrc:/images/dark/bluetooth-symbolic.svg"
: "qrc:/images/light/bluetooth-symbolic.svg" : "qrc:/images/light/bluetooth-symbolic.svg"
checked: false checked: false
@ -186,7 +182,7 @@ ControlCenterDialog {
CardItem { CardItem {
id: darkModeItem id: darkModeItem
Layout.fillHeight: true 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" icon: FishUI.Theme.darkMode || checked ? "qrc:/images/dark/dark-mode.svg"
: "qrc:/images/light/dark-mode.svg" : "qrc:/images/light/dark-mode.svg"
checked: FishUI.Theme.darkMode checked: FishUI.Theme.darkMode
@ -194,10 +190,6 @@ ControlCenterDialog {
text: FishUI.Theme.darkMode ? qsTr("On") : qsTr("Off") text: FishUI.Theme.darkMode ? qsTr("On") : qsTr("Off")
onClicked: appearance.switchDarkMode(!FishUI.Theme.darkMode) onClicked: appearance.switchDarkMode(!FishUI.Theme.darkMode)
} }
Item {
Layout.fillWidth: true
}
} }
} }
@ -295,8 +287,11 @@ ControlCenterDialog {
} }
RowLayout { RowLayout {
spacing: 0
Label { Label {
id: timeLabel id: timeLabel
leftPadding: FishUI.Units.smallSpacing / 2
Timer { Timer {
interval: 1000 interval: 1000
@ -341,6 +336,7 @@ ControlCenterDialog {
Label { Label {
text: battery.chargePercent + "%" text: battery.chargePercent + "%"
color: FishUI.Theme.textColor color: FishUI.Theme.textColor
rightPadding: FishUI.Units.smallSpacing / 2
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
} }
} }

@ -59,12 +59,5 @@ Item {
return "transparent" return "transparent"
} }
Behavior on color {
ColorAnimation {
duration: 125
easing.type: Easing.InOutCubic
}
}
} }
} }

@ -16,7 +16,7 @@ Item {
id: background id: background
anchors.fill: parent anchors.fill: parent
color: FishUI.Theme.backgroundColor color: FishUI.Theme.backgroundColor
opacity: FishUI.Theme.darkMode ? 0.6 : 0.8 opacity: FishUI.Theme.darkMode ? 0.6 : 0.7
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {

@ -203,6 +203,12 @@ QStringList CApplications::commandFromPid(quint32 pid)
cmd.replace('\0', ' '); cmd.replace('\0', ' ');
QString command = QString::fromLocal8Bit(cmd).trimmed(); QString command = QString::fromLocal8Bit(cmd).trimmed();
// There may be parameters.
if (command.split(' ').size() > 1) {
command = command.split(' ').first();
}
return { command, name }; return { command, name };
} }
} }

Loading…
Cancel
Save