diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 23e9ad4e5..b275c8c86 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -186,7 +186,6 @@ Item { property alias tasksCount: tasksModel.count property alias hoveredIndex: icList.hoveredIndex - property QtObject altSessionAction : latteDock ? latteDock.altSessionAction : null property QtObject currentLayout : latteDock && latteDock.universalLayoutManager && latteDock.universalLayoutManager.currentLayout ? latteDock.universalLayoutManager.currentLayout : null @@ -429,7 +428,52 @@ Item { } } - /////Winwow previews/////////// + /////BEGIN: Title Tooltip/////////// + PlasmaCore.Dialog{ + id: titleTooltipDlg + + type: PlasmaCore.Dialog.Tooltip + flags: Qt.WindowStaysOnTopHint | Qt.WindowDoesNotAcceptFocus | Qt.ToolTip + + location: plasmoid.location + mainItem: Item{ + width: titleLbl.width + height: titleLbl.height + PlasmaComponents.Label{ + id:titleLbl + text: titleTooltipDlg.title + } + } + + visible: false + + property Item activeItem: null + property string title: "" + + Component.onCompleted: { + root.clearZoomSignal.connect(titleTooltipDlg.hide); + } + + function hide(debug){ + visible = false; + } + + function show(taskItem, text){ + if (activeItem !== taskItem) { + activeItem = taskItem; + visualParent = taskItem.tooltipVisualParent; + titleTooltipDlg.title = text; + } + + if (!visible) { + visible = true; + } + } + } + /////END: Title Tooltip/////////// + + + /////Window previews/////////// ToolTipDelegate2 { id: toolTipDelegate @@ -1441,6 +1485,10 @@ Item { } } + if (titleTooltipDlg.visible) { + titleTooltipDlg.hide(); + } + return false; } diff --git a/plasmoid/package/contents/ui/task/TaskDelegate.qml b/plasmoid/package/contents/ui/task/TaskDelegate.qml index 21c85100e..7da7c9153 100644 --- a/plasmoid/package/contents/ui/task/TaskDelegate.qml +++ b/plasmoid/package/contents/ui/task/TaskDelegate.qml @@ -127,6 +127,8 @@ MouseArea{ property string launcherUrl: "" property string launcherUrlWithIcon: "" + property Item tooltipVisualParent: wrapper.titleTooltipVisualParent + onModelLauncherUrlChanged: { if (modelLauncherUrl !== "") launcherUrl = modelLauncherUrl; @@ -536,6 +538,10 @@ MouseArea{ return; } + + titleTooltipDlg.show(mainItemContainer, model.AppName); + + if((!inAnimation)&&(root.dragSource == null)&&(!root.taskInAnimation) && hoverEnabled){ icList.hoveredIndex = index; if (!inBlockingAnimation) { diff --git a/plasmoid/package/contents/ui/task/TaskIconItem.qml b/plasmoid/package/contents/ui/task/TaskIconItem.qml index 2654957cb..2da5e61a8 100644 --- a/plasmoid/package/contents/ui/task/TaskIconItem.qml +++ b/plasmoid/package/contents/ui/task/TaskIconItem.qml @@ -66,6 +66,7 @@ Item{ property QtObject buffers: null property QtObject smartLauncherItem: null + property Item titleTooltipVisualParent: titleTooltipParent /*Rectangle{ anchors.fill: parent border.width: 1 @@ -105,12 +106,7 @@ Item{ onTempColorChanged: tempColor.a = 0.35; } - /* Rectangle{ - anchors.fill: parent - border.width: 1 - border.color: "red" - color: "transparent" - } */ + TitleTooltipParent{ id: titleTooltipParent} // KQuickControlAddons.QIconItem{ Item{ diff --git a/plasmoid/package/contents/ui/task/TaskWrapper.qml b/plasmoid/package/contents/ui/task/TaskWrapper.qml index c422641bb..435a92329 100644 --- a/plasmoid/package/contents/ui/task/TaskWrapper.qml +++ b/plasmoid/package/contents/ui/task/TaskWrapper.qml @@ -1,3 +1,23 @@ +/* +* Copyright 2016 Smith AR +* Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* Latte-Dock is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + import QtQuick 2.0 import org.kde.plasma.core 2.0 as PlasmaCore @@ -79,6 +99,8 @@ Item{ // property int index: mainItemContainer.Positioner.index property real center: (width + hiddenSpacerLeft.separatorSpace + hiddenSpacerRight.separatorSpace) / 2 + property Item titleTooltipVisualParent: taskIconItem.titleTooltipVisualParent + signal runLauncherAnimation(); /* Rectangle{ @@ -126,7 +148,7 @@ Item{ } } - TaskIconItem{} + TaskIconItem{ id: taskIconItem} Loader{ id: secondIndicator diff --git a/plasmoid/package/contents/ui/task/TitleTooltipParent.qml b/plasmoid/package/contents/ui/task/TitleTooltipParent.qml new file mode 100644 index 000000000..e1d7aa736 --- /dev/null +++ b/plasmoid/package/contents/ui/task/TitleTooltipParent.qml @@ -0,0 +1,79 @@ +/* +* Copyright 2017 Smith AR +* Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* Latte-Dock is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +import QtQuick 2.0 + +import org.kde.plasma.core 2.0 as PlasmaCore + +Item{ + id: visual + width: root.zoomFactor * root.realSize + height: width + //border.width: 1 + //border.color: "green" + //color: "transparent" + + states:[ + State{ + name: "bottom" + when: root.position === PlasmaCore.Types.BottomPositioned + + AnchorChanges{ + target: visual; + anchors.horizontalCenter: parent.horizontalCenter; + anchors.verticalCenter: undefined; + anchors.right: undefined; anchors.left: undefined; anchors.top: undefined; anchors.bottom: parent.bottom; + } + }, + State{ + name: "top" + when: root.position === PlasmaCore.Types.TopPositioned + + AnchorChanges{ + target:visual; + anchors.horizontalCenter: parent.horizontalCenter; + anchors.verticalCenter: undefined; + anchors.right: undefined; anchors.left: undefined; anchors.top: parent.top; anchors.bottom: undefined; + } + }, + State{ + name: "left" + when: root.position === PlasmaCore.Types.LeftPositioned + + AnchorChanges{ + target: visual; + anchors.horizontalCenter: undefined; + anchors.verticalCenter: parent.verticalCenter; + anchors.right: undefined; anchors.left: parent.left; anchors.top: undefined; anchors.bottom: undefined; + } + }, + State{ + name: "right" + when: root.position === PlasmaCore.Types.RightPositioned + + AnchorChanges{ + target: visual; + anchors.horizontalCenter: undefined; + anchors.verticalCenter: parent.verticalCenter; + anchors.right: parent.right; anchors.left: undefined; anchors.top: undefined; anchors.bottom: undefined; + } + } + ] +}