1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-25 19:21:41 +03:00

Tasks Previews multiple fixes

--provide an option for previews to work as a
popup window[new] or as tooltip[classic]
--multiple fixes to show/hide previews based on
user preferences from left click and hovering
a task
--move the active window line as the last item
of Preview column in order to be always drawn and
never overlap with previews or previous items
This commit is contained in:
Michail Vourlakos 2020-05-26 22:02:58 +03:00
parent 3c617a36c8
commit 95dfbfd919
5 changed files with 60 additions and 24 deletions

View File

@ -75,6 +75,10 @@
<default>false</default>
<label>When "true" Latte color palette is used in order to provide monochromatic icons at all times. It is not needed in general and can be used only with specific icon themes</label>
</entry>
<entry name="previewWindowAsPopup" type="Bool">
<default>false</default>
<label>When "true" Preview window behaves as popup</label>
</entry>
<!-- MERGED FROM CONTAINMENT -->
<!-- _______________________ -->

View File

@ -471,10 +471,9 @@ Item {
}
function forcePreviewsHiding(debug) {
//console.log(" Tasks: Force hide previews event called: "+debug);
windowsPreviewDlg.visible = false;
windowsPreviewDlg.mainItem.visible = false;
// console.log(" org.kde.latte Tasks: Force hide previews event called: "+debug);
windowsPreviewDlg.activeItem = null;
windowsPreviewDlg.visible = false;
}
function hidePreview(){
@ -503,9 +502,9 @@ Item {
LatteTasks.Dialog{
id: windowsPreviewDlg
// hideOnWindowDeactivate: false
type: PlasmaCore.Dialog.Tooltip
flags: Qt.WindowStaysOnTopHint | Qt.WindowDoesNotAcceptFocus | Qt.ToolTip
type: plasmoid.configuration.previewWindowAsPopup ? PlasmaCore.Dialog.PopupMenu : PlasmaCore.Dialog.Tooltip
flags: plasmoid.configuration.previewWindowAsPopup ? Qt.WindowStaysOnTopHint | Qt.WindowDoesNotAcceptFocus | Qt.Popup :
Qt.WindowStaysOnTopHint | Qt.WindowDoesNotAcceptFocus | Qt.ToolTip
location: root.location
mainItem: toolTipDelegate
@ -596,7 +595,7 @@ Item {
&& mouseHandler.hoveredItem === windowsPreviewDlg.activeItem));
if (!contains) {
root.forcePreviewsHiding();
root.forcePreviewsHiding(9.9);
}
}
}

View File

@ -163,11 +163,12 @@ Column {
// thumbnail container
Item {
id: thumbnail
anchors.horizontalCenter: parent.horizontalCenter
width: header.width
// similar to 0.5625 = 1 / (16:9) as most screens are
// round necessary, otherwise shadow mask for players has gap!
height: Math.round(0.5 * width) + (!winTitle.visible? Math.round(winTitle.height) : 0)
anchors.horizontalCenter: parent.horizontalCenter
visible: isWin
@ -371,15 +372,14 @@ Column {
}
}
}
}
//active window line
Rectangle{
width: parent.width
height: 2
color: isTaskActive() ? theme.buttonFocusColor : theme.buttonHoverColor
anchors.bottom: parent.bottom
visible: isTaskActive() || area2.containsMouse
}
//active window line
Rectangle{
width: header.width
height: 3
opacity: isTaskActive() || area2.containsMouse ? 1 : 0 /*this way avoid trebbling when moving from task to task in groups*/
color: isTaskActive() ? theme.buttonFocusColor : theme.buttonHoverColor
}
function generateTitle() {

View File

@ -124,6 +124,9 @@ MouseArea{
property bool inPopup: false
property bool inRemoveStage: false
//! after clicking to show/hide preview enter events are trigerred even though the should not
property bool showPreviewsIsBlockedFromReleaseEvent: false
property bool isAbleToShowPreview: true
property bool isActive: (IsActive === true) ? true : false
property bool isDemandingAttention: (IsDemandingAttention === true) ? true : false
@ -336,9 +339,9 @@ MouseArea{
&& !root.dragSource ){
taskItem.groupWindowAdded();
} else if ((windowsCount >= 1)
&& (windowsCount < previousCount)
&& !root.dragSource
&& !taskItem.delayingRemove){
&& (windowsCount < previousCount)
&& !root.dragSource
&& !taskItem.delayingRemove){
//sometimes this is triggered in dragging with no reason
taskItem.groupWindowRemoved();
}
@ -644,7 +647,10 @@ MouseArea{
}
//! show previews if enabled
if(isAbleToShowPreview && ((root.showPreviews && windowsPreviewDlg.activeItem !== taskItem) || root.highlightWindows)){
if(isAbleToShowPreview && !showPreviewsIsBlockedFromReleaseEvent
&& (((root.showPreviews || (windowsPreviewDlg.visible && !isLauncher))
&& windowsPreviewDlg.activeItem !== taskItem)
|| root.highlightWindows)){
if (hoveredTimerObj) {
//! don't delay showing preview in normal states,
//! that is when the dock wasn't hidden
@ -658,6 +664,8 @@ MouseArea{
}
}
showPreviewsIsBlockedFromReleaseEvent = false;
if (root.autoScrollTasksEnabled) {
scrollableList.autoScrollFor(taskItem, false);
}
@ -854,7 +862,7 @@ MouseArea{
if(windowsPreviewDlg.activeItem !== taskItem || !windowsPreviewDlg.visible){
showPreviewWindow();
} else {
root.forcePreviewsHiding(21.1);
forceHidePreview(21.1);
}
} else if ( (root.leftClickAction === LatteTasks.Types.PresentWindows && !(isGroupParent && !LatteCore.WindowSystem.compositingActive))
|| ((root.leftClickAction === LatteTasks.Types.PreviewWindows && !isGroupParent)) ) {
@ -1018,13 +1026,16 @@ MouseArea{
} else {
launcherAction();
}
}
else{
} else{
if (model.IsGroupParent) {
if (LatteCore.WindowSystem.compositingActive && backend.canPresentWindows()) {
root.presentWindows(root.plasma515 ? model.WinIdList: model.LegacyWinIdList );
}
} else {
if (windowsPreviewDlg.visible) {
forceHidePreview(8.3);
}
if (isMinimized) {
var i = modelIndex();
tasksModel.requestToggleMinimized(i);
@ -1038,6 +1049,15 @@ MouseArea{
}
}
function forceHidePreview(debugtext) {
showPreviewsIsBlockedFromReleaseEvent = true;
if (hoveredTimerObj) {
hoveredTimerObj.stop();
}
root.forcePreviewsHiding(debugtext);
}
function showPreviewWindow() {
if (root.disableAllWindowsFunctionality || !isAbleToShowPreview) {
return;
@ -1573,7 +1593,7 @@ MouseArea{
}
if (taskItem.containsMouse) {
if (root.showPreviews) {
if (root.showPreviews || (windowsPreviewDlg.visible && !isLauncher)) {
showPreviewWindow();
}

View File

@ -160,6 +160,19 @@ PlasmaComponents.Page {
}
}
LatteComponents.CheckBox {
id: previewPopupChk
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Preview window behaves as popup")
checked: tasks.configuration.previewWindowAsPopup
visible: dialog.advancedLevel
enabled: !disableAllWindowsFunctionality
onClicked: {
tasks.configuration.previewWindowAsPopup = checked;
}
}
LatteComponents.CheckBox {
id: unifyGlobalShortcutsChk
Layout.maximumWidth: dialog.optionsWidth