mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-12 12:58:16 +03:00
make edit visual totally dynamic
--meaning that edit Visual can contain more elements than just the usual ones and as such we can now add a "Rearrangement" option to make things easier to switch between live/static editing
This commit is contained in:
parent
527cddb72d
commit
542174f296
@ -196,7 +196,7 @@ void PrimaryConfigView::syncGeometry()
|
||||
const auto location = m_latteView->containment()->location();
|
||||
const auto sGeometry = m_latteView->screenGeometry();
|
||||
|
||||
int clearThickness = m_latteView->normalThickness() + m_latteView->fontPixelSize();
|
||||
int clearThickness = m_latteView->editThickness();
|
||||
|
||||
QPoint position{0, 0};
|
||||
|
||||
|
@ -155,7 +155,7 @@ void SecondaryConfigView::syncGeometry()
|
||||
const auto location = m_latteView->containment()->location();
|
||||
const auto sGeometry = m_latteView->screenGeometry();
|
||||
|
||||
int clearThickness = m_latteView->normalThickness() + m_latteView->fontPixelSize();
|
||||
int clearThickness = m_latteView->editThickness();
|
||||
|
||||
int secondaryConfigSpacing = 2 * m_latteView->fontPixelSize();
|
||||
|
||||
|
@ -603,6 +603,22 @@ void View::setMaxLength(float length)
|
||||
emit maxLengthChanged();
|
||||
}
|
||||
|
||||
int View::editThickness() const
|
||||
{
|
||||
return m_editThickness;
|
||||
}
|
||||
|
||||
void View::setEditThickness(int thickness)
|
||||
{
|
||||
if (m_editThickness == thickness) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_editThickness = thickness;
|
||||
|
||||
emit editThicknessChanged();
|
||||
}
|
||||
|
||||
int View::maxThickness() const
|
||||
{
|
||||
return m_maxThickness;
|
||||
|
@ -88,6 +88,7 @@ class View : public PlasmaQuick::ContainmentView
|
||||
Q_PROPERTY(int y READ y NOTIFY yChanged)
|
||||
Q_PROPERTY(int width READ width NOTIFY widthChanged)
|
||||
Q_PROPERTY(int height READ height NOTIFY heightChanged)
|
||||
Q_PROPERTY(int editThickness READ editThickness WRITE setEditThickness NOTIFY editThicknessChanged)
|
||||
Q_PROPERTY(int maxThickness READ maxThickness WRITE setMaxThickness NOTIFY maxThicknessChanged)
|
||||
Q_PROPERTY(int normalThickness READ normalThickness WRITE setNormalThickness NOTIFY normalThicknessChanged)
|
||||
Q_PROPERTY(int offset READ offset WRITE setOffset NOTIFY offsetChanged)
|
||||
@ -143,6 +144,9 @@ public:
|
||||
int fontPixelSize() const;
|
||||
void setFontPixelSize(int size);
|
||||
|
||||
int editThickness() const;
|
||||
void setEditThickness(int thickness);
|
||||
|
||||
int maxThickness() const;
|
||||
void setMaxThickness(int thickness);
|
||||
|
||||
@ -222,6 +226,7 @@ signals:
|
||||
void byPassWMChanged();
|
||||
void contextMenuIsShownChanged();
|
||||
void dockLocationChanged();
|
||||
void editThicknessChanged();
|
||||
void effectsChanged();
|
||||
void fontPixelSizeChanged();
|
||||
void widthChanged();
|
||||
@ -271,6 +276,7 @@ private:
|
||||
bool m_isPreferredForShortcuts{false};
|
||||
bool m_onPrimary{true};
|
||||
int m_fontPixelSize{ -1};
|
||||
int m_editThickness{24};
|
||||
int m_maxThickness{24};
|
||||
int m_normalThickness{24};
|
||||
int m_offset{0};
|
||||
|
@ -32,7 +32,7 @@
|
||||
<default>64</default>
|
||||
</entry>
|
||||
<entry name="editBackgroundOpacity" type="Double">
|
||||
<default>0.3</default>
|
||||
<default>0.2</default>
|
||||
<label>opacity value for edit mode background</label>
|
||||
</entry>
|
||||
|
||||
|
@ -66,7 +66,7 @@ Item{
|
||||
thicknessEditMode )
|
||||
|
||||
//! is used from Panel in edit mode in order to provide correct masking
|
||||
property int thicknessEditMode: thicknessNormalOriginalValue + editModeVisual.settingsThickness + root.editShadow
|
||||
property int thicknessEditMode: thicknessNormalOriginalValue + editModeVisual.settingsThickness
|
||||
|
||||
//! is used to increase the mask thickness
|
||||
readonly property int marginBetweenContentsAndRuler: 10
|
||||
@ -90,6 +90,13 @@ Item{
|
||||
value: thicknessNormalOriginal
|
||||
}
|
||||
|
||||
Binding{
|
||||
target: latteView
|
||||
property:"editThickness"
|
||||
when: latteView
|
||||
value: thicknessEditMode
|
||||
}
|
||||
|
||||
Binding{
|
||||
target: latteView
|
||||
property: "type"
|
||||
@ -379,8 +386,7 @@ Item{
|
||||
|
||||
//this is used to fix a bug with shadow showing when the animation of edit mode
|
||||
//is triggered
|
||||
tempThickness = editModeVisual.editAnimationEnded ? thicknessNormalOriginal + theme.defaultFont.pixelSize + root.editShadow :
|
||||
thicknessNormalOriginal + theme.defaultFont.pixelSize
|
||||
tempThickness = editModeVisual.editAnimationEnded ? thicknessEditMode + root.editShadow : thicknessEditMode
|
||||
|
||||
if (latteView.visibility.isHidden && !slidingAnimationAutoHiddenOut.running ) {
|
||||
tempThickness = thicknessAutoHidden;
|
||||
|
@ -19,17 +19,82 @@
|
||||
|
||||
import QtQuick 2.7
|
||||
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import org.kde.latte 0.2 as Latte
|
||||
|
||||
import "maxlength" as MaximumLength
|
||||
|
||||
Item{
|
||||
readonly property int thickness: ruler.thickness
|
||||
id: settingsRoot
|
||||
readonly property int thickness: ruler.thickness + rearrangeBtn.implicitHeight + spacing
|
||||
readonly property int spacing: 3
|
||||
|
||||
MaximumLength.Ruler {
|
||||
id: ruler
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
id: rearrangeBtn
|
||||
text: i18n("Rearrange")
|
||||
iconSource: "document-edit"
|
||||
checkable: true
|
||||
tooltip: i18n("Rearrange and configure your widgets")
|
||||
|
||||
rotation: {
|
||||
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
|
||||
return 90;
|
||||
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
|
||||
return -90;
|
||||
}
|
||||
}
|
||||
|
||||
x: {
|
||||
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
|
||||
return settingsRoot.width / 2 - implicitWidth / 2;
|
||||
}
|
||||
|
||||
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
|
||||
return visibilityManager.thicknessNormalOriginalValue - implicitWidth / 2 + implicitHeight / 2;
|
||||
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
|
||||
return ruler.thickness - implicitWidth / 2 + implicitHeight / 2 + spacing;
|
||||
}
|
||||
}
|
||||
|
||||
y: {
|
||||
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
|
||||
return settingsRoot.height/2 - implicitHeight / 2;
|
||||
}
|
||||
|
||||
if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
|
||||
return ruler.y + ruler.thickness + spacing;
|
||||
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
|
||||
return ruler.y - implicitHeight - spacing;
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (plasmoid.configuration.inConfigureAppletsMode) {
|
||||
checked = false;
|
||||
plasmoid.configuration.inConfigureAppletsMode = false;
|
||||
} else {
|
||||
checked = true;
|
||||
plasmoid.configuration.inConfigureAppletsMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (plasmoid.configuration.inConfigureAppletsMode) {
|
||||
checked = true;
|
||||
} else {
|
||||
checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,15 +30,15 @@ import org.kde.latte 0.2 as Latte
|
||||
Item{
|
||||
id: editVisual
|
||||
width: root.isHorizontal ? (latteView ? latteView.width : root.width) :
|
||||
visibilityManager.thicknessNormalOriginal + theme.defaultFont.pixelSize
|
||||
visibilityManager.thicknessEditMode
|
||||
height: root.isVertical ? (latteView ? latteView.height : root.height) :
|
||||
visibilityManager.thicknessNormalOriginal + theme.defaultFont.pixelSize
|
||||
visibilityManager.thicknessEditMode
|
||||
|
||||
readonly property int settingsThickness: settingsOverlay.thickness
|
||||
|
||||
property int speed: Latte.WindowSystem.compositingActive ? root.durationTime*2.8*units.longDuration : 10
|
||||
property int thickness: visibilityManager.thicknessNormalOriginalValue + root.editShadow
|
||||
property int rootThickness: visibilityManager.thicknessZoomOriginal + root.editShadow - theme.defaultFont.pixelSize
|
||||
property int thickness: visibilityManager.thicknessEditMode + root.editShadow
|
||||
property int rootThickness: visibilityManager.thicknessZoomOriginal + root.editShadow //- visibilityManager.thicknessEditMode
|
||||
property int editLength: root.isHorizontal ? (root.behaveAsPlasmaPanel ? root.width - root.maxIconSize/4 : root.width)://root.maxLength) :
|
||||
(root.behaveAsPlasmaPanel ? root.height - root.maxIconSize/4 : root.height)
|
||||
|
||||
@ -61,7 +61,7 @@ Item{
|
||||
height: root.isHorizontal ? root.editShadow : imageTiler.height + 2*root.editShadow
|
||||
|
||||
clip: true
|
||||
visible: !editTransition.running && Latte.WindowSystem.compositingActive
|
||||
visible: !editTransition.running && root.editMode && Latte.WindowSystem.compositingActive
|
||||
|
||||
opacity: Math.max(0.35, imageTiler.opacity)
|
||||
|
||||
@ -161,7 +161,7 @@ Item{
|
||||
opacity: 0
|
||||
|
||||
fillMode: Image.Tile
|
||||
source: hasBackground ? latteView.managedLayout.background : "../icons/"+editVisual.layoutColor+"print.jpg"
|
||||
source: hasBackground ? latteView.managedLayout.background : "../../icons/"+editVisual.layoutColor+"print.jpg"
|
||||
|
||||
readonly property bool hasBackground: (latteView && latteView.managedLayout && latteView.managedLayout.background.startsWith("/")) ?
|
||||
true : false
|
||||
@ -227,6 +227,7 @@ Item{
|
||||
SettingsOverlay {
|
||||
id: settingsOverlay
|
||||
anchors.fill: parent
|
||||
visible: root.editMode
|
||||
}
|
||||
|
||||
Connections{
|
||||
|
@ -54,7 +54,7 @@ FocusScope {
|
||||
//! we use 100px. or 50px. in order to give space for othe views to be shown and to have also
|
||||
//! some space around the settings window
|
||||
property int maxHeight: plasmoid.formFactor === PlasmaCore.Types.Horizontal ?
|
||||
latteView.screenGeometry.height - latteView.normalThickness - 64 :
|
||||
latteView.screenGeometry.height - latteView.editThickness - 64 :
|
||||
latteView.height - 50
|
||||
property int maxWidth: 0.6 * latteView.screenGeometry.width
|
||||
|
||||
@ -178,10 +178,6 @@ FocusScope {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
viewConfig.hideConfigWindow();
|
||||
}
|
||||
|
||||
if (event.key === Qt.Key_Control) {
|
||||
plasmoid.configuration.inConfigureAppletsMode = !plasmoid.configuration.inConfigureAppletsMode;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: forceActiveFocus();
|
||||
|
Loading…
x
Reference in New Issue
Block a user