diff --git a/desktoppackage/contents/configuration/panelconfiguration/MoreSettingsMenu.qml b/desktoppackage/contents/configuration/panelconfiguration/MoreSettingsMenu.qml --- a/desktoppackage/contents/configuration/panelconfiguration/MoreSettingsMenu.qml +++ b/desktoppackage/contents/configuration/panelconfiguration/MoreSettingsMenu.qml @@ -121,6 +121,39 @@ flat: false } } + PlasmaExtras.Heading { + level: 3 + text: i18nd("plasma_shell_org.kde.plasma.desktop", "Opacity") + } + PlasmaComponents.ButtonColumn { + spacing: 0 + Layout.fillWidth: true + Layout.minimumWidth: implicitWidth + PlasmaComponents.ToolButton { + width: Math.max(implicitWidth, parent.width) + text: i18nd("plasma_shell_org.kde.plasma.desktop", "Adaptive") + checkable: true + checked: configDialog.opacityMode === 0 + onClicked: configDialog.opacityMode = 0 + flat: false + } + PlasmaComponents.ToolButton { + width: Math.max(implicitWidth, parent.width) + text: i18nd("plasma_shell_org.kde.plasma.desktop", "Opaque") + checkable: true + checked: configDialog.opacityMode === 1 + onClicked: configDialog.opacityMode = 1 + flat: false + } + PlasmaComponents.ToolButton { + width: Math.max(implicitWidth, parent.width) + text: i18nd("plasma_shell_org.kde.plasma.desktop", "Translucent") + checkable: true + checked: configDialog.opacityMode === 2 + onClicked: configDialog.opacityMode = 2 + flat: false + } + } PlasmaComponents.ToolButton { Layout.fillWidth: true text: i18nd("plasma_shell_org.kde.plasma.desktop", "Maximize Panel") diff --git a/desktoppackage/contents/views/Panel.qml b/desktoppackage/contents/views/Panel.qml --- a/desktoppackage/contents/views/Panel.qml +++ b/desktoppackage/contents/views/Panel.qml @@ -20,20 +20,145 @@ import QtQuick.Layouts 1.1 import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.taskmanager 0.1 as TaskManager -PlasmaCore.FrameSvgItem { +Item { id: root - imagePath: containment && containment.backgroundHints === PlasmaCore.Types.NoBackground ? "" : "widgets/panel-background" - - enabledBorders: panel.enabledBorders - property Item containment - property alias panelMask: root.mask + property alias panelMask: privateSwapper.mask + + QtObject { + id: privateSwapper + property string completedState: "" + // Work around the fact that we can't use a ternary if in an alias + readonly property var mask: { + if (completedState == "opaque") { + return opaqueItem.mask + } else { + return translucentItem.mask + } + } + } readonly property bool verticalPanel: containment && containment.formFactor === PlasmaCore.Types.Vertical + TaskManager.VirtualDesktopInfo { + id: virtualDesktopInfo + } + + TaskManager.ActivityInfo { + id: activityInfo + } + + PlasmaCore.SortFilterModel { + id: visibleWindowsModel + filterRole: 'IsMinimized' + filterRegExp: 'false' + sourceModel: TaskManager.TasksModel { + filterByVirtualDesktop: true + filterByActivity: true + filterNotMaximized: true + filterByScreen: true + + screenGeometry: panel.screenGeometry + virtualDesktop: virtualDesktopInfo.currentDesktop + activity: activityInfo.currentActivity + + id: tasksModel + groupMode: TaskManager.TasksModel.GroupDisabled + } + } + + PlasmaCore.FrameSvgItem { + id: translucentItem + enabledBorders: panel.enabledBorders + anchors.fill: parent + + imagePath: containment && containment.backgroundHints === PlasmaCore.Types.NoBackground ? "" : "widgets/panel-background" + } + + PlasmaCore.FrameSvgItem { + id: opaqueItem + enabledBorders: panel.enabledBorders + anchors.fill: parent + + imagePath: containment && containment.backgroundHints === PlasmaCore.Types.NoBackground ? "" : "opaque/widgets/panel-background" + } + + transitions: [ + Transition { + from: "*" + to: "transparent" + SequentialAnimation { + ScriptAction { + script: { + translucentItem.visible = true + } + } + NumberAnimation { + target: opaqueItem + properties: "opacity" + from: 1 + to: 0 + duration: units.veryLongDuration + easing.type: Easing.InOutQuad + } + ScriptAction { + script: { + opaqueItem.visible = false + privateSwapper.completedState = "transparent" + root.panelMaskChanged() + } + } + } + }, + Transition { + from: "*" + to: "opaque" + SequentialAnimation { + ScriptAction { + script: { + opaqueItem.visible = true + } + } + NumberAnimation { + target: opaqueItem + properties: "opacity" + from: 0 + to: 1 + duration: units.veryLongDuration + easing.type: Easing.InOutQuad + } + ScriptAction { + script: { + translucentItem.visible = false + privateSwapper.completedState = "opaque" + root.panelMaskChanged() + } + } + } + } + ] + + Component.onCompleted: { + state = Qt.binding(function() { + if (panel.opacityMode == 0) { + return visibleWindowsModel.count > 0 ? "opaque" : "transparent" + } else if (panel.opacityMode == 1) { + return "opaque" + } else { + return "transparent" + } + }) + } + state: "" + states: [ + State { name: "opaque" }, + State { name: "transparent" } + ] + function adjustPrefix() { if (!containment) { return "";