From 40426b72bce9ea049839112c6b20adaafa4c1a0a Mon Sep 17 00:00:00 2001 From: reionwong Date: Fri, 25 Jun 2021 00:17:07 +0800 Subject: [PATCH] Hide if launchpad is encountered --- qml/StandardItem.qml | 6 +++--- qml/main.qml | 22 ++++++++++++++-------- src/statusbar.cpp | 4 ---- src/statusbar.h | 3 +++ 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/qml/StandardItem.qml b/qml/StandardItem.qml index baa2937..530cee7 100644 --- a/qml/StandardItem.qml +++ b/qml/StandardItem.qml @@ -71,14 +71,14 @@ Item { color: { if (control.checked) { - return (FishUI.Theme.darkMode) ? Qt.rgba(255, 255, 255, 0.2) : Qt.rgba(0, 0, 0, 0.1) + return (rootItem.darkMode) ? Qt.rgba(255, 255, 255, 0.2) : Qt.rgba(0, 0, 0, 0.1) } if (_mouseArea.containsMouse) { if (_mouseArea.containsPress) - return (FishUI.Theme.darkMode) ? Qt.rgba(255, 255, 255, 0.3) : Qt.rgba(0, 0, 0, 0.2) + return (rootItem.darkMode) ? Qt.rgba(255, 255, 255, 0.3) : Qt.rgba(0, 0, 0, 0.2) else - return (FishUI.Theme.darkMode) ? Qt.rgba(255, 255, 255, 0.2) : Qt.rgba(0, 0, 0, 0.1) + return (rootItem.darkMode) ? Qt.rgba(255, 255, 255, 0.2) : Qt.rgba(0, 0, 0, 0.1) } return "transparent" diff --git a/qml/main.qml b/qml/main.qml index 205e462..225be9e 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -34,6 +34,12 @@ Item { LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.childrenInherit: true + property bool darkMode: FishUI.Theme.darkMode + property color textColor: rootItem.darkMode ? "#FFFFFF" : "#000000"; + + // Hide if launchpad is encountered + opacity: acticity.launchPad && windowHelper.compositing ? 0 : 1 + Rectangle { id: background anchors.fill: parent @@ -104,7 +110,7 @@ Item { text: acticity.title Layout.fillWidth: true elide: Qt.ElideRight - color: FishUI.Theme.darkMode ? 'white' : 'black' + color: rootItem.textColor visible: text Layout.alignment: Qt.AlignVCenter font.pointSize: rootItem.height ? rootItem.height / 3 : 1 @@ -152,7 +158,7 @@ Item { Text { id: _actionText anchors.centerIn: parent - color: FishUI.Theme.darkMode ? 'white' : 'black' + color: rootItem.textColor text: { var text = activeMenu text = text.replace(/([^&]*)&(.)([^&]*)/g, function (match, p1, p2, p3) { @@ -229,7 +235,7 @@ Item { width: trayView.itemWidth height: ListView.view.height - property bool darkMode: FishUI.Theme.darkMode + property bool darkMode: rootItem.darkMode onDarkModeChanged: updateTimer.restart() Timer { @@ -283,7 +289,7 @@ Item { Image { id: volumeIcon visible: volume.isValid && status === Image.Ready - source: "qrc:/images/" + (FishUI.Theme.darkMode ? "dark/" : "light/") + volume.iconName + ".svg" + source: "qrc:/images/" + (rootItem.darkMode ? "dark/" : "light/") + volume.iconName + ".svg" width: rootItem.iconSize height: width sourceSize: Qt.size(width, height) @@ -296,7 +302,7 @@ Item { width: rootItem.iconSize height: width sourceSize: Qt.size(width, height) - source: activeConnection.wirelessIcon ? "qrc:/images/" + (FishUI.Theme.darkMode ? "dark/" : "light/") + activeConnection.wirelessIcon + ".svg" : "" + source: activeConnection.wirelessIcon ? "qrc:/images/" + (rootItem.darkMode ? "dark/" : "light/") + activeConnection.wirelessIcon + ".svg" : "" asynchronous: true Layout.alignment: Qt.AlignCenter visible: enabledConnections.wirelessHwEnabled && @@ -314,14 +320,14 @@ Item { height: rootItem.iconSize width: height + 6 sourceSize: Qt.size(width, height) - source: "qrc:/images/" + (FishUI.Theme.darkMode ? "dark/" : "light/") + battery.iconSource + source: "qrc:/images/" + (rootItem.darkMode ? "dark/" : "light/") + battery.iconSource Layout.alignment: Qt.AlignCenter } Label { text: battery.chargePercent + "%" font.pointSize: rootItem.height ? rootItem.height / 3 : 1 - color: FishUI.Theme.darkMode ? 'white' : 'black' + color: rootItem.textColor visible: battery.showPercentage } } @@ -330,7 +336,7 @@ Item { id: timeLabel Layout.alignment: Qt.AlignCenter font.pointSize: rootItem.height ? rootItem.height / 3 : 1 - color: FishUI.Theme.darkMode ? 'white' : 'black' + color: rootItem.textColor Timer { interval: 1000 diff --git a/src/statusbar.cpp b/src/statusbar.cpp index 8ecb293..1440bb2 100644 --- a/src/statusbar.cpp +++ b/src/statusbar.cpp @@ -53,10 +53,6 @@ StatusBar::StatusBar(QQuickView *parent) updateGeometry(); setVisible(true); - connect(m_acticity, &Activity::launchPadChanged, this, [=] { - setVisible(!m_acticity->launchPad()); - }); - connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &StatusBar::updateGeometry); connect(qApp->primaryScreen(), &QScreen::geometryChanged, this, &StatusBar::updateGeometry); } diff --git a/src/statusbar.h b/src/statusbar.h index 6f0a8ec..5fe0f19 100644 --- a/src/statusbar.h +++ b/src/statusbar.h @@ -33,6 +33,9 @@ public: void updateGeometry(); void updateViewStruts(); +signals: + void launchPadChanged(); + private: Activity *m_acticity; };