diff --git a/images/dark/screenshot.svg b/images/dark/screenshot.svg new file mode 100644 index 0000000..ca698da --- /dev/null +++ b/images/dark/screenshot.svg @@ -0,0 +1,9 @@ + + + + + + + diff --git a/images/light/screenshot.svg b/images/light/screenshot.svg new file mode 100644 index 0000000..faf1e13 --- /dev/null +++ b/images/light/screenshot.svg @@ -0,0 +1,9 @@ + + + + + + + diff --git a/qml.qrc b/qml.qrc index 9061b67..e21fa54 100644 --- a/qml.qrc +++ b/qml.qrc @@ -123,5 +123,7 @@ images/dark/system-shutdown.svg images/dark/system-suspend.svg qml/StandardCard.qml + images/light/screenshot.svg + images/dark/screenshot.svg diff --git a/qml/CardItem.qml b/qml/CardItem.qml index 142ad06..69cd688 100644 --- a/qml/CardItem.qml +++ b/qml/CardItem.qml @@ -52,6 +52,10 @@ Item { acceptedButtons: Qt.LeftButton onClicked: control.clicked() + onPressedChanged: { + imageItem.scale = pressed ? 0.95 : 1.0 + } + onPressAndHold: { control.pressAndHold() } @@ -68,11 +72,19 @@ Item { } Item { + id: imageItem Layout.preferredWidth: 28 + FishUI.Units.largeSpacing * 2 Layout.preferredHeight: 28 + FishUI.Units.largeSpacing * 2 Layout.alignment: Qt.AlignHCenter + Behavior on scale { + NumberAnimation { + duration: 200 + easing.type: Easing.OutSine + } + } + Rectangle { anchors.fill: parent radius: height / 2 @@ -114,6 +126,9 @@ Item { // color: control.checked ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor Layout.preferredHeight: control.height * 0.15 Layout.alignment: Qt.AlignHCenter + horizontalAlignment: Qt.AlignHCenter + Layout.fillWidth: true + elide: Text.ElideMiddle visible: text } diff --git a/qml/ControlCenter.qml b/qml/ControlCenter.qml index f8a01bf..8ca9385 100644 --- a/qml/ControlCenter.qml +++ b/qml/ControlCenter.qml @@ -201,21 +201,33 @@ ControlCenterDialog { Item { id: cardItems Layout.fillWidth: true - height: 110 + Layout.preferredHeight: Math.ceil(cardLayout.count / 4) * 110 - property var cellWidth: cardItems.width / 3 + property var cellWidth: cardItems.width / 4 Rectangle { anchors.fill: parent color: FishUI.Theme.darkMode ? "#AEAEAE" : "white" radius: FishUI.Theme.bigRadius - opacity: 0.8 + opacity: 0.7 } GridLayout { + id: cardLayout anchors.fill: parent columnSpacing: 0 - columns: 3 + columns: 4 + + property int count: { + var count = 0 + + for (var i in cardLayout.children) { + if (cardLayout.children[i].visible) + ++count + } + + return count + } CardItem { id: wirelessItem @@ -259,6 +271,19 @@ ControlCenterDialog { label: qsTr("Dark Mode") onClicked: appearance.switchDarkMode(!FishUI.Theme.darkMode) } + + CardItem { + Layout.fillHeight: true + Layout.preferredWidth: cardItems.cellWidth + icon: FishUI.Theme.darkMode || checked ? "qrc:/images/dark/screenshot.svg" + : "qrc:/images/light/screenshot.svg" + checked: false + label: qsTr("Screenshot") + onClicked: { + control.visible = false + process.startDetached("cutefish-screenshot", ["-d", "500"]) + } + } } } @@ -390,6 +415,8 @@ ControlCenterDialog { } RowLayout { + Layout.leftMargin: FishUI.Units.smallSpacing + Layout.rightMargin: FishUI.Units.smallSpacing spacing: 0 Label { diff --git a/translations/en_US.ts b/translations/en_US.ts index bb6ad82..63e71ad 100644 --- a/translations/en_US.ts +++ b/translations/en_US.ts @@ -12,25 +12,30 @@ ControlCenter - + Wi-Fi - + Control Center - + Bluetooth - + Dark Mode + + + Screenshot + + ShutdownDialog diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index d3eddfe..1227551 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -12,25 +12,30 @@ ControlCenter - + Wi-Fi 无线网络 - + Control Center 控制中心 - + Bluetooth 蓝牙 - + Dark Mode 深色模式 + + + Screenshot + 截图 + ShutdownDialog