improve window previews experience

--make the window previews experience more
robust
v0.6
Michail Vourlakos 8 years ago
parent 30ce9c3c12
commit c24bc32302

@ -144,9 +144,8 @@ Item {
activationTimer.stop(); activationTimer.stop();
} }
if (hoveredItem && windowsPreviewDlg.visible && toolTipDelegate.currentItem !== hoveredItem.itemIndex ) { if (hoveredItem && windowsPreviewDlg.visible && toolTipDelegate.parentIndex !== hoveredItem.itemIndex ) {
windowsPreviewDlg.hide(); windowsPreviewDlg.hide(6);
toolTipDelegate.currentItem=-1;
} }
} }
@ -188,7 +187,7 @@ Item {
// groupDialog.visible = true; // groupDialog.visible = true;
} else if (parent.hoveredItem.m.IsLauncher !== true) { } else if (parent.hoveredItem.m.IsLauncher !== true) {
if(windowsPreviewDlg.visible && toolTipDelegate.currentItem !==parent.hoveredItem.itemIndex ) { if(windowsPreviewDlg.visible && toolTipDelegate.currentItem !==parent.hoveredItem.itemIndex ) {
windowsPreviewDlg.hide(); windowsPreviewDlg.hide(5);
toolTipDelegate.currentItem=-1; toolTipDelegate.currentItem=-1;
} }

@ -502,8 +502,7 @@ MouseArea{
///////////////// Mouse Area Events /////////////////// ///////////////// Mouse Area Events ///////////////////
onEntered: { onEntered: {
if ((icList.hoveredIndex !== itemIndex) && isLauncher && windowsPreviewDlg.visible) { if ((icList.hoveredIndex !== itemIndex) && isLauncher && windowsPreviewDlg.visible) {
windowsPreviewDlg.hide(); windowsPreviewDlg.hide(1);
toolTipDelegate.currentItem = -1;
} }
checkListHovered.stop(); checkListHovered.stop();
@ -623,7 +622,7 @@ MouseArea{
onPressed: { onPressed: {
if (windowSystem.compositingActive) { if (windowSystem.compositingActive) {
windowsPreviewDlg.hide(); windowsPreviewDlg.hide(2);
} }
if ((mouse.button == Qt.LeftButton)||(mouse.button == Qt.MidButton)) { if ((mouse.button == Qt.LeftButton)||(mouse.button == Qt.MidButton)) {
@ -678,10 +677,10 @@ MouseArea{
root.presentWindows(model.LegacyWinIdList); root.presentWindows(model.LegacyWinIdList);
} else { } else {
if ((windowsPreviewDlg.visualParent === mainItemContainer)&&(windowsPreviewDlg.visible)) { if ((windowsPreviewDlg.visualParent === mainItemContainer)&&(windowsPreviewDlg.visible)) {
windowsPreviewDlg.hide(); windowsPreviewDlg.hide(3);
} else { } else {
preparePreviewWindow(false); preparePreviewWindow(false);
windowsPreviewDlg.show(); windowsPreviewDlg.show(mainItemContainer);
} }
} }
} else { } else {
@ -875,7 +874,7 @@ MouseArea{
function slotShowPreviewForTasks(group) { function slotShowPreviewForTasks(group) {
if (group === mainItemContainer) { if (group === mainItemContainer) {
preparePreviewWindow(true); preparePreviewWindow(true);
windowsPreviewDlg.show(); windowsPreviewDlg.show(mainItemContainer);
} }
} }
@ -1036,11 +1035,10 @@ MouseArea{
repeat: false repeat: false
onTriggered: { onTriggered: {
if(mainItemContainer.containsMouse && toolTipDelegate.parentTask !== mainItemContainer){ if(mainItemContainer.containsMouse && windowsPreviewDlg.activeItem !== mainItemContainer){
//console.log("Hovered Timer...."); //console.log("Hovered Timer....");
mainItemContainer.preparePreviewWindow(false); mainItemContainer.preparePreviewWindow(false);
windowsPreviewDlg.show(); windowsPreviewDlg.show(mainItemContainer);
//windowsPreviewDlg.visible = true;
} }
hoveredTimer.destroy(); hoveredTimer.destroy();

@ -36,6 +36,7 @@ import org.kde.taskmanager 0.1 as TaskManager
PlasmaExtras.ScrollArea { PlasmaExtras.ScrollArea {
id: mainToolTip
property Item parentTask property Item parentTask
property int parentIndex property int parentIndex
@ -52,6 +53,8 @@ PlasmaExtras.ScrollArea {
property bool isLauncher property bool isLauncher
property bool isMinimizedParent property bool isMinimizedParent
property bool containsMouse: false
// Needed for generateSubtext() // Needed for generateSubtext()
property string displayParent property string displayParent
property string genericName property string genericName
@ -121,15 +124,15 @@ PlasmaExtras.ScrollArea {
} }
function checkMouseInside(){ function checkMouseInside(){
var isInside = containsMouse || childrenContainMouse(); var isInside = containsMouse || childrenContainMouse() || parentTask.containsMouse;
if (isInside){ if (isInside){
root.disableRestoreZoom = true; root.disableRestoreZoom = true;
mainToolTip.containsMouse = true;
checkListHovered.stop(); checkListHovered.stop();
toolTipDelegate.currentItem = parentIndex;
} }
else{ else{
root.disableRestoreZoom = false; root.disableRestoreZoom = false;
toolTipDelegate.currentItem = -1; mainToolTip.containsMouse = false;
checkListHovered.restart(); checkListHovered.restart();
} }
} }

@ -194,8 +194,6 @@ Item {
ToolTipDelegate2 { ToolTipDelegate2 {
id: toolTipDelegate id: toolTipDelegate
visible: false visible: false
property int currentItem: -1
} }
////BEGIN interfaces ////BEGIN interfaces
@ -215,57 +213,55 @@ Item {
property Item activeItem: null property Item activeItem: null
function hide(){ function hide(debug){
//console.log("on hide event called: "+debug);
if (latteDock) { if (latteDock) {
//it is used to unblock dock hiding //it is used to unblock dock hiding
root.signalDraggingState(false); root.signalDraggingState(false);
} }
//console.log("on hide event called...");
visible = false;
activeItem = null;
initializePreviewComponent.createObject(windowsPreviewDlg); windowsPreviewDlg.activeItem = null;
toolTipDelegate.parentTask = null;
toolTipDelegate.parentIndex = -1;
toolTipDelegate.windows = [];
toolTipDelegate.isGroup = false;
visible = false;
} }
function show(){ function show(taskItem){
//console.log("preview show called..."); //console.log("preview show called...");
if (activeItem !== toolTipDelegate.parentTask) { if (!activeItem || (activeItem !== taskItem)) {
//used to initialize windows previews buffers //console.log("preview show called: accepted...");
visible = false;
var tasks = icList.contentItem.children; //used to initialize windows previews buffers from task to task
visible = false;
for(var i=0; i<tasks.length; ++i){ activeItem = taskItem;
var task = tasks[i]; toolTipDelegate.parentTask = taskItem;
if(task && task.isActive){
activeItem = task;
break;
}
}
if (latteDock) { if (latteDock) {
//it is used to block dock hiding //it is used to block dock hiding
root.signalDraggingState(true); root.signalDraggingState(true);
} }
activeItem = toolTipDelegate.parentTask; //small delay to show in order to not mess up with the buffers clearing
visible = true; //from previous visible:false
initializePreviewComponent.createObject(windowsPreviewDlg);
} }
} }
} }
//A Timer to delay the initialization of the active item in order //A Timer to delay to show in order to not mess up with the buffers clearing
//to not break then active item animation //from previous visible:false
Component { Component {
id: initializePreviewComponent id: initializePreviewComponent
Timer { Timer {
id: initializePreviewTimer id: initializePreviewTimer
interval: 300 interval: 100
repeat: false repeat: false
onTriggered: { onTriggered: {
windowsPreviewDlg.activeItem = null; windowsPreviewDlg.visible = true;
initializePreviewTimer.destroy(); initializePreviewTimer.destroy();
} }
@ -905,7 +901,7 @@ Item {
var tasks = icList.contentItem.children; var tasks = icList.contentItem.children;
if(toolTipDelegate.currentItem !== -1) if(toolTipDelegate.parentIndex !== -1)
return true; return true;
for(var i=0; i<tasks.length; ++i){ for(var i=0; i<tasks.length; ++i){
@ -927,8 +923,9 @@ Item {
var result = root.outsideContainsMouse(); var result = root.outsideContainsMouse();
if ((!result || toolTipDelegate.parentIndex !== icList.hoveredIndex) && windowSystem.compositingActive) { if ((!result || (!toolTipDelegate.parentTask.containsMouse && !toolTipDelegate.containsMouse) ) && windowSystem.compositingActive) {
windowsPreviewDlg.hide(); windowsPreviewDlg.hide(4);
return false;
} }
if (result) if (result)

Loading…
Cancel
Save