mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-21 10:50:30 +03:00
port plasmoid into new arch for parabolic effect
This commit is contained in:
parent
9b77117870
commit
fd4af3f0f1
@ -46,6 +46,7 @@ DragDrop.DropArea {
|
||||
////BEGIN properties
|
||||
property bool debugMode: Qt.application.arguments.indexOf("--graphics")>=0
|
||||
property bool globalDirectRender: false //it is used as a globalDirectRender for all elements in the dock
|
||||
property bool directRenderTimerIsRunning: enableDirectRenderTimer.running
|
||||
|
||||
property bool addLaunchersMessage: false
|
||||
property bool addLaunchersInTaskManager: plasmoid.configuration.addLaunchersInTaskManager
|
||||
@ -1050,6 +1051,11 @@ DragDrop.DropArea {
|
||||
}
|
||||
}
|
||||
|
||||
function startEnableDirectRenderTimer(){
|
||||
if (!enableDirectRenderTimer.running)
|
||||
enableDirectRenderTimer.start();
|
||||
}
|
||||
|
||||
function updateAutomaticIconSize() {
|
||||
if ((visibilityManager.normalState && !root.editMode && root.autoDecreaseIconSize)
|
||||
&& (iconSize===root.maxIconSize || iconSize === automaticIconSizeBasedSize) ) {
|
||||
@ -1754,6 +1760,9 @@ DragDrop.DropArea {
|
||||
interval: 150;
|
||||
|
||||
onTriggered: {
|
||||
if (latteApplet && latteApplet.previewContainsMouse())
|
||||
return;
|
||||
|
||||
if (!dock.visibility.containsMouse || (rootMouseArea.containsMouse && !root.editMode)){
|
||||
if (enableDirectRenderTimer.running)
|
||||
enableDirectRenderTimer.stop();
|
||||
@ -1771,6 +1780,9 @@ DragDrop.DropArea {
|
||||
id: enableDirectRenderTimer
|
||||
interval: 4 * root.durationTime * units.shortDuration
|
||||
onTriggered: {
|
||||
if (latteApplet && latteApplet.waitingLaunchers.length > 0)
|
||||
return;
|
||||
|
||||
if (dock.visibility.containsMouse)
|
||||
root.globalDirectRender = true;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ MouseArea{
|
||||
if (!root.vertical)
|
||||
return 5 + root.widthMargins;
|
||||
else
|
||||
return (root.iconSize + root.thickMargin) * mScale;
|
||||
return (root.iconSize + root.thickMargin) * wrapper.mScale;
|
||||
}
|
||||
|
||||
property real separatorRegHeight: {
|
||||
@ -375,7 +375,7 @@ MouseArea{
|
||||
if (root.vertical)
|
||||
return 5 + root.heightMargins;
|
||||
else
|
||||
return (root.iconSize + root.thickMargin) * mScale;
|
||||
return (root.iconSize + root.thickMargin) * wrapper.mScale;
|
||||
}
|
||||
/// end of Scalers///////
|
||||
|
||||
@ -611,8 +611,8 @@ MouseArea{
|
||||
}
|
||||
|
||||
onMScaleChanged: {
|
||||
if ((mScale === root.zoomFactor) && !enableDirectRenderTimer.running && !icList.directRender) {
|
||||
enableDirectRenderTimer.start();
|
||||
if ((mScale === root.zoomFactor) && !root.directRenderTimerIsRunning && !root.globalDirectRender) {
|
||||
root.startEnableDirectRenderTimer();
|
||||
}
|
||||
|
||||
if ((mScale > 1) && !mainItemContainer.isZoomed) {
|
||||
@ -757,7 +757,8 @@ MouseArea{
|
||||
windowsPreviewDlg.hide(1);
|
||||
}
|
||||
|
||||
checkListHovered.stop();
|
||||
if(!root.latteDock)
|
||||
checkListHovered.stop();
|
||||
|
||||
if((!inAnimation)&&(root.dragSource == null)&&(!root.taskInAnimation) && hoverEnabled){
|
||||
icList.hoveredIndex = index;
|
||||
@ -785,7 +786,7 @@ MouseArea{
|
||||
///dont check to restore zooms
|
||||
}
|
||||
else{
|
||||
if(!inAnimation){
|
||||
if(!inAnimation && !root.latteDock){
|
||||
checkListHovered.startNormal();
|
||||
}
|
||||
}
|
||||
@ -798,7 +799,8 @@ MouseArea{
|
||||
}
|
||||
|
||||
onPositionChanged: {
|
||||
checkListHovered.stop();
|
||||
if(!root.latteDock)
|
||||
checkListHovered.stop();
|
||||
|
||||
if((inAnimation == false)&&(!root.taskInAnimation)&&(!root.disableRestoreZoom) && hoverEnabled){
|
||||
if(root.dragSource == null){
|
||||
@ -976,7 +978,7 @@ MouseArea{
|
||||
|
||||
pressed = false;
|
||||
|
||||
if(!inAnimation)
|
||||
if(!inAnimation && !root.latteDock)
|
||||
checkListHovered.startDuration(3*units.longDuration);
|
||||
}
|
||||
///////////////// End Of Mouse Area Events ///////////////////
|
||||
@ -999,10 +1001,10 @@ MouseArea{
|
||||
}
|
||||
|
||||
function clearZoom(){
|
||||
if (restoreAnimation)
|
||||
if (root.globalDirectRender)
|
||||
wrapper.mScale = 1;
|
||||
else
|
||||
restoreAnimation.start();
|
||||
//if (wrapper)
|
||||
// wrapper.mScale=1;
|
||||
}
|
||||
|
||||
function handlerDraggingFinished(){
|
||||
|
@ -590,7 +590,8 @@ Item{
|
||||
onStopped: {
|
||||
if( !mainItemContainer.isDragged){
|
||||
mainItemContainer.animationEnded();
|
||||
checkListHovered.startDuration(6*units.longDuration);
|
||||
if(!root.latteDock)
|
||||
checkListHovered.startDuration(6*units.longDuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,12 +128,16 @@ PlasmaExtras.ScrollArea {
|
||||
if (isInside){
|
||||
root.disableRestoreZoom = true;
|
||||
mainToolTip.containsMouse = true;
|
||||
checkListHovered.stop();
|
||||
|
||||
if(!root.latteDock)
|
||||
checkListHovered.stop();
|
||||
}
|
||||
else{
|
||||
root.disableRestoreZoom = false;
|
||||
mainToolTip.containsMouse = false;
|
||||
checkListHovered.startDuration(100);
|
||||
|
||||
if(!root.latteDock)
|
||||
checkListHovered.startDuration(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,9 @@ Item {
|
||||
|
||||
property bool debugLocation: false
|
||||
|
||||
property bool globalDirectRender: false //it is used to check both the applet and the containment for direct render
|
||||
//it is used to check both the applet and the containment for direct render
|
||||
property bool globalDirectRender: latteDock ? latteDock.globalDirectRender : icList.directRender
|
||||
property bool directRenderTimerIsRunning: latteDock ? latteDock.directRenderTimerIsRunning : enableDirectRenderTimer.running
|
||||
|
||||
property bool editMode: plasmoid.userConfiguring
|
||||
property bool disableRestoreZoom: false //blocks restore animation in rightClick
|
||||
@ -122,8 +124,6 @@ Item {
|
||||
property string launcherForRemoval: ""
|
||||
|
||||
//BEGIN Now Dock Panel properties
|
||||
property bool directRender: icList.directRender
|
||||
|
||||
property bool enableShadows: latteDock ? latteDock.enableShadows > 0 : plasmoid.configuration.showShadows
|
||||
property bool forceHidePanel: false
|
||||
property bool disableLeftSpacer: false
|
||||
@ -237,19 +237,6 @@ Item {
|
||||
onGroupingLauncherUrlBlacklistChanged: tasksModel.groupingLauncherUrlBlacklist = plasmoid.configuration.groupingLauncherUrlBlacklist;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: latteDock
|
||||
onDirectRenderChanged: {
|
||||
root.globalDirectRender = latteDock.directRender || icList.directRender;
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: icList
|
||||
onDirectRenderChanged: {
|
||||
root.globalDirectRender = latteDock ? latteDock.directRender || icList.directRender : icList.directRender;
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target: latteDock
|
||||
@ -363,13 +350,6 @@ Item {
|
||||
ActivitiesTools.updateLaunchers(launchers);*/
|
||||
}
|
||||
|
||||
onDockHoveredIndexChanged: {
|
||||
if (dockHoveredIndex >= 0) {
|
||||
icList.hoveredIndex = -1;
|
||||
checkListHovered.startNormal();
|
||||
}
|
||||
}
|
||||
|
||||
onDragSourceChanged: {
|
||||
if (dragSource == null) {
|
||||
root.draggingFinished();
|
||||
@ -691,6 +671,8 @@ Item {
|
||||
}
|
||||
|
||||
//Timer to check if the mouse is still inside the ListView
|
||||
//IMPORTANT ::: This timer should be used only when the Latte plasmoid
|
||||
//is not inside a Latte dock
|
||||
Timer{
|
||||
id:checkListHovered
|
||||
repeat:false;
|
||||
@ -699,10 +681,16 @@ Item {
|
||||
property int normalInterval: Math.max(120, 2 * (root.durationTime * 1.2 * units.shortDuration) + 50)
|
||||
|
||||
onTriggered: {
|
||||
if(root.latteDock)
|
||||
console.log("Plasmoid, checkListHoveredTimer was called, even though it shouldnt...");
|
||||
|
||||
if (!root.containsMouse()) {
|
||||
if (enableDirectRenderTimer.running)
|
||||
enableDirectRenderTimer.stop();
|
||||
|
||||
icList.directRender = false;
|
||||
|
||||
root.clearZoom();
|
||||
if (latteDock && !root.disableRestoreZoom)
|
||||
latteDock.clearZoom();
|
||||
}
|
||||
|
||||
interval = normalInterval;
|
||||
@ -721,6 +709,26 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
//this timer adds a delay into enabling direct rendering...
|
||||
//it gives the time to neighbour tasks to complete their animation
|
||||
//during first hovering phase
|
||||
//IMPORTANT ::: This timer should be used only when the Latte plasmoid
|
||||
//is not inside a Latte dock
|
||||
Timer {
|
||||
id: enableDirectRenderTimer
|
||||
interval: 4 * root.durationTime * units.shortDuration
|
||||
onTriggered: {
|
||||
if(root.latteDock)
|
||||
console.log("Plasmoid, enableDirectRenderTimer was called, even though it shouldnt...");
|
||||
|
||||
if (waitingLaunchers.length > 0)
|
||||
restart();
|
||||
else
|
||||
icList.directRender = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
///Red Liner!!! show the upper needed limit for annimations
|
||||
Rectangle{
|
||||
@ -1000,19 +1008,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
//this timer adds a delay into enabling direct rendering...
|
||||
//it gives the time to neighbour tasks to complete their animation
|
||||
//during first hovering phase
|
||||
Timer {
|
||||
id: enableDirectRenderTimer
|
||||
interval: 4 * root.durationTime * units.shortDuration
|
||||
onTriggered: {
|
||||
if (waitingLaunchers.length > 0)
|
||||
restart();
|
||||
else
|
||||
icList.directRender = true;
|
||||
}
|
||||
}
|
||||
|
||||
///REMOVE
|
||||
////Activities List
|
||||
@ -1280,19 +1275,24 @@ Item {
|
||||
tasksModel.requestRemoveLauncher(filepath);
|
||||
}
|
||||
|
||||
function outsideContainsMouse(){
|
||||
//console.log("disable restore zoom:"+disableRestoreZoom);
|
||||
function previewContainsMouse() {
|
||||
if(toolTipDelegate && toolTipDelegate.containsMouse && toolTipDelegate.parentTask)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function containsMouse(){
|
||||
//console.log("s1...");
|
||||
if (disableRestoreZoom) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
var tasks = icList.contentItem.children;
|
||||
|
||||
if(toolTipDelegate && toolTipDelegate.containsMouse && toolTipDelegate.parentTask) {
|
||||
return true;
|
||||
} else {
|
||||
if (!previewContainsMouse())
|
||||
windowsPreviewDlg.hide(4);
|
||||
}
|
||||
|
||||
//console.log("s3...");
|
||||
var tasks = icList.contentItem.children;
|
||||
|
||||
for(var i=0; i<tasks.length; ++i){
|
||||
var task = tasks[i];
|
||||
@ -1306,37 +1306,12 @@ Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
function containsMouse(){
|
||||
//console.log("s1...");
|
||||
if (disableRestoreZoom) {
|
||||
return;
|
||||
}
|
||||
|
||||
var result = root.outsideContainsMouse();
|
||||
//console.log("s2... outsideContainsMouse:"+result);
|
||||
|
||||
if (result)
|
||||
return true;
|
||||
|
||||
//console.log("s3...");
|
||||
if (!result && latteDock && latteDock.outsideContainsMouse())
|
||||
return true;
|
||||
|
||||
//console.log("s4...");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function clearZoom(){
|
||||
//console.log("Plasmoid clear...");
|
||||
if (disableRestoreZoom) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (enableDirectRenderTimer.running)
|
||||
enableDirectRenderTimer.stop();
|
||||
|
||||
icList.directRender = false;
|
||||
icList.currentSpot = -1000;
|
||||
icList.hoveredIndex = -1;
|
||||
root.clearZoomSignal();
|
||||
@ -1362,6 +1337,14 @@ Item {
|
||||
dragSource = null;
|
||||
}
|
||||
|
||||
function startEnableDirectRenderTimer() {
|
||||
if (latteDock) {
|
||||
latteDock.startEnableDirectRenderTimer();
|
||||
} else {
|
||||
enableDirectRenderTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
///REMOVE
|
||||
/*function createContextMenu(task) {
|
||||
var menu = root.contextMenuComponent.createObject(task);
|
||||
|
Loading…
x
Reference in New Issue
Block a user