fix #15, using only userConfiguring state

--in !immutable state all the zoom animations
are working just fine, only in userConfiguring
state the editmode is enabled
v0.6
Michail Vourlakos 8 years ago
parent 7156a0ba30
commit fba3555f5f

@ -114,7 +114,7 @@ Item {
//outside the NowDock Plasmoid //outside the NowDock Plasmoid
//property int debCounter: 0; //property int debCounter: 0;
function interceptNowDockUpdateScale(dIndex, newScale, step){ function interceptNowDockUpdateScale(dIndex, newScale, step){
if(plasmoid.immutable){ if(!root.editMode){
if(dIndex === -1){ if(dIndex === -1){
layoutsContainer.updateScale(index-1,newScale, step); layoutsContainer.updateScale(index-1,newScale, step);
} }
@ -212,13 +212,13 @@ Item {
width: container.computeWidth width: container.computeWidth
height: container.computeHeight height: container.computeHeight
anchors.rightMargin: (nowDock || (showZoomed && !plasmoid.immutable)) || anchors.rightMargin: (nowDock || (showZoomed && root.editMode)) ||
(plasmoid.location !== PlasmaCore.Types.RightEdge) ? 0 : shownAppletMargin (plasmoid.location !== PlasmaCore.Types.RightEdge) ? 0 : shownAppletMargin
anchors.leftMargin: (nowDock || (showZoomed && !plasmoid.immutable)) || anchors.leftMargin: (nowDock || (showZoomed && root.editMode)) ||
(plasmoid.location !== PlasmaCore.Types.LeftEdge) ? 0 : shownAppletMargin (plasmoid.location !== PlasmaCore.Types.LeftEdge) ? 0 : shownAppletMargin
anchors.topMargin: (nowDock || (showZoomed && !plasmoid.immutable)) || anchors.topMargin: (nowDock || (showZoomed && root.editMode)) ||
(plasmoid.location !== PlasmaCore.Types.TopEdge)? 0 : shownAppletMargin (plasmoid.location !== PlasmaCore.Types.TopEdge)? 0 : shownAppletMargin
anchors.bottomMargin: (nowDock || (showZoomed && !plasmoid.immutable)) || anchors.bottomMargin: (nowDock || (showZoomed && root.editMode)) ||
(plasmoid.location !== PlasmaCore.Types.BottomEdge) ? 0 : shownAppletMargin (plasmoid.location !== PlasmaCore.Types.BottomEdge) ? 0 : shownAppletMargin
@ -261,7 +261,7 @@ Item {
property bool disableScaleWidth: false property bool disableScaleWidth: false
property bool disableScaleHeight: false property bool disableScaleHeight: false
property bool immutable: plasmoid.immutable property bool editMode: root.editMode
property int appletMinimumWidth: applet && applet.Layout ? applet.Layout.minimumWidth : -1 property int appletMinimumWidth: applet && applet.Layout ? applet.Layout.minimumWidth : -1
property int appletMinimumHeight: applet && applet.Layout ? applet.Layout.minimumHeight : -1 property int appletMinimumHeight: applet && applet.Layout ? applet.Layout.minimumHeight : -1
@ -350,7 +350,7 @@ Item {
updateLayoutHeight(); updateLayoutHeight();
} }
onImmutableChanged: { onEditModeChanged: {
updateLayoutWidth(); updateLayoutWidth();
updateLayoutHeight(); updateLayoutHeight();
} }
@ -358,13 +358,13 @@ Item {
onZoomScaleChanged: { onZoomScaleChanged: {
if ((zoomScale > 1) && !container.isZoomed) { if ((zoomScale > 1) && !container.isZoomed) {
container.isZoomed = true; container.isZoomed = true;
if (plasmoid.immutable && !animationWasSent) { if (!root.editMode && !animationWasSent) {
root.appletsAnimations++; root.appletsAnimations++;
animationWasSent = true; animationWasSent = true;
} }
} else if ((zoomScale == 1) && container.isZoomed) { } else if ((zoomScale == 1) && container.isZoomed) {
container.isZoomed = false; container.isZoomed = false;
if (plasmoid.immutable && animationWasSent) { if (!root.editMode && animationWasSent) {
root.appletsAnimations--; root.appletsAnimations--;
animationWasSent = false; animationWasSent = false;
} }
@ -373,7 +373,7 @@ Item {
function updateLayoutHeight(){ function updateLayoutHeight(){
if(container.isInternalViewSplitter){ if(container.isInternalViewSplitter){
if(plasmoid.immutable) if(!root.editMode)
layoutHeight = 0; layoutHeight = 0;
else else
layoutHeight = root.iconSize;// + moreHeight + root.statesLineSize; layoutHeight = root.iconSize;// + moreHeight + root.statesLineSize;
@ -393,7 +393,7 @@ Item {
&& ( (applet.Layout.maximumHeight < root.iconSize) || (applet.Layout.preferredHeight > root.iconSize)) && ( (applet.Layout.maximumHeight < root.iconSize) || (applet.Layout.preferredHeight > root.iconSize))
&& root.isVertical && root.isVertical
&& !disableScaleWidth && !disableScaleWidth
&& plasmoid.immutable ){ && !root.editMode ){
disableScaleHeight = true; disableScaleHeight = true;
//this way improves performance, probably because during animation the preferred sizes update a lot //this way improves performance, probably because during animation the preferred sizes update a lot
if((applet.Layout.maximumHeight < root.iconSize)){ if((applet.Layout.maximumHeight < root.iconSize)){
@ -417,7 +417,7 @@ Item {
function updateLayoutWidth(){ function updateLayoutWidth(){
if(container.isInternalViewSplitter){ if(container.isInternalViewSplitter){
if(plasmoid.immutable) if(!root.editMode)
layoutWidth = 0; layoutWidth = 0;
else else
layoutWidth = root.iconSize; //+ moreWidth+ root.statesLineSize; layoutWidth = root.iconSize; //+ moreWidth+ root.statesLineSize;
@ -436,7 +436,7 @@ Item {
&& ( (applet.Layout.maximumWidth < root.iconSize) || (applet.Layout.preferredWidth > root.iconSize)) && ( (applet.Layout.maximumWidth < root.iconSize) || (applet.Layout.preferredWidth > root.iconSize))
&& root.isHorizontal && root.isHorizontal
&& !disableScaleHeight && !disableScaleHeight
&& plasmoid.immutable){ && !root.editMode){
disableScaleWidth = true; disableScaleWidth = true;
//this way improves performance, probably because during animation the preferred sizes update a lot //this way improves performance, probably because during animation the preferred sizes update a lot
if((applet.Layout.maximumWidth < root.iconSize)){ if((applet.Layout.maximumWidth < root.iconSize)){
@ -471,7 +471,7 @@ Item {
//spacer background //spacer background
Loader{ Loader{
anchors.fill: wrapperContainer anchors.fill: wrapperContainer
active: applet && (applet.pluginName === "org.kde.plasma.panelspacer") && !plasmoid.immutable active: applet && (applet.pluginName === "org.kde.plasma.panelspacer") && root.editMode
sourceComponent: Rectangle{ sourceComponent: Rectangle{
anchors.fill: parent anchors.fill: parent
@ -496,7 +496,7 @@ Item {
Loader{ Loader{
anchors.fill: wrapperContainer anchors.fill: wrapperContainer
active: container.isInternalViewSplitter active: container.isInternalViewSplitter
&& !plasmoid.immutable && root.editMode
rotation: root.isVertical ? 90 : 0 rotation: root.isVertical ? 90 : 0
@ -721,8 +721,8 @@ Item {
id: appletMouseArea id: appletMouseArea
anchors.fill: parent anchors.fill: parent
enabled: (!nowDock)&&(canBeHovered)&&(!lockZoom)&&(plasmoid.immutable) enabled: (!nowDock)&&(canBeHovered)&&(!lockZoom)&&(!root.editMode)
hoverEnabled: plasmoid.immutable && (!nowDock) && canBeHovered ? true : false hoverEnabled: !root.editMode && (!nowDock) && canBeHovered ? true : false
propagateComposedEvents: true propagateComposedEvents: true
property bool pressed: false property bool pressed: false

@ -35,9 +35,9 @@ Item{
// parent: root // parent: root
z:0 z:0
property int panelWidth: secondLayout.count > 0 && root.isHorizontal && plasmoid.immutable ? property int panelWidth: secondLayout.count > 0 && root.isHorizontal && !root.editMode ?
layoutsContainer.width + 2*spacing : mainLayout.width + spacing layoutsContainer.width + 2*spacing : mainLayout.width + spacing
property int panelHeight: secondLayout.count > 0 && root.isVertical && plasmoid.immutable ? property int panelHeight: secondLayout.count > 0 && root.isVertical && !root.editMode ?
layoutsContainer.height + 2*spacing : mainLayout.height + spacing layoutsContainer.height + 2*spacing : mainLayout.height + spacing
width: root.isHorizontal ? panelWidth : smallSize width: root.isHorizontal ? panelWidth : smallSize

@ -116,7 +116,7 @@ Item{
var space = root.panelEdgeSpacing + 10; var space = root.panelEdgeSpacing + 10;
if (normalState && plasmoid.immutable) { if (normalState && !root.editMode) {
//console.log("entered normal state..."); //console.log("entered normal state...");
//count panel length //count panel length
if(root.isHorizontal) { if(root.isHorizontal) {
@ -176,7 +176,7 @@ Item{
tempLength = Screen.height; //screenGeometry.height; tempLength = Screen.height; //screenGeometry.height;
//grow only on length and not thickness //grow only on length and not thickness
if(mainLayout.animatedLength || !plasmoid.immutable if(mainLayout.animatedLength || root.editMode
|| (root.animationsNeedLength>0 && root.animationsNeedBothAxis === 0)) { || (root.animationsNeedLength>0 && root.animationsNeedBothAxis === 0)) {
tempThickness = thicknessNormalOriginal; tempThickness = thicknessNormalOriginal;

@ -43,6 +43,7 @@ DragDrop.DropArea {
property bool debugMode: false property bool debugMode: false
property bool automaticSize: plasmoid.configuration.automaticIconSize property bool automaticSize: plasmoid.configuration.automaticIconSize
property bool editMode: plasmoid.userConfiguring
property bool immutable: plasmoid.immutable property bool immutable: plasmoid.immutable
property bool inStartup: true property bool inStartup: true
property bool isHorizontal: plasmoid.formFactor == PlasmaCore.Types.Horizontal property bool isHorizontal: plasmoid.formFactor == PlasmaCore.Types.Horizontal
@ -63,8 +64,8 @@ DragDrop.DropArea {
property int animationsNeedThickness: 0 // animations need thickness, e.g. bouncing animation property int animationsNeedThickness: 0 // animations need thickness, e.g. bouncing animation
property int appletsAnimations: 0 //zoomed applets it is used basically on masking for magic window property int appletsAnimations: 0 //zoomed applets it is used basically on masking for magic window
property int automaticIconSizeBasedSize: -1 //it is not set, this is the defautl property int automaticIconSizeBasedSize: -1 //it is not set, this is the defautl
property int iconSize: (automaticIconSizeBasedSize > 0 && plasmoid.immutable) ? Math.min(automaticIconSizeBasedSize, plasmoid.configuration.iconSize) : property int iconSize: (automaticIconSizeBasedSize > 0 && !root.editMode) ? Math.min(automaticIconSizeBasedSize, plasmoid.configuration.iconSize) :
plasmoid.configuration.iconSize plasmoid.configuration.iconSize
property int iconStep: 8 property int iconStep: 8
property int panelEdgeSpacing: iconSize / 3 property int panelEdgeSpacing: iconSize / 3
//FIXME: this is not needed any more probably //FIXME: this is not needed any more probably
@ -77,9 +78,9 @@ DragDrop.DropArea {
//property int mainLayoutPosition: !plasmoid.immutable ? Latte.Dock.Center : (root.isVertical ? Latte.Dock.Top : Latte.Dock.Left) //property int mainLayoutPosition: !plasmoid.immutable ? Latte.Dock.Center : (root.isVertical ? Latte.Dock.Top : Latte.Dock.Left)
//property int panelAlignment: plasmoid.configuration.panelPosition !== Latte.Dock.Double ? plasmoid.configuration.panelPosition : mainLayoutPosition //property int panelAlignment: plasmoid.configuration.panelPosition !== Latte.Dock.Double ? plasmoid.configuration.panelPosition : mainLayoutPosition
property int panelAlignment: plasmoid.immutable ? plasmoid.configuration.panelPosition : property int panelAlignment: !root.editMode ? plasmoid.configuration.panelPosition :
( plasmoid.configuration.panelPosition === Latte.Dock.Double ? ( plasmoid.configuration.panelPosition === Latte.Dock.Double ?
Latte.Dock.Center :plasmoid.configuration.panelPosition ) Latte.Dock.Center :plasmoid.configuration.panelPosition )
property real zoomFactor: windowSystem.compositingActive ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1 property real zoomFactor: windowSystem.compositingActive ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
@ -386,7 +387,12 @@ DragDrop.DropArea {
//// END OF Behaviors //// END OF Behaviors
//////////////START OF CONNECTIONS //////////////START OF CONNECTIONS
// onAppletsAnimationsChanged: visibilityManager.updateMaskArea(); //this is used from zoomed applets in that container
onAppletsAnimationsChanged: visibilityManager.updateMaskArea();
onEditModeChanged: {
updateLayouts();
}
onDockChanged: { onDockChanged: {
if (dock) { if (dock) {
@ -494,6 +500,7 @@ DragDrop.DropArea {
Containment.onAppletAdded: { Containment.onAppletAdded: {
addApplet(applet, x, y); addApplet(applet, x, y);
LayoutManager.save(); LayoutManager.save();
updateIndexes();
} }
Containment.onAppletRemoved: { Containment.onAppletRemoved: {
@ -513,6 +520,8 @@ DragDrop.DropArea {
} }
LayoutManager.save(); LayoutManager.save();
updateIndexes();
} }
Plasmoid.onUserConfiguringChanged: { Plasmoid.onUserConfiguringChanged: {
@ -556,8 +565,6 @@ DragDrop.DropArea {
plasmoid.action("configure").visible = !plasmoid.immutable; plasmoid.action("configure").visible = !plasmoid.immutable;
plasmoid.action("configure").enabled = !plasmoid.immutable; plasmoid.action("configure").enabled = !plasmoid.immutable;
updateLayouts();
///Set Preferred Sizes/// ///Set Preferred Sizes///
///Notice: they are set here because if they are set with a binding ///Notice: they are set here because if they are set with a binding
///they break the !immutable experience, the dock becomes too small ///they break the !immutable experience, the dock becomes too small
@ -822,11 +829,11 @@ DragDrop.DropArea {
} }
function slotDisableHiding(value) { function slotDisableHiding(value) {
// dock.visibility.disableHiding = value; // dock.visibility.disableHiding = value;
} }
function updateAutomaticIconSize() { function updateAutomaticIconSize() {
if (visibilityManager.normalState && !animatedLengthTimer.running && plasmoid.immutable if (visibilityManager.normalState && !animatedLengthTimer.running && !root.editMode
&& (iconSize===plasmoid.configuration.iconSize || iconSize === automaticIconSizeBasedSize) ) { && (iconSize===plasmoid.configuration.iconSize || iconSize === automaticIconSizeBasedSize) ) {
var layoutLength; var layoutLength;
var maxLength = dock.maxLength; var maxLength = dock.maxLength;
@ -887,7 +894,7 @@ DragDrop.DropArea {
} }
function updateLayouts(){ function updateLayouts(){
if(plasmoid.immutable){ if(!root.editMode){
var splitter = -1; var splitter = -1;
var totalChildren = mainLayout.children.length; var totalChildren = mainLayout.children.length;
@ -937,7 +944,7 @@ DragDrop.DropArea {
Loader{ Loader{
anchors.fill: parent anchors.fill: parent
active: !plasmoid.immutable active: root.editMode
sourceComponent: EditModeVisual{ sourceComponent: EditModeVisual{
} }
@ -996,32 +1003,22 @@ DragDrop.DropArea {
id: layoutsContainer id: layoutsContainer
signal updateScale(int delegateIndex, real newScale, real step) signal updateScale(int delegateIndex, real newScale, real step)
// property bool parentMagicWinFlag: plasmoid.immutable && magicWin && !root.inStartup && windowSystem.compositingActive
//&& !(root.inStartup && magicWin.panelVisibility === Latte.Dock.AutoHide)
property int allCount: root.nowDock ? mainLayout.count-1+nowDock.tasksCount : mainLayout.count property int allCount: root.nowDock ? mainLayout.count-1+nowDock.tasksCount : mainLayout.count
property int currentSpot: -1000 property int currentSpot: -1000
property int hoveredIndex: -1 property int hoveredIndex: -1
x: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isHorizontal x: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isHorizontal
&& plasmoid.immutable && windowSystem.compositingActive ? && !root.editMode && windowSystem.compositingActive ?
(dock.width/2) - (dock.maxLength/2): 0 (dock.width/2) - (dock.maxLength/2): 0
y: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isVertical y: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isVertical
&& plasmoid.immutable && windowSystem.compositingActive ? && !root.editMode && windowSystem.compositingActive ?
(dock.height/2) - (dock.maxLength/2): 0 (dock.height/2) - (dock.maxLength/2): 0
width: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isHorizontal && plasmoid.immutable ? width: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isHorizontal && !root.editMode ?
dock.maxLength : parent.width dock.maxLength : parent.width
height: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isVertical && plasmoid.immutable ? height: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isVertical && !root.editMode ?
dock.maxLength : parent.height dock.maxLength : parent.height
Component.onCompleted: {
if(plasmoid.immutable) {
opacity = 0;
} else {
opacity = 1;
}
}
Loader{ Loader{
anchors.fill: parent anchors.fill: parent
@ -1051,13 +1048,13 @@ DragDrop.DropArea {
property int count: children.length property int count: children.length
onHeightChanged: { onHeightChanged: {
if (root.isVertical && plasmoid.immutable) { if (root.isVertical && !root.editMode) {
checkLayoutsAnimatedLength(); checkLayoutsAnimatedLength();
} }
} }
onWidthChanged: { onWidthChanged: {
if (root.isHorizontal && plasmoid.immutable) { if (root.isHorizontal && !root.editMode) {
checkLayoutsAnimatedLength(); checkLayoutsAnimatedLength();
} }
} }

@ -44,7 +44,7 @@ MouseArea{
wrapper.height wrapper.height
acceptedButtons: Qt.LeftButton | Qt.MidButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.MidButton | Qt.RightButton
hoverEnabled: (inAnimation !== true)&& (!IsStartup)&&(!panel.taskInAnimation)&&(plasmoid.immutable || panel.debugLocation) hoverEnabled: (inAnimation !== true)&& (!IsStartup)&&(!panel.taskInAnimation)&&(!panel.editMode || panel.debugLocation)
// hoverEnabled: true // hoverEnabled: true
property bool buffersAreReady: false property bool buffersAreReady: false
@ -296,7 +296,7 @@ MouseArea{
}//Flow }//Flow
function calculateScales( currentMousePosition ){ function calculateScales( currentMousePosition ){
if (!plasmoid.immutable) { if (panel.editMode) {
return; return;
} }
@ -462,7 +462,7 @@ MouseArea{
onIsDraggedChanged: { onIsDraggedChanged: {
if(isDragged && (plasmoid.immutable)){ if(isDragged && (!panel.editMode)){
panel.dragSource = mainItemContainer; panel.dragSource = mainItemContainer;
dragHelper.startDrag(mainItemContainer, model.MimeType, model.MimeData, dragHelper.startDrag(mainItemContainer, model.MimeType, model.MimeData,
model.LauncherUrlWithoutIcon, model.decoration); model.LauncherUrlWithoutIcon, model.decoration);
@ -563,7 +563,7 @@ MouseArea{
// mouse.button is always 0 here, hence checking with mouse.buttons // mouse.button is always 0 here, hence checking with mouse.buttons
if (pressX != -1 && mouse.buttons == Qt.LeftButton if (pressX != -1 && mouse.buttons == Qt.LeftButton
&& isDragged && isDragged
&& plasmoid.immutable && !panel.editMode
&& dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y) ) { && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y) ) {
panel.dragSource = mainItemContainer; panel.dragSource = mainItemContainer;
dragHelper.startDrag(mainItemContainer, model.MimeType, model.MimeData, dragHelper.startDrag(mainItemContainer, model.MimeType, model.MimeData,

@ -739,7 +739,7 @@ Item{
State{ State{
name: "isDragged" name: "isDragged"
when: ( (mainItemContainer.isDragged) && (plasmoid.immutable) ) when: ( (mainItemContainer.isDragged) && (!panel.editMode) )
// PropertyChanges { target: clickedAnimation; running:false } // PropertyChanges { target: clickedAnimation; running:false }
PropertyChanges { target: wrapper; scale:1 + ((panel.zoomFactor - 1) / 2)} PropertyChanges { target: wrapper; scale:1 + ((panel.zoomFactor - 1) / 2)}

@ -50,6 +50,7 @@ Item {
property bool debugLocation: false property bool debugLocation: false
property bool editMode: plasmoid.userConfiguring
property bool disableRestoreZoom: false //blocks restore animation in rightClick property bool disableRestoreZoom: false //blocks restore animation in rightClick
property bool dropNewLauncher: false property bool dropNewLauncher: false
property bool enableShadows: plasmoid.configuration.showShadows property bool enableShadows: plasmoid.configuration.showShadows

Loading…
Cancel
Save