From 79bbf20a62fc17e2ba1807aea78fe8bcd06d9bcc Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sun, 25 Dec 2016 15:19:01 +0200 Subject: [PATCH] update libnowdockplugin to liblattedockplugin --- CMakeLists.txt | 4 +- containment/contents/ui/PanelBox.qml | 38 +- containment/contents/ui/VisibilityManager.qml | 34 +- containment/contents/ui/main.qml | 78 +- corona/CMakeLists.txt | 2 +- corona/nowdockview.cpp | 2 +- corona/visibilitymanager.cpp | 36 +- corona/visibilitymanager.h | 13 +- liblattedock/CMakeLists.txt | 30 + liblattedock/lattedockplugin.cpp | 14 + .../lattedockplugin.h | 6 +- liblattedock/qmldir | 2 + {libnowdock => liblattedock}/types.cpp | 0 {libnowdock => liblattedock}/types.h | 2 +- {libnowdock => liblattedock}/windowsystem.cpp | 4 +- {libnowdock => liblattedock}/windowsystem.h | 6 +- libnowdock/CMakeLists.txt | 39 - libnowdock/abstractinterface.cpp | 42 - libnowdock/abstractinterface.h | 56 - libnowdock/nowdockplugin.cpp | 17 - libnowdock/panelwindow.cpp | 1120 ----------------- libnowdock/panelwindow.h | 203 --- libnowdock/qmldir | 2 - libnowdock/xwindowinterface.cpp | 361 ------ libnowdock/xwindowinterface.h | 60 - plasmoid/contents/ui/main.qml | 28 +- .../configuration/NowDockConfiguration.qml | 22 +- 27 files changed, 182 insertions(+), 2039 deletions(-) create mode 100644 liblattedock/CMakeLists.txt create mode 100644 liblattedock/lattedockplugin.cpp rename libnowdock/nowdockplugin.h => liblattedock/lattedockplugin.h (63%) create mode 100644 liblattedock/qmldir rename {libnowdock => liblattedock}/types.cpp (100%) rename {libnowdock => liblattedock}/types.h (98%) rename {libnowdock => liblattedock}/windowsystem.cpp (91%) rename {libnowdock => liblattedock}/windowsystem.h (86%) delete mode 100644 libnowdock/CMakeLists.txt delete mode 100644 libnowdock/abstractinterface.cpp delete mode 100644 libnowdock/abstractinterface.h delete mode 100644 libnowdock/nowdockplugin.cpp delete mode 100644 libnowdock/panelwindow.cpp delete mode 100644 libnowdock/panelwindow.h delete mode 100644 libnowdock/qmldir delete mode 100644 libnowdock/xwindowinterface.cpp delete mode 100644 libnowdock/xwindowinterface.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 120e5ebba..84cd388c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -project(nowdock) +project(lattedock) cmake_minimum_required(VERSION 3.0 FATAL_ERROR) set (CMAKE_CXX_STANDARD 11) @@ -74,7 +74,7 @@ ELSE(NOT GETTEXT_MSGFMT_EXECUTABLE) ENDIF(NOT GETTEXT_MSGFMT_EXECUTABLE) -add_subdirectory(libnowdock) +add_subdirectory(liblattedock) add_subdirectory(containment) plasma_install_package(build/containment/release org.kde.nowdock.containment) add_subdirectory(plasmoid) diff --git a/containment/contents/ui/PanelBox.qml b/containment/contents/ui/PanelBox.qml index 9dbcb0a25..f5ca6457f 100644 --- a/containment/contents/ui/PanelBox.qml +++ b/containment/contents/ui/PanelBox.qml @@ -26,7 +26,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.kquickcontrolsaddons 2.0 -import org.kde.nowdock 0.1 as NowDock +import org.kde.latte.dock 0.1 as LatteDock Item{ id:barLine @@ -43,8 +43,8 @@ Item{ width: root.isHorizontal ? panelWidth : smallSize height: root.isVertical ? panelHeight : smallSize - property int spacing: (root.panelAlignment === NowDock.PanelWindow.Center - || plasmoid.configuration.panelPosition === NowDock.PanelWindow.Double) ? + property int spacing: (root.panelAlignment === LatteDock.Types.Center + || plasmoid.configuration.panelPosition === LatteDock.Types.Double) ? root.panelEdgeSpacing : root.panelEdgeSpacing/2 property int smallSize: Math.max(3.7*root.statesLineSize, 16) @@ -133,7 +133,7 @@ Item{ ///Left State { name: "leftCenter" - when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === NowDock.PanelWindow.Center) + when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === LatteDock.Types.Center) AnchorChanges { target: barLine @@ -151,7 +151,7 @@ Item{ ///Left State { name: "leftTop" - when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === NowDock.PanelWindow.Top) + when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === LatteDock.Types.Top) AnchorChanges { target: barLine @@ -169,7 +169,7 @@ Item{ ///Left State { name: "leftBottom" - when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === NowDock.PanelWindow.Bottom) + when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === LatteDock.Types.Bottom) AnchorChanges { target: barLine @@ -186,7 +186,7 @@ Item{ }, State { name: "leftDouble" - when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === NowDock.PanelWindow.Double) + when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: barLine @@ -204,7 +204,7 @@ Item{ ///Right State { name: "rightCenter" - when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === NowDock.PanelWindow.Center) + when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === LatteDock.Types.Center) AnchorChanges { target: barLine @@ -221,7 +221,7 @@ Item{ }, State { name: "rightTop" - when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === NowDock.PanelWindow.Top) + when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === LatteDock.Types.Top) AnchorChanges { target: barLine @@ -238,7 +238,7 @@ Item{ }, State { name: "rightBottom" - when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === NowDock.PanelWindow.Bottom) + when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === LatteDock.Types.Bottom) AnchorChanges { target: barLine @@ -255,7 +255,7 @@ Item{ }, State { name: "rightDouble" - when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === NowDock.PanelWindow.Double) + when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: barLine @@ -273,7 +273,7 @@ Item{ ///Bottom State { name: "bottomCenter" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === NowDock.PanelWindow.Center) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === LatteDock.Types.Center) AnchorChanges { target: barLine @@ -290,7 +290,7 @@ Item{ }, State { name: "bottomLeft" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === NowDock.PanelWindow.Left) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === LatteDock.Types.Left) AnchorChanges { target: barLine @@ -307,7 +307,7 @@ Item{ }, State { name: "bottomRight" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === NowDock.PanelWindow.Right) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === LatteDock.Types.Right) AnchorChanges { target: barLine @@ -324,7 +324,7 @@ Item{ }, State { name: "bottomDouble" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === NowDock.PanelWindow.Double) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: barLine @@ -342,7 +342,7 @@ Item{ ///Top State { name: "topCenter" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === NowDock.PanelWindow.Center) + when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === LatteDock.Types.Center) AnchorChanges { target: barLine @@ -359,7 +359,7 @@ Item{ }, State { name: "topLeft" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === NowDock.PanelWindow.Left) + when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === LatteDock.Types.Left) AnchorChanges { target: barLine @@ -376,7 +376,7 @@ Item{ }, State { name: "topRight" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === NowDock.PanelWindow.Right) + when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === LatteDock.Types.Right) AnchorChanges { target: barLine @@ -393,7 +393,7 @@ Item{ }, State { name: "topDouble" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === NowDock.PanelWindow.Double) + when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: barLine diff --git a/containment/contents/ui/VisibilityManager.qml b/containment/contents/ui/VisibilityManager.qml index 07230befa..24028b43c 100644 --- a/containment/contents/ui/VisibilityManager.qml +++ b/containment/contents/ui/VisibilityManager.qml @@ -6,7 +6,7 @@ import org.kde.plasma.plasmoid 2.0 import org.kde.taskmanager 0.1 as TaskManager -import org.kde.nowdock 0.1 as NowDock +import org.kde.latte.dock 0.1 as LatteDock Item{ id: manager @@ -90,7 +90,7 @@ Item{ function slotIsHoveredChanged() { if(window.isHovered) { //stop parent window timer for auto hiding - if ((window.visibility.panelVisibility === NowDock.PanelWindow.AutoHide)|| window.visibility.isDockWindowType) { + if ((window.visibility.panelVisibility === LatteDock.Types.AutoHide)|| window.visibility.isDockWindowType) { if(hideMagicWindowInAutoHide.forcedDisableHiding) { hideMagicWindowInAutoHide.forcedDisableHiding = false; window.visibility.disableHiding = false; @@ -111,7 +111,7 @@ Item{ } function slotMustBeRaised() { - if ((window.visibility.panelVisibility === NowDock.PanelWindow.AutoHide) || window.visibility.isDockWindowType) { + if ((window.visibility.panelVisibility === LatteDock.Types.AutoHide) || window.visibility.isDockWindowType) { slidingAnimationAutoHiddenIn.init(); } else { slidingAnimation.init(true,false); @@ -123,7 +123,7 @@ Item{ } function slotMustBeLowered() { - if ((window.visibility.panelVisibility === NowDock.PanelWindow.AutoHide) || window.visibility.isDockWindowType ) { + if ((window.visibility.panelVisibility === LatteDock.Types.AutoHide) || window.visibility.isDockWindowType ) { slidingAnimationAutoHiddenOut.init(); } else { slidingAnimation.init(false,false); @@ -131,7 +131,7 @@ Item{ } function slotPanelVisibilityChanged() { - if (window.visibility.panelVisibility !== NowDock.PanelWindow.AutoHide) { + if (window.visibility.panelVisibility !== LatteDock.Types.AutoHide) { window.visibility.isAutoHidden = false; } } @@ -164,9 +164,9 @@ Item{ if (normalState && plasmoid.immutable) { //count panel length if(root.isHorizontal) { - tempLength = plasmoid.configuration.panelPosition === NowDock.Types.Double ? layoutsContainer.width + 0.5*space : mainLayout.width + space; + tempLength = plasmoid.configuration.panelPosition === LatteDock.Types.Double ? layoutsContainer.width + 0.5*space : mainLayout.width + space; } else { - tempLength = plasmoid.configuration.panelPosition === NowDock.Types.Double ? layoutsContainer.height + 0.5*space : mainLayout.height + space; + tempLength = plasmoid.configuration.panelPosition === LatteDock.Types.Double ? layoutsContainer.height + 0.5*space : mainLayout.height + space; } tempThickness = thicknessNormalOriginal; @@ -175,7 +175,7 @@ Item{ tempThickness = thicknessMidOriginal; } - if (window.visibility.isAutoHidden && ((window.visibility.panelVisibility === NowDock.Types.AutoHide) || window.visibility.isDockWindowType)) { + if (window.visibility.isAutoHidden && ((window.visibility.panelVisibility === LatteDock.Types.AutoHide) || window.visibility.isDockWindowType)) { tempThickness = thicknessAutoHidden; } @@ -187,13 +187,13 @@ Item{ localY = 0; } - if (plasmoid.configuration.panelPosition === NowDock.Types.Double) { + if (plasmoid.configuration.panelPosition === LatteDock.Types.Double) { localX = (window.width/2) - (layoutsContainer.width/2) - 0.25*space; - } else if (root.panelAlignment === NowDock.Types.Left) { + } else if (root.panelAlignment === LatteDock.Types.Left) { localX = 0; - } else if (root.panelAlignment === NowDock.Types.Center) { + } else if (root.panelAlignment === LatteDock.Types.Center) { localX = (window.width/2) - (mainLayout.width/2) - (space/2); - } else if (root.panelAlignment === NowDock.Types.Right) { + } else if (root.panelAlignment === LatteDock.Types.Right) { localX = window.width - mainLayout.width - (space/2); } } else if ((plasmoid.location === PlasmaCore.Types.LeftEdge) || (plasmoid.location === PlasmaCore.Types.RightEdge)){ @@ -203,13 +203,13 @@ Item{ localX = window.width - tempThickness; } - if (plasmoid.configuration.panelPosition === NowDock.Types.Double) { + if (plasmoid.configuration.panelPosition === LatteDock.Types.Double) { localY = (window.height/2) - (layoutsContainer.height/2) - 0.25*space; - } else if (root.panelAlignment === NowDock.Types.Top) { + } else if (root.panelAlignment === LatteDock.Types.Top) { localY = 0; - } else if (root.panelAlignment === NowDock.Types.Center) { + } else if (root.panelAlignment === LatteDock.Types.Center) { localY = (window.height/2) - (mainLayout.height/2) - (space/2); - } else if (root.panelAlignment === NowDock.Types.Bottom) { + } else if (root.panelAlignment === LatteDock.Types.Bottom) { localY = window.height - mainLayout.height - (space/2); } } @@ -435,7 +435,7 @@ Item{ interval: manager.inStartup ? 1000 : 500 onTriggered: { layoutsContainer.opacity = 1; - if ((window.visibility.panelVisibility !== NowDock.PanelWindow.AutoHide) && !window.visibility.isDockWindowType) { + if ((window.visibility.panelVisibility !== LatteDock.Types.AutoHide) && !window.visibility.isDockWindowType) { slidingAnimation.init(true,false); } else { slidingAnimationAutoHiddenIn.init(); diff --git a/containment/contents/ui/main.qml b/containment/contents/ui/main.qml index 7718a7954..c277f8ec9 100644 --- a/containment/contents/ui/main.qml +++ b/containment/contents/ui/main.qml @@ -26,7 +26,7 @@ import org.kde.kquickcontrolsaddons 2.0 import org.kde.draganddrop 2.0 as DragDrop import org.kde.plasma.plasmoid 2.0 -import org.kde.nowdock 0.1 as NowDock +import org.kde.latte.dock 0.1 as LatteDock import "LayoutManager.js" as LayoutManager @@ -74,11 +74,11 @@ DragDrop.DropArea { property int themePanelSize: plasmoid.configuration.panelSize ///FIXME: I can't remember why this is needed, maybe for the anchorings!!! In order for the Double Layout to not mess the anchorings... - property int mainLayoutPosition: !plasmoid.immutable ? NowDock.Types.Center : (root.isVertical ? NowDock.Types.Top : NowDock.Types.Left) + property int mainLayoutPosition: !plasmoid.immutable ? LatteDock.Types.Center : (root.isVertical ? LatteDock.Types.Top : LatteDock.Types.Left) ///FIXME: - //property int panelAlignment: plasmoid.configuration.panelPosition !== NowDock.Types.Double ? plasmoid.configuration.panelPosition : mainLayoutPosition + //property int panelAlignment: plasmoid.configuration.panelPosition !== LatteDock.Types.Double ? plasmoid.configuration.panelPosition : mainLayoutPosition - property int panelAlignment: plasmoid.immutable ? plasmoid.configuration.panelPosition : NowDock.Types.Center + property int panelAlignment: plasmoid.immutable ? plasmoid.configuration.panelPosition : LatteDock.Types.Center // property int panelAlignment: plasmoid.configuration.panelPosition @@ -107,12 +107,12 @@ DragDrop.DropArea { ///END properties from nowDock /* Layout.preferredWidth: plasmoid.immutable ? - (plasmoid.configuration.panelPosition === NowDock.Types.Double ? + (plasmoid.configuration.panelPosition === LatteDock.Types.Double ? layoutsContainer.width + 0.5*iconMargin : mainLayout.width + iconMargin) : Screen.width //on unlocked state use the maximum Layout.preferredHeight: plasmoid.immutable ? - (plasmoid.configuration.panelPosition === NowDock.Types.Double ? + (plasmoid.configuration.panelPosition === LatteDock.Types.Double ? layoutsContainer.height + 0.5*iconMargin : mainLayout.height + iconMargin) : Screen.height //on unlocked state use the maximum*/ @@ -165,7 +165,7 @@ DragDrop.DropArea { ///Left Edge State { name: "leftCenter" - when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === NowDock.Types.Center) + when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === LatteDock.Types.Center) AnchorChanges { target: mainLayout @@ -178,7 +178,7 @@ DragDrop.DropArea { }, State { name: "leftTop" - when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === NowDock.Types.Top) + when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === LatteDock.Types.Top) AnchorChanges { target: mainLayout @@ -191,7 +191,7 @@ DragDrop.DropArea { }, State { name: "leftBottom" - when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === NowDock.Types.Bottom) + when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === LatteDock.Types.Bottom) AnchorChanges { target: mainLayout @@ -204,7 +204,7 @@ DragDrop.DropArea { }, State { name: "leftDouble" - when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === NowDock.Types.Double) + when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: mainLayout @@ -218,7 +218,7 @@ DragDrop.DropArea { ///Right Edge State { name: "rightCenter" - when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === NowDock.Types.Center) + when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === LatteDock.Types.Center) AnchorChanges { target: mainLayout @@ -231,7 +231,7 @@ DragDrop.DropArea { }, State { name: "rightTop" - when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === NowDock.Types.Top) + when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === LatteDock.Types.Top) AnchorChanges { target: mainLayout @@ -244,7 +244,7 @@ DragDrop.DropArea { }, State { name: "rightBottom" - when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === NowDock.Types.Bottom) + when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === LatteDock.Types.Bottom) AnchorChanges { target: mainLayout @@ -257,7 +257,7 @@ DragDrop.DropArea { }, State { name: "rightDouble" - when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === NowDock.Types.Double) + when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: mainLayout @@ -271,7 +271,7 @@ DragDrop.DropArea { ///Bottom Edge State { name: "bottomCenter" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === NowDock.Types.Center) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === LatteDock.Types.Center) AnchorChanges { target: mainLayout @@ -284,7 +284,7 @@ DragDrop.DropArea { }, State { name: "bottomLeft" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === NowDock.Types.Left) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === LatteDock.Types.Left) AnchorChanges { target: mainLayout @@ -297,7 +297,7 @@ DragDrop.DropArea { }, State { name: "bottomRight" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === NowDock.Types.Right) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === LatteDock.Types.Right) AnchorChanges { target: mainLayout @@ -310,7 +310,7 @@ DragDrop.DropArea { }, State { name: "bottomDouble" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === NowDock.Types.Double) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: mainLayout @@ -324,7 +324,7 @@ DragDrop.DropArea { ///Top Edge State { name: "topCenter" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === NowDock.Types.Center) + when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === LatteDock.Types.Center) AnchorChanges { target: mainLayout @@ -337,7 +337,7 @@ DragDrop.DropArea { }, State { name: "topLeft" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === NowDock.Types.Left) + when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === LatteDock.Types.Left) AnchorChanges { target: mainLayout @@ -350,7 +350,7 @@ DragDrop.DropArea { }, State { name: "topRight" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === NowDock.Types.Right) + when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === LatteDock.Types.Right) AnchorChanges { target: mainLayout @@ -363,7 +363,7 @@ DragDrop.DropArea { }, State { name: "topDouble" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === NowDock.Types.Double) + when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: mainLayout @@ -552,10 +552,10 @@ DragDrop.DropArea { ///to add applets if (plasmoid.immutable) { if(root.isHorizontal) { - root.Layout.preferredWidth = (plasmoid.configuration.panelPosition === NowDock.Types.Double ? + root.Layout.preferredWidth = (plasmoid.configuration.panelPosition === LatteDock.Types.Double ? layoutsContainer.width + 0.5*iconMargin : mainLayout.width + iconMargin); } else { - root.Layout.preferredHeight = (plasmoid.configuration.panelPosition === NowDock.Types.Double ? + root.Layout.preferredHeight = (plasmoid.configuration.panelPosition === LatteDock.Types.Double ? layoutsContainer.height + 0.5*iconMargin : mainLayout.height + iconMargin); } } else { @@ -864,10 +864,10 @@ DragDrop.DropArea { // console.log("------Entered check-----"); if (root.isVertical) { - layoutLength = (plasmoid.configuration.panelPosition === NowDock.Types.Double) ? + layoutLength = (plasmoid.configuration.panelPosition === LatteDock.Types.Double) ? mainLayout.height+secondLayout.height : mainLayout.height } else { - layoutLength = (plasmoid.configuration.panelPosition === NowDock.Types.Double) ? + layoutLength = (plasmoid.configuration.panelPosition === LatteDock.Types.Double) ? mainLayout.width+secondLayout.width : mainLayout.width } @@ -951,7 +951,7 @@ DragDrop.DropArea { ////BEGIN interfaces - NowDock.WindowSystem { + LatteDock.WindowSystem { id:windowSystem } @@ -1018,7 +1018,7 @@ DragDrop.DropArea { onExited: { if (plasmoid.immutable && magicWin && !magicWin.isHovered - && ((magicWin.panelVisibility === NowDock.Types.AutoHide) || magicWin.isDockWindowType) ) { + && ((magicWin.panelVisibility === LatteDock.Types.AutoHide) || magicWin.isDockWindowType) ) { hideMagicWindowInAutoHide.start(); } } @@ -1029,7 +1029,7 @@ DragDrop.DropArea { function showWindow() { if (plasmoid.immutable && magicWin - && ((magicWin.panelVisibility === NowDock.Types.AutoHide) || magicWin.isDockWindowType) ) { + && ((magicWin.panelVisibility === LatteDock.Types.AutoHide) || magicWin.isDockWindowType) ) { magicWin.updateMaskArea(); magicWin.mustBeRaised(); } else { @@ -1049,21 +1049,21 @@ DragDrop.DropArea { signal updateScale(int delegateIndex, real newScale, real step) // property bool parentMagicWinFlag: plasmoid.immutable && magicWin && !root.inStartup && windowSystem.compositingActive - //&& !(root.inStartup && magicWin.panelVisibility === NowDock.Types.AutoHide) + //&& !(root.inStartup && magicWin.panelVisibility === LatteDock.Types.AutoHide) property int allCount: root.nowDock ? mainLayout.count-1+nowDock.tasksCount : mainLayout.count property int currentSpot: -1000 property int hoveredIndex: -1 - x: (plasmoid.configuration.panelPosition === NowDock.Types.Double) && root.isHorizontal + x: (plasmoid.configuration.panelPosition === LatteDock.Types.Double) && root.isHorizontal && plasmoid.immutable && windowSystem.compositingActive ? (dockView.width/2) - (dockView.visibility.maxLength/2): 0 - y: (plasmoid.configuration.panelPosition === NowDock.Types.Double) && root.isVertical + y: (plasmoid.configuration.panelPosition === LatteDock.Types.Double) && root.isVertical && plasmoid.immutable && windowSystem.compositingActive ? (dockView.height/2) - (dockView.visibility.maxLength/2): 0 - width: (plasmoid.configuration.panelPosition === NowDock.Types.Double) && root.isHorizontal && plasmoid.immutable ? + width: (plasmoid.configuration.panelPosition === LatteDock.Types.Double) && root.isHorizontal && plasmoid.immutable ? dockView.visibility.maxLength : parent.width - height: (plasmoid.configuration.panelPosition === NowDock.Types.Double) && root.isVertical && plasmoid.immutable ? + height: (plasmoid.configuration.panelPosition === LatteDock.Types.Double) && root.isVertical && plasmoid.immutable ? dockView.visibility.maxLength : parent.height Component.onCompleted: { @@ -1159,7 +1159,7 @@ DragDrop.DropArea { states:[ State { name: "bottom" - when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === NowDock.Types.Double) + when: (plasmoid.location === PlasmaCore.Types.BottomEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: secondLayout @@ -1172,7 +1172,7 @@ DragDrop.DropArea { }, State { name: "left" - when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === NowDock.Types.Double) + when: (plasmoid.location === PlasmaCore.Types.LeftEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: secondLayout @@ -1185,7 +1185,7 @@ DragDrop.DropArea { }, State { name: "right" - when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === NowDock.Types.Double) + when: (plasmoid.location === PlasmaCore.Types.RightEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: secondLayout @@ -1198,7 +1198,7 @@ DragDrop.DropArea { }, State { name: "top" - when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === NowDock.Types.Double) + when: (plasmoid.location === PlasmaCore.Types.TopEdge)&&(root.panelAlignment === LatteDock.Types.Double) AnchorChanges { target: secondLayout @@ -1232,7 +1232,7 @@ DragDrop.DropArea { var visibility = dockView.visibility; if (plasmoid.immutable && !visibility.isHovered //&& !wholeArea.containsMouse - && ((visibility.panelVisibility === NowDock.Types.AutoHide) || visibility.isDockWindowType) ) { + && ((visibility.panelVisibility === LatteDock.Types.AutoHide) || visibility.isDockWindowType) ) { visibility.mustBeLowered(); } } diff --git a/corona/CMakeLists.txt b/corona/CMakeLists.txt index 6799b780e..84f03716b 100644 --- a/corona/CMakeLists.txt +++ b/corona/CMakeLists.txt @@ -12,7 +12,7 @@ include(KDEPackageAppTemplates) set(nowdock-app_SRCS - ../libnowdock/types.cpp + ../liblattedock/types.cpp abstractinterface.cpp xwindowinterface.cpp visibilitymanager.cpp diff --git a/corona/nowdockview.cpp b/corona/nowdockview.cpp index 16c869a81..d7e824cfe 100644 --- a/corona/nowdockview.cpp +++ b/corona/nowdockview.cpp @@ -35,7 +35,7 @@ #include #include "nowdockcorona.h" -//using Candil::Dock; + NowDockView::NowDockView(Plasma::Corona *corona, QScreen *targetScreen) : PlasmaQuick::ContainmentView(corona), diff --git a/corona/visibilitymanager.cpp b/corona/visibilitymanager.cpp index 361d1e257..aa16920bd 100644 --- a/corona/visibilitymanager.cpp +++ b/corona/visibilitymanager.cpp @@ -4,7 +4,7 @@ #include "xwindowinterface.h" #include "plasmaquick/containmentview.h" -#include "../libnowdock/types.h" +#include "../liblattedock/types.h" #include @@ -43,7 +43,7 @@ VisibilityManager::VisibilityManager(PlasmaQuick::ContainmentView *view) : connect(&m_initTimer, &QTimer::timeout, this, &VisibilityManager::initWindow); connect(this, SIGNAL(panelVisibilityChanged()), this, SLOT(updateVisibilityFlags())); - setPanelVisibility(NowDock::Types::BelowActive); + setPanelVisibility(LatteDock::Types::BelowActive); // updateVisibilityFlags(); // connect(this, SIGNAL(locationChanged()), this, SLOT(updateWindowPosition())); @@ -67,12 +67,12 @@ void VisibilityManager::setContainment(Plasma::Containment *containment) } -NowDock::Types::Visibility VisibilityManager::panelVisibility() const +LatteDock::Types::Visibility VisibilityManager::panelVisibility() const { return m_panelVisibility; } -void VisibilityManager::setPanelVisibility(NowDock::Types::Visibility state) +void VisibilityManager::setPanelVisibility(LatteDock::Types::Visibility state) { if (m_panelVisibility == state) { return; @@ -268,7 +268,7 @@ void VisibilityManager::updateState() //update the dock behavior switch (m_panelVisibility) { - case NowDock::Types::BelowActive: + case LatteDock::Types::BelowActive: if (!m_interface->desktopIsActive() && m_interface->dockIntersectsActiveWindow()) { if (m_interface->dockIsOnTop() || (m_isDockWindowType && !m_isAutoHidden)) { // qDebug() << m_isHovered << " - " << m_windowIsInAttention << " - "<< m_disableHiding; @@ -297,7 +297,7 @@ void VisibilityManager::updateState() break; - case NowDock::Types::BelowMaximized: + case LatteDock::Types::BelowMaximized: if (!m_interface->desktopIsActive() && m_interface->activeIsMaximized() && m_interface->dockIntersectsActiveWindow()) { if (m_interface->dockIsOnTop() || (m_isDockWindowType && !m_isAutoHidden)) { if (!m_isHovered && !m_windowIsInAttention && !m_disableHiding) { @@ -321,7 +321,7 @@ void VisibilityManager::updateState() break; - case NowDock::Types::LetWindowsCover: + case LatteDock::Types::LetWindowsCover: //this is not supported in clean Dock Window Types such as in wayland case if (m_isDockWindowType) { @@ -348,11 +348,11 @@ void VisibilityManager::updateState() break; - case NowDock::Types::WindowsGoBelow: + case LatteDock::Types::WindowsGoBelow: //Do nothing, the dock is OnTop state in every case break; - case NowDock::Types::AutoHide: + case LatteDock::Types::AutoHide: if (m_windowIsInAttention && m_isAutoHidden) { emit mustBeRaised(); } else if (!m_isHovered && !m_disableHiding) { @@ -361,7 +361,7 @@ void VisibilityManager::updateState() break; - case NowDock::Types::AlwaysVisible: + case LatteDock::Types::AlwaysVisible: //Do nothing, the dock in OnTop state in every case break; } @@ -389,9 +389,9 @@ void VisibilityManager::showOnBottom() /***************/ void VisibilityManager::activeWindowChanged() { - if ((m_panelVisibility == NowDock::Types::WindowsGoBelow) - || (m_panelVisibility == NowDock::Types::AlwaysVisible) - || (m_panelVisibility == NowDock::Types::AutoHide)) { + if ((m_panelVisibility == LatteDock::Types::WindowsGoBelow) + || (m_panelVisibility == LatteDock::Types::AlwaysVisible) + || (m_panelVisibility == LatteDock::Types::AutoHide)) { return; } @@ -407,8 +407,8 @@ void VisibilityManager::activeWindowChanged() //the dock is totally hidden underneath void VisibilityManager::showOnTopCheck() { - if ((m_panelVisibility == NowDock::Types::BelowActive) || (m_panelVisibility == NowDock::Types::BelowMaximized) - || (m_panelVisibility == NowDock::Types::LetWindowsCover)) { + if ((m_panelVisibility == LatteDock::Types::BelowActive) || (m_panelVisibility == LatteDock::Types::BelowMaximized) + || (m_panelVisibility == LatteDock::Types::LetWindowsCover)) { if (m_interface->dockIsCovered(true)) { m_updateStateTimer.stop(); setIsHovered(true); @@ -430,7 +430,7 @@ bool VisibilityManager::event(QEvent *event) m_updateStateTimer.stop(); setIsHovered(true); - if ((m_panelVisibility == NowDock::Types::AutoHide) || (m_isDockWindowType)) { + if ((m_panelVisibility == LatteDock::Types::AutoHide) || (m_isDockWindowType)) { if (m_isAutoHidden) { emit mustBeRaised(); } @@ -440,8 +440,8 @@ bool VisibilityManager::event(QEvent *event) } else if (event->type() == QEvent::Leave) { setIsHovered(false); - if ((m_panelVisibility != NowDock::Types::WindowsGoBelow) - && (m_panelVisibility != NowDock::Types::AlwaysVisible)) { + if ((m_panelVisibility != LatteDock::Types::WindowsGoBelow) + && (m_panelVisibility != LatteDock::Types::AlwaysVisible)) { m_updateStateTimer.start(); } } diff --git a/corona/visibilitymanager.h b/corona/visibilitymanager.h index f343c8289..d2b50f0ec 100644 --- a/corona/visibilitymanager.h +++ b/corona/visibilitymanager.h @@ -2,7 +2,7 @@ #define VISIBILITYMANAGER_H #include -#include "../libnowdock/types.h" +#include "../liblattedock/types.h" #include "abstractinterface.h" #include "plasmaquick/containmentview.h" @@ -20,7 +20,7 @@ class VisibilityManager : public QObject { Q_PROPERTY(bool isHovered READ isHovered NOTIFY isHoveredChanged) Q_PROPERTY(bool windowInAttention READ windowInAttention WRITE setWindowInAttention NOTIFY windowInAttentionChanged) - Q_PROPERTY(NowDock::Types::Visibility panelVisibility READ panelVisibility WRITE setPanelVisibility NOTIFY panelVisibilityChanged) + Q_PROPERTY(LatteDock::Types::Visibility panelVisibility READ panelVisibility WRITE setPanelVisibility NOTIFY panelVisibilityChanged) public: explicit VisibilityManager(PlasmaQuick::ContainmentView *view); @@ -39,10 +39,10 @@ public: bool windowInAttention() const; - NowDock::Types::Visibility panelVisibility() const; + LatteDock::Types::Visibility panelVisibility() const; void setContainment(Plasma::Containment *contaiment); void setMaskArea(QRect area); - void setPanelVisibility(NowDock::Types::Visibility state); + void setPanelVisibility(LatteDock::Types::Visibility state); public slots: Q_INVOKABLE void initialize(); @@ -94,13 +94,10 @@ private: PlasmaQuick::ContainmentView *m_view; NowDock::AbstractInterface *m_interface; - NowDock::Types::Visibility m_panelVisibility; - + LatteDock::Types::Visibility m_panelVisibility; }; #endif - - diff --git a/liblattedock/CMakeLists.txt b/liblattedock/CMakeLists.txt new file mode 100644 index 000000000..70113410d --- /dev/null +++ b/liblattedock/CMakeLists.txt @@ -0,0 +1,30 @@ +set (REQUIRED_QT_VERSION "5.6.0") + +find_package(ECM 1.8.0 REQUIRED NO_MODULE) +find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Quick Qml) + +find_package(KF5 REQUIRED COMPONENTS + WindowSystem + CoreAddons +) + +set(CMAKE_AUTOMOC ON) + +set(lattedock_SRCS + lattedockplugin.cpp + windowsystem.cpp + types.cpp +) + +add_library(lattedockplugin SHARED ${lattedock_SRCS}) + +target_link_libraries(lattedockplugin + Qt5::Quick + Qt5::Qml + KF5::WindowSystem + KF5::CoreAddons +) + +install(TARGETS lattedockplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/latte/dock) + +install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/latte/dock) diff --git a/liblattedock/lattedockplugin.cpp b/liblattedock/lattedockplugin.cpp new file mode 100644 index 000000000..7b8f79fff --- /dev/null +++ b/liblattedock/lattedockplugin.cpp @@ -0,0 +1,14 @@ +#include "lattedockplugin.h" +#include "windowsystem.h" +#include "types.h" + +#include + +void LatteDockPlugin::registerTypes(const char *uri) +{ + Q_ASSERT(uri == QLatin1String("org.kde.latte.dock")); + + qmlRegisterUncreatableType(uri, 0, 1, "Types", "LatteDock Types uncreatable"); + + qmlRegisterType(uri, 0, 1, "WindowSystem"); +} diff --git a/libnowdock/nowdockplugin.h b/liblattedock/lattedockplugin.h similarity index 63% rename from libnowdock/nowdockplugin.h rename to liblattedock/lattedockplugin.h index 1a4dd835c..64d312cd5 100644 --- a/libnowdock/nowdockplugin.h +++ b/liblattedock/lattedockplugin.h @@ -1,9 +1,9 @@ -#ifndef NOWDOCKPLUGIN_H -#define NOWDOCKPLUGIN_H +#ifndef LATTEDOCKPLUGIN_H +#define LATTEDOCKPLUGIN_H #include -class NowDockPlugin : public QQmlExtensionPlugin { +class LatteDockPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") diff --git a/liblattedock/qmldir b/liblattedock/qmldir new file mode 100644 index 000000000..02729d107 --- /dev/null +++ b/liblattedock/qmldir @@ -0,0 +1,2 @@ +module org.kde.latte.dock +plugin lattedockplugin diff --git a/libnowdock/types.cpp b/liblattedock/types.cpp similarity index 100% rename from libnowdock/types.cpp rename to liblattedock/types.cpp diff --git a/libnowdock/types.h b/liblattedock/types.h similarity index 98% rename from libnowdock/types.h rename to liblattedock/types.h index 3b281cbb2..0ade4598b 100644 --- a/libnowdock/types.h +++ b/liblattedock/types.h @@ -5,7 +5,7 @@ #include #include -namespace NowDock { +namespace LatteDock { class Types { Q_GADGET diff --git a/libnowdock/windowsystem.cpp b/liblattedock/windowsystem.cpp similarity index 91% rename from libnowdock/windowsystem.cpp rename to liblattedock/windowsystem.cpp index 16ccb3c9c..b667d3f93 100644 --- a/libnowdock/windowsystem.cpp +++ b/liblattedock/windowsystem.cpp @@ -2,7 +2,7 @@ #include -namespace NowDock { +namespace LatteDock { WindowSystem::WindowSystem(QObject *parent) : QObject(parent) @@ -24,4 +24,4 @@ void WindowSystem::compositingChanged(bool state) emit compositingChanged(); } -} +} //end of namespace diff --git a/libnowdock/windowsystem.h b/liblattedock/windowsystem.h similarity index 86% rename from libnowdock/windowsystem.h rename to liblattedock/windowsystem.h index 04fdbad7c..9a0a17057 100644 --- a/libnowdock/windowsystem.h +++ b/liblattedock/windowsystem.h @@ -1,9 +1,9 @@ #ifndef WINDOWSYSTEM_H #define WINDOWSYSTEM_H -#include "abstractinterface.h" +#include -namespace NowDock { +namespace LatteDock { class WindowSystem : public QObject { Q_OBJECT @@ -23,6 +23,6 @@ private Q_SLOTS: void compositingChanged(bool state); }; -}//NowDock namespace +}//LatteDock namespace #endif diff --git a/libnowdock/CMakeLists.txt b/libnowdock/CMakeLists.txt deleted file mode 100644 index 5725f41cc..000000000 --- a/libnowdock/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -set (REQUIRED_QT_VERSION "5.6.0") - -find_package(ECM 1.8.0 REQUIRED NO_MODULE) -find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Quick Qml) - -find_package(KF5 REQUIRED COMPONENTS - Plasma - PlasmaQuick - WindowSystem - KDELibs4Support - CoreAddons -) - -set(CMAKE_AUTOMOC ON) - -set(nowdock_SRCS - nowdockplugin.cpp - panelwindow.cpp - windowsystem.cpp - xwindowinterface.cpp - abstractinterface.cpp - types.cpp -) - -add_library(nowdockplugin SHARED ${nowdock_SRCS}) - -target_link_libraries(nowdockplugin - Qt5::Quick - Qt5::Qml - KF5::Plasma - KF5::PlasmaQuick - KF5::WindowSystem - KF5::KDELibs4Support - KF5::CoreAddons -) - -install(TARGETS nowdockplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/nowdock) - -install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/nowdock) diff --git a/libnowdock/abstractinterface.cpp b/libnowdock/abstractinterface.cpp deleted file mode 100644 index 3153160b7..000000000 --- a/libnowdock/abstractinterface.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "abstractinterface.h" - -#include -#include - -namespace NowDock { - -AbstractInterface::AbstractInterface(QQuickWindow *dock) : - QObject(dock), - m_isDockWindowType(false), - m_dockNumber(0) -{ - m_dockWindow = dock; -} - -void AbstractInterface::setDockNumber(unsigned int no) -{ - if (m_dockNumber == no) { - return; - } - - m_dockNumber = no; - - emit dockNumberChanged(m_dockNumber); -} - -unsigned int AbstractInterface::dockNumber() const -{ - return m_dockNumber; -} - - -void AbstractInterface::setMaskArea(QRect area) -{ - if (m_maskArea == area) { - return; - } - - m_maskArea = area; -} - -} diff --git a/libnowdock/abstractinterface.h b/libnowdock/abstractinterface.h deleted file mode 100644 index df2b30d7b..000000000 --- a/libnowdock/abstractinterface.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef ABSTRACTINTERFACE_H -#define ABSTRACTINTERFACE_H - -#include -#include - -namespace NowDock { - -class AbstractInterface : public QObject { - Q_OBJECT - -public: - explicit AbstractInterface(QQuickWindow *dock); - - virtual bool activeIsDialog() const = 0; - virtual bool activeIsMaximized() const = 0; - virtual bool desktopIsActive() const = 0; - virtual bool dockIntersectsActiveWindow() const = 0; - virtual bool dockIsCovered(bool totally = false) const = 0; - virtual bool dockIsCovering() const = 0; - virtual bool dockIsOnTop() const = 0; - virtual bool dockInNormalState() const = 0; - virtual bool dockIsBelow() const = 0; - - //FIXME: This may not be needed, it would be better to investigate in KWindowSystem - //its behavior when setting the window type to NET::Dock - virtual void setDockDefaultFlags(bool dock = false) = 0; - virtual void setDockToAllDesktops() = 0; - virtual void showDockAsNormal() = 0; - virtual void showDockOnBottom() = 0; - virtual void showDockOnTop() = 0; - - void setDockNumber(unsigned int no); - unsigned int dockNumber() const; - - void setMaskArea(QRect area); - -Q_SIGNALS: - void activeWindowChanged(); - void dockNumberChanged(unsigned int no); - void windowInAttention(bool); - //FIXME: there is a chance that this signal is not needed at all - void windowChanged(); - -protected: - bool m_isDockWindowType; - int m_dockNumber; - - QRect m_maskArea; - - QQuickWindow *m_dockWindow; -}; - -} - -#endif diff --git a/libnowdock/nowdockplugin.cpp b/libnowdock/nowdockplugin.cpp deleted file mode 100644 index 313633ca1..000000000 --- a/libnowdock/nowdockplugin.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "nowdockplugin.h" -#include "panelwindow.h" -#include "windowsystem.h" -#include "types.h" - -#include - -void NowDockPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.nowdock")); - - qmlRegisterUncreatableType(uri, 0, 1, "Types", "NowDock Types uncreatable"); - - qmlRegisterType(uri, 0, 1, "PanelWindow"); - qmlRegisterType(uri, 0, 1, "WindowSystem"); -} - diff --git a/libnowdock/panelwindow.cpp b/libnowdock/panelwindow.cpp deleted file mode 100644 index ea1455a92..000000000 --- a/libnowdock/panelwindow.cpp +++ /dev/null @@ -1,1120 +0,0 @@ -#include "panelwindow.h" - -#include "xwindowinterface.h" -#include "windowsystem.h" - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -//#include -#include - -#include -#include -#include -#include -#include -#include - -namespace NowDock { - -PanelWindow::PanelWindow(QQuickWindow *parent) : - QQuickWindow(parent), - m_disableHiding(false), - m_immutable(true), - m_isAutoHidden(false), - m_isDockWindowType(false), - m_isHovered(false), - m_secondInitPass(false), - m_windowIsInAttention(false), - m_childrenLength(-1), - m_tempThickness(-1), - m_screen(0), - m_transient(0) -{ - setClearBeforeRendering(true); - setColor(QColor(Qt::transparent)); - setFlags(Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); - - m_windowSystem = new WindowSystem(this); - connect(m_windowSystem, SIGNAL(compositingChanged()), this, SLOT(compositingChanged())); - - m_interface = new XWindowInterface(this); - connect(m_interface, SIGNAL(windowInAttention(bool)), this, SLOT(setWindowInAttention(bool))); - connect(m_interface, SIGNAL(activeWindowChanged()), this, SLOT(activeWindowChanged())); - m_interface->setDockToAllDesktops(); - - connect(this, SIGNAL(screenChanged(QScreen *)), this, SLOT(screenChanged(QScreen *))); - setPanelScreen(screen()); - - m_updateStateTimer.setSingleShot(true); - m_updateStateTimer.setInterval(900); - connect(&m_updateStateTimer, &QTimer::timeout, this, &PanelWindow::updateState); - - m_initTimer.setSingleShot(true); - m_initTimer.setInterval(400); - connect(&m_initTimer, &QTimer::timeout, this, &PanelWindow::initWindow); - - m_triggerShrinkTransient.setSingleShot(true); - m_triggerShrinkTransient.setInterval(500); - connect(&m_triggerShrinkTransient, &QTimer::timeout, this, &PanelWindow::shrinkTransient); - - connect(this, SIGNAL(panelVisibilityChanged()), this, SLOT(updateVisibilityFlags())); - setPanelVisibility(BelowActive); - updateVisibilityFlags(); - - connect(this, SIGNAL(locationChanged()), this, SLOT(updateWindowPosition())); - connect(this, SIGNAL(windowInAttentionChanged()), this, SLOT(updateState())); - - initialize(); -} - -PanelWindow::~PanelWindow() -{ - qDebug() << "Destroying Now Dock - Magic Window"; -} - -QRect PanelWindow::maskArea() const -{ - return m_maskArea; -} - -void PanelWindow::setMaskArea(QRect area) -{ - if (m_maskArea == area) { - return; - } - - m_maskArea = area; - m_interface->setMaskArea(area); - - setMask(m_maskArea); - - emit maskAreaChanged(); -} - -Plasma::Types::Location PanelWindow::location() const -{ - return m_location; -} - -void PanelWindow::setLocation(Plasma::Types::Location location) -{ - if (m_location == location) { - return; - } - - m_location = location; - - setPanelOrientation(m_location); - - emit locationChanged(); -} - -unsigned int PanelWindow::maximumLength() const -{ - return m_maximumLength; -} - -void PanelWindow::updateMaximumLength() -{ - if (!transientParent()) { - return; - } - - unsigned int length = 0; - - if (m_panelOrientation == Qt::Horizontal) { - length = transientParent()->maximumWidth(); - } else { - length = transientParent()->maximumHeight(); - } - - if (m_maximumLength == length) { - return; - } - - m_maximumLength = length; - - emit maximumLengthChanged(); -} - -PanelWindow::PanelVisibility PanelWindow::panelVisibility() const -{ - return m_panelVisibility; -} - -void PanelWindow::setPanelVisibility(PanelWindow::PanelVisibility state) -{ - if (m_panelVisibility == state) { - return; - } - - m_panelVisibility = state; - emit panelVisibilityChanged(); -} - -QRect PanelWindow::screenGeometry() const -{ - return m_screenGeometry; -} - -void PanelWindow::setScreenGeometry(QRect geometry) -{ - if (m_screenGeometry == geometry) { - return; - } - - m_screenGeometry = geometry; - updateWindowPosition(); - - emit screenGeometryChanged(); -} - -bool PanelWindow::isAutoHidden() const -{ - return m_isAutoHidden; -} - -void PanelWindow::setIsAutoHidden(bool state) -{ - if (m_isAutoHidden == state) { - return; - } - - m_isAutoHidden = state; - emit isAutoHiddenChanged(); -} - - -bool PanelWindow::windowInAttention() const -{ - return m_windowIsInAttention; -} - -void PanelWindow::setWindowInAttention(bool state) -{ - if (m_windowIsInAttention == state) { - return; - } - - m_windowIsInAttention = state; - emit windowInAttentionChanged(); -} - -int PanelWindow::childrenLength() const -{ - return m_childrenLength; -} - -void PanelWindow::setChildrenLength(int value) -{ - if (m_childrenLength == value) { - return; - } - - m_childrenLength = value; - emit childrenLengthChanged(); -} - -bool PanelWindow::disableHiding() const -{ - return m_disableHiding; -} - -void PanelWindow::setDisableHiding(bool value) -{ - if (m_disableHiding == value) { - return; - } - - m_disableHiding = value; - - emit disableHidingChanged(); - - if (!m_disableHiding) { - m_updateStateTimer.start(); - } -} - -bool PanelWindow::isDockWindowType() const -{ - return m_isDockWindowType; -} - -void PanelWindow::setIsDockWindowType(bool state) -{ - if (m_isDockWindowType == state) { - return; - } - - m_isDockWindowType = state; - - updateVisibilityFlags(); - - emit isDockWindowTypeChanged(); - - m_updateStateTimer.start(); -} - - -bool PanelWindow::immutable() const -{ - return m_immutable; -} - -void PanelWindow::setImmutable(bool state) -{ - if (m_immutable == state) { - return; - } - - m_immutable = state; - - emit immutableChanged(); -} - - -bool PanelWindow::isHovered() const -{ - return m_isHovered; -} - -void PanelWindow::setIsHovered(bool state) -{ - if (m_isHovered == state) { - return; - } - - m_isHovered = state; - emit isHoveredChanged(); -} - -void PanelWindow::setPanelOrientation(Plasma::Types::Location location) -{ - if ((location == Plasma::Types::LeftEdge) || (location == Plasma::Types::RightEdge)) { - m_panelOrientation = Qt::Vertical; - } else { - m_panelOrientation = Qt::Horizontal; - } -} - -void PanelWindow::setPanelScreen(QScreen *screen) -{ - if ((m_screen == screen) || (!screen)) { - return; - } - - if (m_screen) { - // qDebug() << m_screen->geometry(); - disconnect(m_screen, SIGNAL(geometryChanged(QRect)), this, SLOT(setScreenGeometry(QRect))); - } - - m_screen = screen; - setScreenGeometry(screen->geometry()); - updateWindowPosition(); - - connect(m_screen, SIGNAL(geometryChanged(QRect)), this, SLOT(setScreenGeometry(QRect))); -} - -void PanelWindow::compositingChanged() -{ - if (m_windowSystem->compositingActive()) { - if (!m_triggerShrinkTransient.isActive()) { - m_triggerShrinkTransient.start(); - } - } -} - -//This calls a timer onX or onY change of the -//transient. Otherwise a loop is created all the time -//and hangs the thread -void PanelWindow::transientPositionChanged() -{ - if (!m_triggerShrinkTransient.isActive()) { - m_triggerShrinkTransient.start(); - } -} - -void PanelWindow::updateTransient() -{ - if (m_transient == transientParent()) { - return; - } - - if (m_transient) { - disconnect(m_transient, SIGNAL(xChanged(int)), this, SLOT(setTransient())); - disconnect(m_transient, SIGNAL(yChanged(int)), this, SLOT(setTransient())); - } - - m_transient = transientParent(); - - connect(m_transient, SIGNAL(xChanged(int)), this, SLOT(transientPositionChanged())); - connect(m_transient, SIGNAL(yChanged(int)), this, SLOT(transientPositionChanged())); - - shrinkTransient(); -} - -void PanelWindow::setTransientThickness(unsigned int thickness) -{ - QWindow *transient = transientParent(); - - if ((thickness > 0) && transient) { - unsigned int newSize = thickness; - - // qDebug() << "inside setTransientThickness"; - if (transient && transient->screen()) { - // qDebug() << "setTransientThickness: transientParent setting screen position..."; - setPanelScreen(transient->screen()); - } - - if (transient) { - if (m_location == Plasma::Types::BottomEdge) { - transient->setMinimumHeight(newSize); - transient->setMaximumHeight(newSize); - transient->setHeight(newSize); - transient->setWidth(m_maximumLength); - - transient->setY(m_screenGeometry.y() + m_screenGeometry.height() - newSize); - } else if (m_location == Plasma::Types::TopEdge) { - transient->setMinimumHeight(newSize); - transient->setMaximumHeight(newSize); - transient->setHeight(newSize); - transient->setWidth(m_maximumLength); - - transient->setY(m_screenGeometry.y()); - } else if (m_location == Plasma::Types::LeftEdge) { - transient->setMinimumWidth(newSize); - transient->setMaximumWidth(newSize); - transient->setWidth(newSize); - transient->setHeight(m_maximumLength); - - transient->setX(m_screenGeometry.x()); - } else if (m_location == Plasma::Types::RightEdge) { - transient->setMinimumWidth(newSize); - transient->setMaximumWidth(newSize); - transient->setWidth(newSize); - transient->setHeight(m_maximumLength); - - transient->setX(m_screenGeometry.x() + m_screenGeometry.width() - newSize); - } - - if (m_tempThickness < 0) { - m_tempThickness = newSize; - m_secondInitPass = false; - m_initTimer.start(); - } else { - m_tempThickness = -1; - } - } - } -} - -/******************************/ - -void PanelWindow::addAppletItem(QObject *item) -{ - PlasmaQuick::AppletQuickItem *dynItem = qobject_cast(item); - - //This is used in order to set the local containment variable - if (dynItem && !m_containment) { - Plasma::Applet *applet = dynItem->applet(); - - if (applet) { - m_containment = applet->containment(); - - //Count the NowDock's - //Notice: the Qt::Tool flag even though it works perfectly for a single Now Dock - //it creates a strange situation when there are two and more Now Dock's - //in that case it is used only for the first created Now Dock - //the following code sets the dock's number - Plasma::Corona *corona = m_containment->corona(); - int docks = 0; - - foreach (Plasma::Containment *con, corona->containments()) { - //DEPRECATED code: expecting Frameworks 5.28 to be general available to replace this code - KPluginInfo info = con->pluginInfo(); - - if (info.pluginName() == "org.kde.store.nowdock.panel") { - docks++; - - if (m_containment == con) { - m_interface->setDockNumber(docks); - m_interface->showDockOnTop(); - m_updateStateTimer.start(); - // qDebug() << "Now Dock Panels counter :" << docks; - break; - } - } - } - } - } - - if (!dynItem || m_appletItems.contains(dynItem)) { - return; - } - - m_appletItems.append(dynItem); -} - -void PanelWindow::removeAppletItem(QObject *item) -{ - PlasmaQuick::AppletQuickItem *dynItem = qobject_cast(item); - - if (!dynItem) { - return; - } - - m_appletItems.removeAll(dynItem); -} - -/*******************************/ - -void PanelWindow::initialize() -{ - m_secondInitPass = true; - m_initTimer.start(); -} - -void PanelWindow::initWindow() -{ - updateVisibilityFlags(); - updateTransient(); - - if (m_tempThickness > 0) { - setTransientThickness(m_tempThickness); - } - - updateWindowPosition(); - - // The initialization phase makes two passes because - // changing the window style and type wants a small delay - // and afterwards the second pass positions them correctly - if (m_secondInitPass) { - m_initTimer.start(); - m_secondInitPass = false; - } -} - -void PanelWindow::shrinkTransient() -{ - if (m_immutable && m_windowSystem->compositingActive() && transientParent()) { - // qDebug() <<"shrinkTransient: start..."; - - if (transientParent() && transientParent()->screen()) { - // qDebug() << "transientParent: setting screen position..."; - setPanelScreen(transientParent()->screen()); - } - - if (!m_screen) { - return; - } - - updateMaximumLength(); - - int newSize = 15; - int transWidth = transientParent()->width(); - int transHeight = transientParent()->height(); - int centerX = x() + width() / 2; - int centerY = y() + height() / 2; - - QWindow *transient = transientParent(); - int screenLength = ((m_location == Plasma::Types::BottomEdge) || (m_location == Plasma::Types::TopEdge)) ? - m_screenGeometry.width() : m_screenGeometry.height(); - - int tempLength = qMax(screenLength / 2, m_childrenLength); - - if (transient) { - if ((m_location == Plasma::Types::BottomEdge) || (m_location == Plasma::Types::TopEdge)) { - if (transient->height() != newSize) { - transient->setMinimumHeight(0); - transient->setHeight(newSize); - } - - if (transient->width() != tempLength) { - transient->setWidth(tempLength); - } - - int newX = centerX - transWidth / 2; - - if (transient->x() != newX) { - transient->setX(centerX - transWidth / 2); - } - - int newY = 0; - - if (m_location == Plasma::Types::BottomEdge) { - newY = m_screenGeometry.y() + m_screenGeometry.height() - newSize; - } else if (m_location == Plasma::Types::TopEdge) { - newY = m_screenGeometry.y(); - } - - if (transient->y() != newY) { - transient->setY(newY); - } - } else if ((m_location == Plasma::Types::LeftEdge) || (m_location == Plasma::Types::RightEdge)) { - if (transient->width() != newSize) { - transient->setMinimumWidth(0); - transient->setWidth(newSize); - } - - if (transient->height() != tempLength) { - transient->setHeight(tempLength); - } - - int newY = centerY - transHeight / 2; - - if (transient->y() != newY) { - transient->setY(newY); - } - - int newX = 0; - - if (m_location == Plasma::Types::LeftEdge) { - newX = m_screenGeometry.x(); - } else if (m_location == Plasma::Types::RightEdge) { - newX = m_screenGeometry.x() + m_screenGeometry.width() - newSize; - } - - if (transient->x() != newX) { - transient->setX(newX); - } - } - } - } -} - -void PanelWindow::updateWindowPosition() -{ - //setPanelScreen(screen()); - // qDebug() << "updateWindowPosition: start..."; - if (!transientParent() || !transientParent()->screen()) { - // qDebug() << "updateWindowPosition: break transient..."; - return; - } - - // qDebug() << "updateWindowPosition: transientParent setting screen position..."; - setPanelScreen(transientParent()->screen()); - - if (!m_screen || m_screenGeometry.isNull()) { - // qDebug() << "updateWindowPosition: break m_screen..."; - return; - } - - // qDebug() << "updateWindowPosition: check passed..."; - // qDebug() << m_screen->geometry().x() << " - " << m_screen->geometry().y() << " - " << m_screen->geometry().width() << " - " << m_screen->geometry().height(); - - if (m_location == Plasma::Types::BottomEdge) { - setX(m_screenGeometry.x()); - setY(m_screenGeometry.y() + m_screenGeometry.height() - height()); - } else if (m_location == Plasma::Types::TopEdge) { - setX(m_screenGeometry.x()); - setY(m_screenGeometry.y()); - } else if (m_location == Plasma::Types::LeftEdge) { - setX(m_screenGeometry.x()); - setY(m_screenGeometry.y()); - } else if (m_location == Plasma::Types::RightEdge) { - setX(m_screenGeometry.x() + m_screenGeometry.width() - width()); - setY(m_screenGeometry.y()); - } - - ///FIXME: in come cases the below can not catch up and this may be the reason - //that on start up in some cases dock's contents are not shown, - //needs a timer maybe? - /*if (m_screen != screen()) { - setScreen(m_screen); - }*/ -} - -void PanelWindow::updateVisibilityFlags() -{ - m_interface->setDockToAllDesktops(); - - /* if ((m_panelVisibility == AutoHide)||(m_isDockWindowType)) { - m_updateStateTimer.setInterval(2500); - } else { - m_updateStateTimer.setInterval(1500); - }*/ - - m_interface->setDockDefaultFlags(m_isDockWindowType); - updateWindowPosition(); - - if (!m_isDockWindowType) { - showOnTop(); - } - - m_updateStateTimer.start(); -} - -void PanelWindow::menuAboutToHide() -{ - setDisableHiding(false); - m_updateStateTimer.start(); -} - -/* - * It is used from the m_updateStateTimer in order to check the dock's - * visibility and trigger events and actions which are needed to - * respond accordingly - */ -void PanelWindow::updateState() -{ - // qDebug() << "in update state disableHiding:" <desktopIsActive() && m_interface->dockIntersectsActiveWindow()) { - if (m_interface->dockIsOnTop() || (m_isDockWindowType && !m_isAutoHidden)) { - // qDebug() << m_isHovered << " - " << m_windowIsInAttention << " - "<< m_disableHiding; - if (!m_isHovered && !m_windowIsInAttention && !m_disableHiding) { - // qDebug() << "must be lowered...."; - emit mustBeLowered(); //showNormal(); - } - } else { - if (m_windowIsInAttention) { - if (!m_isDockWindowType || (m_isDockWindowType && m_isAutoHidden)) { - emit mustBeRaised(); //showOnTop(); - } - } - } - } else { - if (!m_interface->activeIsDialog()) { - if ((!m_interface->desktopIsActive() && m_interface->dockIsCovered()) - || (m_isDockWindowType && m_isAutoHidden)) { - // qDebug() << "must be raised...."; - emit mustBeRaised(); - } else { - showOnTop(); - } - } - } - - break; - - case BelowMaximized: - if (!m_interface->desktopIsActive() && m_interface->activeIsMaximized() && m_interface->dockIntersectsActiveWindow()) { - if (m_interface->dockIsOnTop() || (m_isDockWindowType && !m_isAutoHidden)) { - if (!m_isHovered && !m_windowIsInAttention && !m_disableHiding) { - emit mustBeLowered(); //showNormal(); - } - } else { - if (m_windowIsInAttention) { - if (!m_isDockWindowType || (m_isDockWindowType && m_isAutoHidden)) { - emit mustBeRaised(); //showOnTop(); - } - } - } - } else { - if ((!m_interface->desktopIsActive() && m_interface->dockIsCovered()) - || (m_isDockWindowType && m_isAutoHidden)) { - emit mustBeRaised(); - } else { - showOnTop(); - } - } - - break; - - case LetWindowsCover: - - //this is not supported in clean Dock Window Types such as in wayland case - if (m_isDockWindowType) { - return; - } - - if (!m_isHovered && m_interface->dockIsOnTop()) { - if (m_interface->dockIsCovering()) { - if (!m_disableHiding) { - emit mustBeLowered(); - } - } else { - showOnBottom(); - } - } else if (m_windowIsInAttention) { - if (!m_interface->dockIsOnTop()) { - if (m_interface->dockIsCovered()) { - emit mustBeRaised(); - } else { - showOnTop(); - } - } - } - - break; - - case WindowsGoBelow: - //Do nothing, the dock is OnTop state in every case - break; - - case AutoHide: - if (m_windowIsInAttention && m_isAutoHidden) { - emit mustBeRaised(); - } else if (!m_isHovered && !m_disableHiding) { - emit mustBeLowered(); - } - - break; - - case AlwaysVisible: - //Do nothing, the dock in OnTop state in every case - break; - } - -} - -void PanelWindow::showOnTop() -{ - // qDebug() << "reached make top..."; - m_interface->showDockOnTop(); -} - -void PanelWindow::showNormal() -{ - // qDebug() << "reached make normal..."; - m_interface->showDockAsNormal(); -} - -void PanelWindow::showOnBottom() -{ - // qDebug() << "reached make bottom..."; - m_interface->showDockOnBottom(); -} - - -/***************/ -void PanelWindow::activeWindowChanged() -{ - if ((m_panelVisibility == WindowsGoBelow) - || (m_panelVisibility == AlwaysVisible) - || (m_panelVisibility == AutoHide)) { - return; - } - - //this check is important because otherwise the signals are so often - //that the timer is never triggered - if (!m_updateStateTimer.isActive()) { - m_updateStateTimer.start(); - } -} - - -//It is used in order to trigger a beautiful slide in effect when -//the dock is totally hidden underneath -void PanelWindow::showOnTopCheck() -{ - if ((m_panelVisibility == BelowActive) || (m_panelVisibility == BelowMaximized) - || (m_panelVisibility == LetWindowsCover)) { - if (m_interface->dockIsCovered(true)) { - m_updateStateTimer.stop(); - setIsHovered(true); - updateTransient(); - - emit mustBeRaisedImmediately(); - } else { - showOnTop(); - } - } -} - -bool PanelWindow::event(QEvent *event) -{ - if (!event) { - return false; - } - - if ((event->type() == QEvent::Enter) && !m_isHovered) { - m_updateStateTimer.stop(); - setIsHovered(true); - - updateTransient(); - - if ((m_panelVisibility == AutoHide) || (m_isDockWindowType)) { - if (m_isAutoHidden) { - emit mustBeRaised(); - } - } else { - showOnTop(); - } - } else if (event->type() == QEvent::Leave) { - setIsHovered(false); - - if ((m_panelVisibility != WindowsGoBelow) - && (m_panelVisibility != AlwaysVisible)) { - m_updateStateTimer.start(); - } - } - - return QQuickWindow::event(event); -} - -void PanelWindow::mouseReleaseEvent(QMouseEvent *event) -{ - if (!event || !m_containment) { - return; - } - - QQuickWindow::mouseReleaseEvent(event); - - event->setAccepted(m_containment->containmentActions().contains(Plasma::ContainmentActions::eventToString(event))); -} - -void PanelWindow::mousePressEvent(QMouseEvent *event) -{ - if (!event || !m_containment) { - return; - } - - QQuickWindow::mousePressEvent(event); - - //even if the menu is executed synchronously, other events may be processed - //by the qml incubator when plasma is loading, so we need to guard there - if (m_contextMenu) { - m_contextMenu.data()->close(); - return; - } - - const QString trigger = Plasma::ContainmentActions::eventToString(event); - Plasma::ContainmentActions *plugin = m_containment->containmentActions().value(trigger); - - if (!plugin || plugin->contextualActions().isEmpty()) { - event->setAccepted(false); - return; - } - - //the plugin can be a single action or a context menu - //Don't have an action list? execute as single action - //and set the event position as action data - if (plugin->contextualActions().length() == 1) { - QAction *action = plugin->contextualActions().at(0); - action->setData(event->pos()); - action->trigger(); - event->accept(); - return; - } - - //FIXME: very inefficient appletAt() implementation - Plasma::Applet *applet = 0; - - foreach (PlasmaQuick::AppletQuickItem *ai, m_appletItems) { - if (ai && ai->isVisible() && ai->contains(ai->mapFromItem(contentItem(), event->pos()))) { - applet = ai->applet(); - break; - } else { - ai = 0; - } - } - - QMenu *desktopMenu = new QMenu; - desktopMenu->setAttribute(Qt::WA_DeleteOnClose); - - m_contextMenu = desktopMenu; - - if (this->mouseGrabberItem()) { - //workaround, this fixes for me most of the right click menu behavior - if (applet) { - //DEPRECATED code: expecting Frameworks 5.28 to be general available to replace this code - KPluginInfo info = applet->pluginInfo(); - - //gives the systemtray direct right click behavior for its applets - if (info.pluginName() != "org.kde.plasma.systemtray") { - this->mouseGrabberItem()->ungrabMouse(); - } - } - - return; - } - - if (applet) { - emit applet->contextualActionsAboutToShow(); - addAppletActions(desktopMenu, applet, event); - } else { - emit m_containment->contextualActionsAboutToShow(); - addContainmentActions(desktopMenu, event); - } - - //this is a workaround where Qt now creates the menu widget - //in .exec before oxygen can polish it and set the following attribute - desktopMenu->setAttribute(Qt::WA_TranslucentBackground); - //end workaround - - QPoint pos = event->globalPos(); - - if (applet) { - desktopMenu->adjustSize(); - - QRect scr = m_screenGeometry; - - int smallStep = 3; - - int x = event->globalPos().x() + smallStep; - int y = event->globalPos().y() + smallStep; - - //qDebug()<globalPos().x() > scr.center().x()) { - x = event->globalPos().x() - desktopMenu->width() - smallStep; - } - - if (event->globalPos().y() > scr.center().y()) { - y = event->globalPos().y() - desktopMenu->height() - smallStep; - } - - pos = QPoint(x, y); - } - - if (desktopMenu->isEmpty()) { - delete desktopMenu; - event->accept(); - return; - } - - connect(desktopMenu, SIGNAL(aboutToHide()), this, SLOT(menuAboutToHide())); - setDisableHiding(true); - desktopMenu->popup(pos); - - event->setAccepted(true); -} - -void PanelWindow::addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, QEvent *event) -{ - if (!m_containment) { - return; - } - - foreach (QAction *action, applet->contextualActions()) { - if (action) { - desktopMenu->addAction(action); - } - } - - if (!applet->failedToLaunch()) { - QAction *runAssociatedApplication = applet->actions()->action(QStringLiteral("run associated application")); - - if (runAssociatedApplication && runAssociatedApplication->isEnabled()) { - desktopMenu->addAction(runAssociatedApplication); - } - - QAction *configureApplet = applet->actions()->action(QStringLiteral("configure")); - - if (configureApplet && configureApplet->isEnabled()) { - desktopMenu->addAction(configureApplet); - } - - QAction *appletAlternatives = applet->actions()->action(QStringLiteral("alternatives")); - - if (appletAlternatives && appletAlternatives->isEnabled()) { - desktopMenu->addAction(appletAlternatives); - } - } - - QMenu *containmentMenu = new QMenu(i18nc("%1 is the name of the containment", "%1 Options", m_containment->title()), desktopMenu); - addContainmentActions(containmentMenu, event); - - if (!containmentMenu->isEmpty()) { - int enabled = 0; - //count number of real actions - QListIterator actionsIt(containmentMenu->actions()); - - while (enabled < 3 && actionsIt.hasNext()) { - QAction *action = actionsIt.next(); - - if (action->isVisible() && !action->isSeparator()) { - ++enabled; - } - } - - if (enabled) { - //if there is only one, don't create a submenu - if (enabled < 2) { - foreach (QAction *action, containmentMenu->actions()) { - if (action->isVisible() && !action->isSeparator()) { - desktopMenu->addAction(action); - } - } - } else { - desktopMenu->addMenu(containmentMenu); - } - } - } - - if (m_containment->immutability() == Plasma::Types::Mutable && - (m_containment->containmentType() != Plasma::Types::PanelContainment || m_containment->isUserConfiguring())) { - QAction *closeApplet = applet->actions()->action(QStringLiteral("remove")); - - //qDebug() << "checking for removal" << closeApplet; - if (closeApplet) { - if (!desktopMenu->isEmpty()) { - desktopMenu->addSeparator(); - } - - //qDebug() << "adding close action" << closeApplet->isEnabled() << closeApplet->isVisible(); - desktopMenu->addAction(closeApplet); - } - } -} - - -void PanelWindow::addContainmentActions(QMenu *desktopMenu, QEvent *event) -{ - if (!m_containment) { - return; - } - - if (m_containment->corona()->immutability() != Plasma::Types::Mutable && - !KAuthorized::authorizeAction(QStringLiteral("plasma/containment_actions"))) { - //qDebug() << "immutability"; - return; - } - - //this is what ContainmentPrivate::prepareContainmentActions was - const QString trigger = Plasma::ContainmentActions::eventToString(event); - Plasma::ContainmentActions *plugin = m_containment->containmentActions().value(trigger); - - if (!plugin) { - return; - } - - if (plugin->containment() != m_containment) { - plugin->setContainment(m_containment); - - // now configure it - KConfigGroup cfg(m_containment->corona()->config(), "ActionPlugins"); - cfg = KConfigGroup(&cfg, QString::number(m_containment->containmentType())); - KConfigGroup pluginConfig = KConfigGroup(&cfg, trigger); - plugin->restore(pluginConfig); - } - - QList actions = plugin->contextualActions(); - - if (actions.isEmpty()) { - //it probably didn't bother implementing the function. give the user a chance to set - //a better plugin. note that if the user sets no-plugin this won't happen... - if ((m_containment->containmentType() != Plasma::Types::PanelContainment && - m_containment->containmentType() != Plasma::Types::CustomPanelContainment) && - m_containment->actions()->action(QStringLiteral("configure"))) { - desktopMenu->addAction(m_containment->actions()->action(QStringLiteral("configure"))); - } - } else { - desktopMenu->addActions(actions); - } - - return; -} - -void PanelWindow::screenChanged(QScreen *screen) -{ - // qDebug() << "screen changed..."; - setPanelScreen(screen); -} - -} //NowDock namespace diff --git a/libnowdock/panelwindow.h b/libnowdock/panelwindow.h deleted file mode 100644 index 9fa71bcfd..000000000 --- a/libnowdock/panelwindow.h +++ /dev/null @@ -1,203 +0,0 @@ -#ifndef PANELWINDOW_H -#define PANELWINDOW_H - -#include -#include -#include - -#include - -#include -#include -#include - -#include "abstractinterface.h" -#include "windowsystem.h" - -namespace NowDock { - -class PanelWindow : public QQuickWindow { - Q_OBJECT - Q_ENUMS(PanelVisibility) - Q_ENUMS(Alignment) - - Q_PROPERTY(bool disableHiding READ disableHiding WRITE setDisableHiding NOTIFY disableHidingChanged) - - Q_PROPERTY(bool immutable READ immutable WRITE setImmutable NOTIFY immutableChanged) - - Q_PROPERTY(bool isAutoHidden READ isAutoHidden WRITE setIsAutoHidden NOTIFY isAutoHiddenChanged) - - Q_PROPERTY(bool isDockWindowType READ isDockWindowType WRITE setIsDockWindowType NOTIFY isDockWindowTypeChanged) - - Q_PROPERTY(bool isHovered READ isHovered NOTIFY isHoveredChanged) - - Q_PROPERTY(bool windowInAttention READ windowInAttention WRITE setWindowInAttention NOTIFY windowInAttentionChanged) - - Q_PROPERTY(int childrenLength READ childrenLength WRITE setChildrenLength NOTIFY childrenLengthChanged) - - Q_PROPERTY(unsigned int maximumLength READ maximumLength NOTIFY maximumLengthChanged) - - /** - * the window mask, can be used in real transparent panels that set only the visual area - * of the window - * @since 5.8 - */ - Q_PROPERTY(QRect maskArea READ maskArea WRITE setMaskArea NOTIFY maskAreaChanged) - - /** - * the dock's screen geometry, e.g. it is used to set correctly x, y values - */ - Q_PROPERTY(QRect screenGeometry READ screenGeometry NOTIFY screenGeometryChanged) - - Q_PROPERTY(Plasma::Types::Location location READ location WRITE setLocation NOTIFY locationChanged) - - Q_PROPERTY(PanelVisibility panelVisibility READ panelVisibility WRITE setPanelVisibility NOTIFY panelVisibilityChanged) - -public: - enum PanelVisibility { - BelowActive = 0, /** always visible except if ovelaps with the active window, no area reserved */ - BelowMaximized, /** always visible except if ovelaps with an active maximize window, no area reserved */ - LetWindowsCover, /** always visible, windows will go over the panel, no area reserved */ - WindowsGoBelow, /** default, always visible, windows will go under the panel, no area reserved */ - AutoHide, /** the panel will be shownn only if the mouse cursor is on screen edges */ - AlwaysVisible, /** always visible panel, "Normal" plasma panel, accompanies plasma's "Always Visible" */ - }; - - enum Alignment { - Center = 0, - Left, - Right, - Top, - Bottom, - Double = 10 - }; - - explicit PanelWindow(QQuickWindow *parent = Q_NULLPTR); - ~PanelWindow(); - - bool disableHiding() const; - void setDisableHiding(bool state); - - bool immutable() const; - void setImmutable(bool state); - - bool isAutoHidden() const; - void setIsAutoHidden(bool state); - - bool isDockWindowType() const; - void setIsDockWindowType(bool state); - - bool isHovered() const; - - bool windowInAttention() const; - // void setWindowInAttention(bool state); - - int childrenLength() const; - void setChildrenLength(int value); - - unsigned int maximumLength() const; - - QRect maskArea() const; - void setMaskArea(QRect area); - - QRect screenGeometry() const; - - Plasma::Types::Location location() const; - void setLocation(Plasma::Types::Location location); - - PanelVisibility panelVisibility() const; - void setPanelVisibility(PanelVisibility state); - -Q_SIGNALS: - void childrenLengthChanged(); - void disableHidingChanged(); - void immutableChanged(); - void isAutoHiddenChanged(); - void isDockWindowTypeChanged(); - void isHoveredChanged(); - void locationChanged(); - void maskAreaChanged(); - void maximumLengthChanged(); - void mustBeLowered(); - void mustBeRaised(); //are used to triger the sliding animations from the qml part - void mustBeRaisedImmediately(); - void panelVisibilityChanged(); - void screenGeometryChanged(); - void windowInAttentionChanged(); - -public slots: - Q_INVOKABLE void addAppletItem(QObject *item); - Q_INVOKABLE void initialize(); - Q_INVOKABLE void removeAppletItem(QObject *item); - Q_INVOKABLE void setTransientThickness(unsigned int thickness); - Q_INVOKABLE void showNormal(); - Q_INVOKABLE void showOnTop(); - Q_INVOKABLE void showOnTopCheck(); - Q_INVOKABLE void showOnBottom(); - void setWindowInAttention(bool state); - - -protected: - bool event(QEvent *event) override; - void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - -private Q_SLOTS: - void activeWindowChanged(); - void compositingChanged(); - void updateState(); - void initWindow(); - void menuAboutToHide(); - void setIsHovered(bool state); - void screenChanged(QScreen *screen); - void setScreenGeometry(QRect geometry); - void shrinkTransient(); - void transientPositionChanged(); - void updateVisibilityFlags(); - void updateWindowPosition(); - -private: - bool m_disableHiding; - bool m_immutable; - bool m_isAutoHidden; - bool m_isDockWindowType; - bool m_isHovered; - //second pass of the initialization - bool m_secondInitPass; - bool m_windowIsInAttention; - - int m_childrenLength; - int m_tempThickness; - unsigned int m_maximumLength; - - QPointer m_containment; - QRect m_maskArea; - QRect m_screenGeometry; - QScreen *m_screen; - QList m_appletItems; - QTimer m_initTimer; - QTimer m_triggerShrinkTransient; - QTimer m_updateStateTimer; - QWeakPointer m_contextMenu; - QWindow *m_transient; - - Qt::Orientations m_panelOrientation; - - Plasma::Types::Location m_location; - - PanelVisibility m_panelVisibility; - - AbstractInterface *m_interface; - WindowSystem *m_windowSystem; - - void addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, QEvent *event); - void addContainmentActions(QMenu *desktopMenu, QEvent *event); - void setPanelOrientation(Plasma::Types::Location location); - void setPanelScreen(QScreen *screen); - void updateMaximumLength(); - void updateTransient(); -}; - -} //NowDock namespace - -#endif diff --git a/libnowdock/qmldir b/libnowdock/qmldir deleted file mode 100644 index 113d11478..000000000 --- a/libnowdock/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module org.kde.nowdock -plugin nowdockplugin diff --git a/libnowdock/xwindowinterface.cpp b/libnowdock/xwindowinterface.cpp deleted file mode 100644 index 530695c21..000000000 --- a/libnowdock/xwindowinterface.cpp +++ /dev/null @@ -1,361 +0,0 @@ -#include "xwindowinterface.h" - -#include - -#include -#include - -namespace NowDock { - -XWindowInterface::XWindowInterface(QQuickWindow *parent) : - AbstractInterface(parent), - m_demandsAttention(0) -{ - m_activeWindow = KWindowSystem::activeWindow(); - - connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(activeWindowChanged(WId))); - connect(KWindowSystem::self(), SIGNAL(windowChanged(WId, NET::Properties, NET::Properties2)), this, SLOT(windowChanged(WId, NET::Properties, NET::Properties2))); - connect(KWindowSystem::self(), SIGNAL(windowRemoved(WId)), this, SLOT(windowRemoved(WId))); - - connect(this, SIGNAL(dockNumberChanged(uint)), this, SLOT(dockNumberChanged(uint))); -} - -XWindowInterface::~XWindowInterface() -{ -} - -void XWindowInterface::dockNumberChanged(unsigned int no) -{ - if (no == 1) { - m_dockWindow->setFlags(Qt::Tool | Qt::WindowDoesNotAcceptFocus | Qt::FramelessWindowHint); - } -} - -void XWindowInterface::setDockToAllDesktops() -{ - KWindowSystem::setOnAllDesktops(m_dockWindow->winId(), true); -} - -void XWindowInterface::setDockDefaultFlags(bool dock) -{ - //Notice: the Qt::Tool flag even though it works perfectly for a single Now Dock - //it creates a strange situation when there are two and more Now Dock's - //in that case it is used only for the first created Now Dock - m_isDockWindowType = dock; - - if ((m_dockNumber == 1) && (!m_isDockWindowType)) { - m_dockWindow->setFlags(Qt::Tool | Qt::WindowDoesNotAcceptFocus | Qt::FramelessWindowHint); - } else { - KWindowSystem::setType(m_dockWindow->winId(), NET::Dock); - KWindowSystem::setState(m_dockWindow->winId(), NET::SkipTaskbar | NET::SkipPager); - } -} - -void XWindowInterface::showDockOnTop() -{ - //this is the only way in order to not break the case of two and more NowDocks - //there is a small issue that the pop ups from locked plasmoids are opened - //on the maximum thickness - - //qDebug() << "Docknumber:" << m_dockNumber; - if (m_isDockWindowType) { - return; - } - - if (m_dockNumber != 1) { - KWindowSystem::setType(m_dockWindow->winId(), NET::Dock); - } - - KWindowSystem::clearState(m_dockWindow->winId(), NET::KeepBelow); - KWindowSystem::setState(m_dockWindow->winId(), NET::KeepAbove); -} - -void XWindowInterface::showDockAsNormal() -{ - // qDebug() << "reached make normal..."; - if (m_isDockWindowType) { - return; - } - - if (m_dockNumber != 1) { - m_dockWindow->setFlags(Qt::Tool | Qt::WindowDoesNotAcceptFocus | Qt::FramelessWindowHint); - } - - KWindowSystem::clearState(m_dockWindow->winId(), NET::KeepAbove); - KWindowSystem::clearState(m_dockWindow->winId(), NET::KeepBelow); -} - -void XWindowInterface::showDockOnBottom() -{ - // qDebug() << "reached make bottom..."; - if (m_isDockWindowType) { - return; - } - - if (m_dockNumber != 1) { - m_dockWindow->setFlags(Qt::Tool | Qt::WindowDoesNotAcceptFocus | Qt::FramelessWindowHint); - } - - KWindowSystem::clearState(m_dockWindow->winId(), NET::KeepAbove); - KWindowSystem::setState(m_dockWindow->winId(), NET::KeepBelow); -} - - -bool XWindowInterface::isDesktop(WId id) const -{ - KWindowInfo info(id, NET::WMWindowType); - - if (!info.valid()) { - return false; - } - - NET::WindowType type = info.windowType(NET::DesktopMask | NET::DockMask | NET::DialogMask); - - return type == NET::Desktop; -} - -bool XWindowInterface::isDialog(WId id) const -{ - KWindowInfo info(id, NET::WMWindowType); - - if (!info.valid()) { - return false; - } - - NET::WindowType type = info.windowType(NET::DesktopMask | NET::DockMask | NET::DialogMask); - - return type == NET::Dialog; -} - -bool XWindowInterface::isMaximized(WId id) const -{ - KWindowInfo info(id, NET::WMState); - - if (!info.valid()) { - return false; - } - - return (info.hasState(NET::Max)); -} - -bool XWindowInterface::isNormal(WId id) const -{ - return (!isOnBottom(id) && !isOnTop(id)); -} - -bool XWindowInterface::isOnBottom(WId id) const -{ - KWindowInfo info(id, NET::WMState); - - if (!info.valid()) { - return false; - } - - return (info.hasState(NET::KeepBelow)); -} - -bool XWindowInterface::isOnTop(WId id) const -{ - KWindowInfo info(id, NET::WMState); - - if (!info.valid()) { - return false; - } - - return (info.hasState(NET::KeepAbove)); -} - -bool XWindowInterface::activeIsDialog() const -{ - return isDialog(m_activeWindow); -} - -bool XWindowInterface::activeIsMaximized() const -{ - return isMaximized(m_activeWindow); -} - - -bool XWindowInterface::desktopIsActive() const -{ - return isDesktop(m_activeWindow); -} - -bool XWindowInterface::dockIsOnTop() const -{ - return isOnTop(m_dockWindow->winId()); - -} - -bool XWindowInterface::dockInNormalState() const -{ - return isNormal(m_dockWindow->winId()); -} - -bool XWindowInterface::dockIsBelow() const -{ - return isOnBottom(m_dockWindow->winId()); -} - -bool XWindowInterface::dockIntersectsActiveWindow() const -{ - KWindowInfo activeInfo(m_activeWindow, NET::WMGeometry); - - if (activeInfo.valid()) { - QRect maskSize; - - if (!m_maskArea.isNull()) { - maskSize = QRect(m_dockWindow->x() + m_maskArea.x(), m_dockWindow->y() + m_maskArea.y(), m_maskArea.width(), m_maskArea.height()); - } else { - maskSize = QRect(m_dockWindow->x(), m_dockWindow->y(), m_dockWindow->width(), m_dockWindow->height()); - } - - return maskSize.intersects(activeInfo.geometry()); - } else { - return false; - } -} - - -bool XWindowInterface::dockIsCovered(bool totally) const -{ - int currentDockPos = -1; - - QList windows = KWindowSystem::stackingOrder(); - int size = windows.count(); - - for (int i = size - 1; i >= 0; --i) { - WId window = windows.at(i); - - if (window == m_dockWindow->winId()) { - currentDockPos = i; - break; - } - } - - if (currentDockPos >= 0) { - QRect maskSize; - - if (!m_maskArea.isNull()) { - maskSize = QRect(m_dockWindow->x() + m_maskArea.x(), m_dockWindow->y() + m_maskArea.y(), m_maskArea.width(), m_maskArea.height()); - } else { - maskSize = QRect(m_dockWindow->x(), m_dockWindow->y(), m_dockWindow->width(), m_dockWindow->height()); - } - - WId transient = 0; - - if (m_dockWindow->transientParent()) { - transient = m_dockWindow->transientParent()->winId(); - } - - for (int j = size - 1; j > currentDockPos; --j) { - WId window = windows.at(j); - - KWindowInfo info(window, NET::WMState | NET::XAWMState | NET::WMGeometry); - - if (info.valid() && !isDesktop(window) && transient != window && !info.isMinimized()) { - if (totally) { - QRect winGeometry = info.geometry(); - - if ((maskSize.left() >= winGeometry.left()) && (maskSize.top() >= winGeometry.top()) - && (maskSize.right() <= winGeometry.right()) && (maskSize.bottom() <= winGeometry.bottom())) { - return true; - } - } else { - if (maskSize.intersects(info.geometry())) { - return true; - } - } - } - } - } - - return false; -} - -bool XWindowInterface::dockIsCovering() const -{ - int currentDockPos = -1; - - QList windows = KWindowSystem::stackingOrder(); - int size = windows.count(); - - for (int i = size - 1; i >= 0; --i) { - WId window = windows.at(i); - - if (window == m_dockWindow->winId()) { - currentDockPos = i; - break; - } - } - - if (currentDockPos >= 0) { - QRect maskSize; - - if (!m_maskArea.isNull()) { - maskSize = QRect(m_dockWindow->x() + m_maskArea.x(), m_dockWindow->y() + m_maskArea.y(), m_maskArea.width(), m_maskArea.height()); - } else { - maskSize = QRect(m_dockWindow->x(), m_dockWindow->y(), m_dockWindow->width(), m_dockWindow->height()); - } - - WId transient = 0; - - if (m_dockWindow->transientParent()) { - transient = m_dockWindow->transientParent()->winId(); - } - - for (int j = currentDockPos - 1; j >= 0; --j) { - WId window = windows.at(j); - - KWindowInfo info(window, NET::WMState | NET::XAWMState | NET::WMGeometry); - - if (info.valid() && !isDesktop(window) && transient != window && !info.isMinimized() && maskSize.intersects(info.geometry())) { - return true; - } - } - } - - return false; -} - -/* - * SLOTS - */ - -void XWindowInterface::activeWindowChanged(WId win) -{ - m_activeWindow = win; - - emit AbstractInterface::activeWindowChanged(); -} - -void XWindowInterface::windowChanged(WId id, NET::Properties properties, NET::Properties2 properties2) -{ - KWindowInfo info(id, NET::WMState | NET::CloseWindow); - - if (info.valid()) { - if ((m_demandsAttention == 0) && info.hasState(NET::DemandsAttention)) { - m_demandsAttention = id; - emit windowInAttention(true); - } else if ((m_demandsAttention == id) && !info.hasState(NET::DemandsAttention)) { - m_demandsAttention = 0; - emit windowInAttention(false); - } - } - - // emit AbstractInterface::windowChanged(); - - if (id == m_activeWindow) { - emit AbstractInterface::activeWindowChanged(); - } -} - -void XWindowInterface::windowRemoved(WId id) -{ - if (id == m_demandsAttention) { - m_demandsAttention = 0; - emit AbstractInterface::windowInAttention(false); - } -} - -} diff --git a/libnowdock/xwindowinterface.h b/libnowdock/xwindowinterface.h deleted file mode 100644 index 178687e77..000000000 --- a/libnowdock/xwindowinterface.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef XWINDOWINTERFACE_H -#define XWINDOWINTERFACE_H - -#include - -#include - -#include "abstractinterface.h" - -namespace NowDock { - -class XWindowInterface : public AbstractInterface { - Q_OBJECT - -public: - explicit XWindowInterface(QQuickWindow *parent); - ~XWindowInterface(); - - bool activeIsDialog() const; - bool activeIsMaximized() const; - bool dockIntersectsActiveWindow() const; - bool desktopIsActive() const; - bool dockIsCovered(bool totally = false) const; - bool dockIsCovering() const; - bool dockIsOnTop() const; - bool dockInNormalState() const; - bool dockIsBelow() const; - - void setDockDefaultFlags(bool dock = false); - void setDockToAllDesktops(); - void setDockToAlwaysVisible(); - void showDockAsNormal(); - void showDockOnBottom(); - void showDockOnTop(); - -private Q_SLOTS: - void activeWindowChanged(WId win); - void dockNumberChanged(unsigned int no); - void windowChanged(WId id, NET::Properties properties, NET::Properties2 properties2); - void windowRemoved(WId id); - -private: - WId m_activeWindow; - WId m_demandsAttention; - - bool isDesktop(WId id) const; - bool isDialog(WId id) const; - bool isMaximized(WId id) const; - bool isNormal(WId id) const; - bool isOnBottom(WId id) const; - bool isOnTop(WId id) const; -}; - -} - -#endif - - - - diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index fcdebe97a..677278086 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -29,7 +29,7 @@ import org.kde.plasma.private.taskmanager 0.1 as TaskManagerApplet import org.kde.activities 0.1 as Activities -import org.kde.nowdock 0.1 as NowDock +import org.kde.latte.dock 0.1 as LatteDock import "../code/tools.js" as TaskTools import "../code/activitiesTools.js" as ActivitiesTools @@ -217,7 +217,7 @@ Item { // FIXME: at some point this must be dropped with NowDock plugin ////BEGIN interfaces - NowDock.WindowSystem{ + LatteDock.WindowSystem{ id:windowSystem } @@ -994,7 +994,7 @@ Item { ///Bottom Edge State { name: "bottomCenter" - when: (panel.position === PlasmaCore.Types.BottomPosition && userPanelPosition===NowDock.Types.Center) + when: (panel.position === PlasmaCore.Types.BottomPosition && userPanelPosition===LatteDock.Types.Center) AnchorChanges { target: barLine @@ -1007,7 +1007,7 @@ Item { }, State { name: "bottomLeft" - when: (panel.position === PlasmaCore.Types.BottomPosition && userPanelPosition===NowDock.Types.Left) + when: (panel.position === PlasmaCore.Types.BottomPosition && userPanelPosition===LatteDock.Types.Left) AnchorChanges { target: barLine @@ -1020,7 +1020,7 @@ Item { }, State { name: "bottomRight" - when: (panel.position === PlasmaCore.Types.BottomPosition && userPanelPosition===NowDock.Types.Right) + when: (panel.position === PlasmaCore.Types.BottomPosition && userPanelPosition===LatteDock.Types.Right) AnchorChanges { target: barLine @@ -1034,7 +1034,7 @@ Item { ///Top Edge State { name: "topCenter" - when: (panel.position === PlasmaCore.Types.TopPosition && userPanelPosition===NowDock.Types.Center) + when: (panel.position === PlasmaCore.Types.TopPosition && userPanelPosition===LatteDock.Types.Center) AnchorChanges { target: barLine @@ -1047,7 +1047,7 @@ Item { }, State { name: "topLeft" - when: (panel.position === PlasmaCore.Types.TopPosition && userPanelPosition===NowDock.Types.Left) + when: (panel.position === PlasmaCore.Types.TopPosition && userPanelPosition===LatteDock.Types.Left) AnchorChanges { target: barLine @@ -1060,7 +1060,7 @@ Item { }, State { name: "topRight" - when: (panel.position === PlasmaCore.Types.TopPosition && userPanelPosition===NowDock.Types.Right) + when: (panel.position === PlasmaCore.Types.TopPosition && userPanelPosition===LatteDock.Types.Right) AnchorChanges { target: barLine @@ -1074,7 +1074,7 @@ Item { ////Left Edge State { name: "leftCenter" - when: (panel.position === PlasmaCore.Types.LeftPosition && userPanelPosition===NowDock.Types.Center) + when: (panel.position === PlasmaCore.Types.LeftPosition && userPanelPosition===LatteDock.Types.Center) AnchorChanges { target: barLine @@ -1087,7 +1087,7 @@ Item { }, State { name: "leftTop" - when: (panel.position === PlasmaCore.Types.LeftPosition && userPanelPosition===NowDock.Types.Top) + when: (panel.position === PlasmaCore.Types.LeftPosition && userPanelPosition===LatteDock.Types.Top) AnchorChanges { target: barLine @@ -1100,7 +1100,7 @@ Item { }, State { name: "leftBottom" - when: (panel.position === PlasmaCore.Types.LeftPosition && userPanelPosition===NowDock.Types.Bottom) + when: (panel.position === PlasmaCore.Types.LeftPosition && userPanelPosition===LatteDock.Types.Bottom) AnchorChanges { target: barLine @@ -1114,7 +1114,7 @@ Item { ///Right Edge State { name: "rightCenter" - when: (panel.position === PlasmaCore.Types.RightPosition && userPanelPosition===NowDock.Types.Center) + when: (panel.position === PlasmaCore.Types.RightPosition && userPanelPosition===LatteDock.Types.Center) AnchorChanges { target: barLine @@ -1127,7 +1127,7 @@ Item { }, State { name: "rightTop" - when: (panel.position === PlasmaCore.Types.RightPosition && userPanelPosition===NowDock.Types.Top) + when: (panel.position === PlasmaCore.Types.RightPosition && userPanelPosition===LatteDock.Types.Top) AnchorChanges { target: barLine @@ -1140,7 +1140,7 @@ Item { }, State { name: "rightBottom" - when: (panel.position === PlasmaCore.Types.RightPosition && userPanelPosition===NowDock.Types.Bottom) + when: (panel.position === PlasmaCore.Types.RightPosition && userPanelPosition===LatteDock.Types.Bottom) AnchorChanges { target: barLine diff --git a/shell/contents/configuration/NowDockConfiguration.qml b/shell/contents/configuration/NowDockConfiguration.qml index e9623375e..99c4919e4 100644 --- a/shell/contents/configuration/NowDockConfiguration.qml +++ b/shell/contents/configuration/NowDockConfiguration.qml @@ -8,7 +8,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.plasmoid 2.0 -import org.kde.nowdock 0.1 as NowDock +import org.kde.latte.dock 0.1 as LatteDock PlasmaCore.FrameSvgItem { imagePath: "dialogs/background" @@ -65,28 +65,28 @@ PlasmaCore.FrameSvgItem { function updatePanelPositionVisual(){ - if((panelPosition == NowDock.Types.Left)||(panelPosition == NowDock.Types.Top)){ + if((panelPosition == LatteDock.Types.Left)||(panelPosition == LatteDock.Types.Top)){ firstPosition.checked = true; centerPosition.checked = false; lastPosition.checked = false; splitTwoPosition.checked = false; removeInternalViewSplitter(); } - else if(panelPosition == NowDock.Types.Center){ + else if(panelPosition == LatteDock.Types.Center){ firstPosition.checked = false; centerPosition.checked = true; lastPosition.checked = false; splitTwoPosition.checked = false; removeInternalViewSplitter(); } - else if((panelPosition == NowDock.Types.Right)||(panelPosition == NowDock.Types.Bottom)){ + else if((panelPosition == LatteDock.Types.Right)||(panelPosition == LatteDock.Types.Bottom)){ firstPosition.checked = false; centerPosition.checked = false; lastPosition.checked = true; splitTwoPosition.checked = false; removeInternalViewSplitter(); } - else if (panelPosition == NowDock.Types.Double){ + else if (panelPosition == LatteDock.Types.Double){ firstPosition.checked = false; centerPosition.checked = false; lastPosition.checked = false; @@ -112,9 +112,9 @@ PlasmaCore.FrameSvgItem { onCheckedChanged: { if(checked && !parent.inStartup){ if(panelIsVertical) - plasmoid.configuration.panelPosition = NowDock.Types.Top + plasmoid.configuration.panelPosition = LatteDock.Types.Top else - plasmoid.configuration.panelPosition = NowDock.Types.Left + plasmoid.configuration.panelPosition = LatteDock.Types.Left } } onClicked: checked=true; @@ -127,7 +127,7 @@ PlasmaCore.FrameSvgItem { onCheckedChanged: { if(checked && !parent.inStartup){ - plasmoid.configuration.panelPosition = NowDock.Types.Center + plasmoid.configuration.panelPosition = LatteDock.Types.Center } } onClicked: checked=true; @@ -141,9 +141,9 @@ PlasmaCore.FrameSvgItem { onCheckedChanged: { if(checked && !parent.inStartup){ if(panelIsVertical) - plasmoid.configuration.panelPosition = NowDock.Types.Bottom + plasmoid.configuration.panelPosition = LatteDock.Types.Bottom else - plasmoid.configuration.panelPosition = NowDock.Types.Right + plasmoid.configuration.panelPosition = LatteDock.Types.Right } } onClicked: checked=true; @@ -157,7 +157,7 @@ PlasmaCore.FrameSvgItem { onCheckedChanged: { if(checked && !parent.inStartup){ - plasmoid.configuration.panelPosition = NowDock.Types.Double; + plasmoid.configuration.panelPosition = LatteDock.Types.Double; } } onClicked: checked=true;