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
pull/1/head
Michail Vourlakos 8 years ago
parent deaeec59f2
commit 9c7eace973

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

@ -35,9 +35,9 @@ Item{
// parent: root
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
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
width: root.isHorizontal ? panelWidth : smallSize

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

@ -43,6 +43,7 @@ DragDrop.DropArea {
property bool debugMode: false
property bool automaticSize: plasmoid.configuration.automaticIconSize
property bool editMode: plasmoid.userConfiguring
property bool immutable: plasmoid.immutable
property bool inStartup: true
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 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 iconSize: (automaticIconSizeBasedSize > 0 && plasmoid.immutable) ? Math.min(automaticIconSizeBasedSize, plasmoid.configuration.iconSize) :
plasmoid.configuration.iconSize
property int iconSize: (automaticIconSizeBasedSize > 0 && !root.editMode) ? Math.min(automaticIconSizeBasedSize, plasmoid.configuration.iconSize) :
plasmoid.configuration.iconSize
property int iconStep: 8
property int panelEdgeSpacing: iconSize / 3
//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 panelAlignment: plasmoid.configuration.panelPosition !== Latte.Dock.Double ? plasmoid.configuration.panelPosition : mainLayoutPosition
property int panelAlignment: plasmoid.immutable ? plasmoid.configuration.panelPosition :
( plasmoid.configuration.panelPosition === Latte.Dock.Double ?
Latte.Dock.Center :plasmoid.configuration.panelPosition )
property int panelAlignment: !root.editMode ? plasmoid.configuration.panelPosition :
( plasmoid.configuration.panelPosition === Latte.Dock.Double ?
Latte.Dock.Center :plasmoid.configuration.panelPosition )
property real zoomFactor: windowSystem.compositingActive ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
@ -386,7 +387,12 @@ DragDrop.DropArea {
//// END OF Behaviors
//////////////START OF CONNECTIONS
// onAppletsAnimationsChanged: visibilityManager.updateMaskArea();
//this is used from zoomed applets in that container
onAppletsAnimationsChanged: visibilityManager.updateMaskArea();
onEditModeChanged: {
updateLayouts();
}
onDockChanged: {
if (dock) {
@ -494,6 +500,7 @@ DragDrop.DropArea {
Containment.onAppletAdded: {
addApplet(applet, x, y);
LayoutManager.save();
updateIndexes();
}
Containment.onAppletRemoved: {
@ -513,6 +520,8 @@ DragDrop.DropArea {
}
LayoutManager.save();
updateIndexes();
}
Plasmoid.onUserConfiguringChanged: {
@ -556,8 +565,6 @@ DragDrop.DropArea {
plasmoid.action("configure").visible = !plasmoid.immutable;
plasmoid.action("configure").enabled = !plasmoid.immutable;
updateLayouts();
///Set Preferred Sizes///
///Notice: they are set here because if they are set with a binding
///they break the !immutable experience, the dock becomes too small
@ -822,11 +829,11 @@ DragDrop.DropArea {
}
function slotDisableHiding(value) {
// dock.visibility.disableHiding = value;
// dock.visibility.disableHiding = value;
}
function updateAutomaticIconSize() {
if (visibilityManager.normalState && !animatedLengthTimer.running && plasmoid.immutable
if (visibilityManager.normalState && !animatedLengthTimer.running && !root.editMode
&& (iconSize===plasmoid.configuration.iconSize || iconSize === automaticIconSizeBasedSize) ) {
var layoutLength;
var maxLength = dock.maxLength;
@ -887,7 +894,7 @@ DragDrop.DropArea {
}
function updateLayouts(){
if(plasmoid.immutable){
if(!root.editMode){
var splitter = -1;
var totalChildren = mainLayout.children.length;
@ -937,7 +944,7 @@ DragDrop.DropArea {
Loader{
anchors.fill: parent
active: !plasmoid.immutable
active: root.editMode
sourceComponent: EditModeVisual{
}
@ -996,32 +1003,22 @@ DragDrop.DropArea {
id: layoutsContainer
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 currentSpot: -1000
property int hoveredIndex: -1
x: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isHorizontal
&& plasmoid.immutable && windowSystem.compositingActive ?
&& !root.editMode && windowSystem.compositingActive ?
(dock.width/2) - (dock.maxLength/2): 0
y: (plasmoid.configuration.panelPosition === Latte.Dock.Double) && root.isVertical
&& plasmoid.immutable && windowSystem.compositingActive ?
&& !root.editMode && windowSystem.compositingActive ?
(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
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
Component.onCompleted: {
if(plasmoid.immutable) {
opacity = 0;
} else {
opacity = 1;
}
}
Loader{
anchors.fill: parent
@ -1051,13 +1048,13 @@ DragDrop.DropArea {
property int count: children.length
onHeightChanged: {
if (root.isVertical && plasmoid.immutable) {
if (root.isVertical && !root.editMode) {
checkLayoutsAnimatedLength();
}
}
onWidthChanged: {
if (root.isHorizontal && plasmoid.immutable) {
if (root.isHorizontal && !root.editMode) {
checkLayoutsAnimatedLength();
}
}

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

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

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

Loading…
Cancel
Save