mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-24 05:33:50 +03:00
introduce minimum length option
--found also some fixes for mask calculations in right or bottom alignment
This commit is contained in:
parent
1d8fe4541c
commit
ecd39b4098
@ -173,6 +173,9 @@
|
||||
<entry name="showGlow" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="minLength" type="Int">
|
||||
<default>0</default>
|
||||
</entry>
|
||||
<entry name="maxLength" type="Int">
|
||||
<default>100</default>
|
||||
</entry>
|
||||
|
@ -135,6 +135,22 @@ Window{
|
||||
text: root.maxLength
|
||||
}
|
||||
|
||||
Text{
|
||||
text: "Min Length"+space
|
||||
}
|
||||
|
||||
Text{
|
||||
text: root.minLengthPerCentage +"%"
|
||||
}
|
||||
|
||||
Text{
|
||||
text: "Min Length (pixels)"+space
|
||||
}
|
||||
|
||||
Text{
|
||||
text: root.minLength
|
||||
}
|
||||
|
||||
Text{
|
||||
text: "Offset (pixels)"+space
|
||||
}
|
||||
@ -356,6 +372,24 @@ Window{
|
||||
case Latte.Types.DodgeAllWindows:
|
||||
return "Dodge All Windows";
|
||||
break;
|
||||
case Latte.Types.DodgeAllWindows:
|
||||
return "Dodge All Windows";
|
||||
break;
|
||||
case Latte.Types.WindowsGoBelow:
|
||||
return "Windows Go Below";
|
||||
break;
|
||||
case Latte.Types.WindowsCanCover:
|
||||
return "Windows Can Cover";
|
||||
break;
|
||||
case Latte.Types.WindowsAlwaysCover:
|
||||
return "Windows Always Cover";
|
||||
break;
|
||||
case Latte.Types.SideBar:
|
||||
return "OnDemand SideBar";
|
||||
break;
|
||||
case Latte.Types.NormalWindow:
|
||||
return "Normal Window";
|
||||
break;
|
||||
case Latte.Types.None:
|
||||
return "None";
|
||||
break;
|
||||
|
@ -58,7 +58,7 @@ Item{
|
||||
if ((root.panelAlignment === Latte.Types.Justify) && root.isHorizontal) {
|
||||
return root.maxLength;
|
||||
} else {
|
||||
return layoutsContainerItem.mainLayout.width + spacing;
|
||||
return Math.max(root.minLength, layoutsContainerItem.mainLayout.width + spacing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,7 @@ Item{
|
||||
if ((root.panelAlignment === Latte.Types.Justify) && root.isVertical) {
|
||||
return root.maxLength;
|
||||
} else {
|
||||
return layoutsContainerItem.mainLayout.height + spacing;
|
||||
return Math.max(root.minLength, layoutsContainerItem.mainLayout.height + spacing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -326,6 +326,7 @@ Item{
|
||||
target:root
|
||||
onPanelShadowChanged: updateMaskArea();
|
||||
onPanelThickMarginHighChanged: updateMaskArea();
|
||||
onRealPanelLengthChanged: updateMaskArea();
|
||||
}
|
||||
|
||||
Connections{
|
||||
@ -484,12 +485,20 @@ Item{
|
||||
tempLength = root.isHorizontal ? root.width : root.height;
|
||||
} else {
|
||||
if(root.isHorizontal) {
|
||||
tempLength = plasmoid.configuration.panelPosition === Latte.Types.Justify ?
|
||||
layoutsContainer.width + space : layoutsContainer.mainLayout.width + space;
|
||||
if (plasmoid.configuration.panelPosition === Latte.Types.Justify) {
|
||||
tempLength = layoutsContainer.width;
|
||||
} else {
|
||||
tempLength = Math.max(root.realPanelLength, layoutsContainer.mainLayout.width);
|
||||
}
|
||||
} else {
|
||||
tempLength = plasmoid.configuration.panelPosition === Latte.Types.Justify ?
|
||||
layoutsContainer.height + space : layoutsContainer.mainLayout.height + space;
|
||||
if (plasmoid.configuration.panelPosition === Latte.Types.Justify) {
|
||||
tempLength = layoutsContainer.height;
|
||||
} else {
|
||||
tempLength = Math.max(root.realPanelLength, layoutsContainer.mainLayout.height);
|
||||
}
|
||||
}
|
||||
|
||||
tempLength = tempLength + space;
|
||||
}
|
||||
|
||||
tempThickness = thicknessNormal;
|
||||
@ -535,7 +544,7 @@ Item{
|
||||
} else if (root.panelAlignment === Latte.Types.Center) {
|
||||
localX = (latteView.width/2) - tempLength/2 + root.offset;
|
||||
} else if (root.panelAlignment === Latte.Types.Right) {
|
||||
localX = latteView.width - layoutsContainer.mainLayout.width - space - root.offset;
|
||||
localX = latteView.width - tempLength - root.offset;
|
||||
}
|
||||
} else if ((plasmoid.location === PlasmaCore.Types.LeftEdge) || (plasmoid.location === PlasmaCore.Types.RightEdge)){
|
||||
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
|
||||
@ -565,7 +574,7 @@ Item{
|
||||
} else if (root.panelAlignment === Latte.Types.Center) {
|
||||
localY = (latteView.height/2) - tempLength/2 + root.offset;
|
||||
} else if (root.panelAlignment === Latte.Types.Bottom) {
|
||||
localY = latteView.height - layoutsContainer.mainLayout.height - space - root.offset;
|
||||
localY = latteView.height - tempLength - root.offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,8 +282,17 @@ Item {
|
||||
}
|
||||
|
||||
property int latteAppletPos: -1
|
||||
property int minLengthPerCentage: plasmoid.configuration.minLength
|
||||
property int maxLengthPerCentage: hideLengthScreenGaps ? 100 : plasmoid.configuration.maxLength
|
||||
|
||||
property int minLength: {
|
||||
if (root.isHorizontal) {
|
||||
return behaveAsPlasmaPanel ? width : width * (minLengthPerCentage/100)
|
||||
} else {
|
||||
return behaveAsPlasmaPanel ? height : height * (minLengthPerCentage/100)
|
||||
}
|
||||
}
|
||||
|
||||
property int maxLength: {
|
||||
if (root.isHorizontal) {
|
||||
return behaveAsPlasmaPanel ? width : width * (maxLengthPerCentage/100)
|
||||
|
@ -326,16 +326,23 @@ PlasmaComponents.Page {
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: lengthColumn
|
||||
Layout.leftMargin: units.smallSpacing * 2
|
||||
Layout.rightMargin: units.smallSpacing * 2
|
||||
spacing: 0
|
||||
|
||||
readonly property int labelsMaxWidth: Math.max(maxLengthLbl.implicitWidth,
|
||||
minLengthLbl.implicitWidth,
|
||||
offsetLbl.implicitWidth)
|
||||
|
||||
RowLayout {
|
||||
Layout.minimumWidth: dialog.optionsWidth
|
||||
Layout.maximumWidth: Layout.minimumWidth
|
||||
spacing: units.smallSpacing
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: maxLengthLbl
|
||||
Layout.minimumWidth: lengthColumn.labelsMaxWidth
|
||||
text: i18n("Maximum")
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
}
|
||||
@ -345,14 +352,16 @@ PlasmaComponents.Page {
|
||||
id: maxLengthSlider
|
||||
|
||||
value: plasmoid.configuration.maxLength
|
||||
from: 30
|
||||
from: 0
|
||||
to: 100
|
||||
stepSize: 1
|
||||
wheelEnabled: false
|
||||
|
||||
readonly property int localMinValue: 30
|
||||
|
||||
function updateMaxLength() {
|
||||
if (!pressed) {
|
||||
plasmoid.configuration.maxLength = value;
|
||||
plasmoid.configuration.maxLength = Math.max(value, plasmoid.configuration.minLength, localMinValue);
|
||||
var newTotal = Math.abs(plasmoid.configuration.offset) + value;
|
||||
|
||||
//centered and justify alignments based on offset and get out of the screen in some cases
|
||||
@ -379,6 +388,14 @@ PlasmaComponents.Page {
|
||||
plasmoid.configuration.offset = Math.max(0, 100-value);
|
||||
}
|
||||
}
|
||||
|
||||
if (plasmoid.configuration.maxLength < plasmoid.configuration.minLength) {
|
||||
minLengthSlider.updateMinLength();
|
||||
}
|
||||
} else {
|
||||
if ((value < plasmoid.configuration.minLength) || (value < localMinValue)) {
|
||||
value = Math.max(plasmoid.configuration.minLength, localMinValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,8 +425,69 @@ PlasmaComponents.Page {
|
||||
Layout.maximumWidth: Layout.minimumWidth
|
||||
spacing: units.smallSpacing
|
||||
visible: dialog.expertLevel
|
||||
enabled: (plasmoid.configuration.panelPosition !== Latte.Types.Justify)
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: minLengthLbl
|
||||
Layout.minimumWidth: lengthColumn.labelsMaxWidth
|
||||
text: i18n("Minimum")
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
}
|
||||
|
||||
LatteComponents.Slider {
|
||||
Layout.fillWidth: true
|
||||
id: minLengthSlider
|
||||
|
||||
value: plasmoid.configuration.minLength
|
||||
from: 0
|
||||
to: 100
|
||||
stepSize: 1
|
||||
wheelEnabled: false
|
||||
|
||||
function updateMinLength() {
|
||||
if (!pressed) {
|
||||
plasmoid.configuration.minLength = value; //Math.min(value, plasmoid.configuration.maxLength);
|
||||
|
||||
if (plasmoid.configuration.minLength > maxLengthSlider.value) {
|
||||
maxLengthSlider.updateMaxLength();
|
||||
}
|
||||
} else {
|
||||
if (value > plasmoid.configuration.maxLength) {
|
||||
value = plasmoid.configuration.maxLength
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onPressedChanged: {
|
||||
updateMinLength();
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
valueChanged.connect(updateMinLength)
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
valueChanged.disconnect(updateMinLength)
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
text: i18nc("number in percentage, e.g. 85 %","%0 %").arg(minLengthSlider.value)
|
||||
horizontalAlignment: Text.AlignRight
|
||||
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
|
||||
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.minimumWidth: dialog.optionsWidth
|
||||
Layout.maximumWidth: Layout.minimumWidth
|
||||
spacing: units.smallSpacing
|
||||
visible: dialog.expertLevel
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: offsetLbl
|
||||
Layout.minimumWidth: lengthColumn.labelsMaxWidth
|
||||
text: i18n("Offset")
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
}
|
||||
@ -755,7 +833,7 @@ PlasmaComponents.Page {
|
||||
exclusiveGroup: windowColorsGroup
|
||||
tooltip: universalSettings.colorsScriptIsPresent ?
|
||||
i18n("Colors are going to be based on windows that are touching the view") :
|
||||
i18n("Colors are going to be based on windows that are touching the view.\nNotice: For optimal experience you are advised to install Colors KWin Script from KDE Store")
|
||||
i18n("Colors are going to be based on windows that are touching the view.\nNotice: For optimal experience you are advised to install Colors KWin Script from KDE Store")
|
||||
|
||||
readonly property int colors: Latte.Types.TouchingWindowColors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user