1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-09 17:18:11 +03:00

a way for the user to change settings window size

--user can now use Meta+ScrollWheel in order to
increase/decrease the size of the dock settings
window according to its preference

BUG: 397038
This commit is contained in:
Michail Vourlakos 2018-08-03 01:50:46 +03:00
parent 04b2d84abb
commit fef362a52f
6 changed files with 86 additions and 14 deletions

View File

@ -188,6 +188,14 @@
<entry name="configurationSticker" type="Bool">
<default>false</default>
</entry>
<entry name="windowWidthScale" type="Int">
<default>100</default>
<label>user set dock settings window width scale</label>
</entry>
<entry name="windowHeightScale" type="Int">
<default>100</default>
<label>user set dock settings window height scale</label>
</entry>
<!-- Tasks properties -->
<entry name="threeColorsWindows" type="Bool">
<default>false</default>

View File

@ -49,7 +49,7 @@ PlasmaComponents.Page {
ColumnLayout {
id: content
width: dialog.maxWidth - Layout.leftMargin * 2
width: (dialog.appliedWidth - units.smallSpacing * 2) - Layout.leftMargin * 2
spacing: dialog.subGroupSpacing
anchors.horizontalCenter: parent.horizontalCenter
Layout.leftMargin: units.smallSpacing * 2

View File

@ -41,7 +41,7 @@ PlasmaComponents.Page {
ColumnLayout {
id: content
width: dialog.maxWidth - 2 * Layout.leftMargin
width: (dialog.appliedWidth - units.smallSpacing * 2) - Layout.leftMargin * 2
spacing: dialog.subGroupSpacing
anchors.horizontalCenter: parent.horizontalCenter
Layout.leftMargin: units.smallSpacing * 2

View File

@ -40,12 +40,18 @@ import "../controls" as LatteExtraControls
FocusScope {
id: dialog
property int maxWidth: Math.max(200, 0.87 * proposedHeight)
property int proposedWidth: Math.max(200, 0.87 * proposedHeight) + units.smallSpacing * 2
property int proposedHeight: Math.min(dock.screenGeometry.height - dock.normalThickness - 2*units.largeSpacing,
Math.max(400, 36 * theme.mSize(theme.defaultFont).height))
width: maxWidth + units.smallSpacing * 2
height: proposedHeight
property int userScaleWidth: plasmoid.configuration.windowWidthScale
property int userScaleHeight: plasmoid.configuration.windowHeightScale
property int appliedWidth: userScaleWidth !== 100 ? Math.max(200, (userScaleWidth/100) * proposedWidth) : proposedWidth
property int appliedHeight: userScaleHeight !== 100 ? Math.max(400, (userScaleHeight/100) * proposedHeight) : proposedHeight
width: appliedWidth
height: appliedHeight
Layout.minimumWidth: width
Layout.minimumHeight: height
@ -66,6 +72,64 @@ FocusScope {
enabledBorders: dockConfig.enabledBorders
}
MouseArea{
id: backgroundMouseArea
anchors.fill: parent
hoverEnabled: true
property bool blockWheel: false
property bool wheelTriggeredOnce: false
property int scaleStep: 4
onContainsMouseChanged: {
if (!containsMouse) {
wheelTriggeredOnce = false;
}
}
onWheel: {
if (blockWheel || !(wheel.modifiers & Qt.MetaModifier)){
return;
}
blockWheel = true;
wheelTriggeredOnce = true;
scrollDelayer.start();
var angle = wheel.angleDelta.y / 8;
//positive direction
if (angle > 12) {
plasmoid.configuration.windowWidthScale = plasmoid.configuration.windowWidthScale + scaleStep;
plasmoid.configuration.windowHeightScale = plasmoid.configuration.windowHeightScale + scaleStep;
dockConfig.syncGeometry();
//negative direction
} else if (angle < -12) {
plasmoid.configuration.windowWidthScale = plasmoid.configuration.windowWidthScale - scaleStep;
plasmoid.configuration.windowHeightScale = plasmoid.configuration.windowHeightScale - scaleStep;
dockConfig.syncGeometry();
}
}
}
PlasmaComponents.Label{
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
text: i18nc("dock settings window scale","Window scale at %0%").arg(userScaleWidth)
visible: backgroundMouseArea.containsMouse && backgroundMouseArea.wheelTriggeredOnce
}
//! A timer is needed in order to handle also touchpads that probably
//! send too many signals very fast. This way the signals per sec are limited.
//! The user needs to have a steady normal scroll in order to not
//! notice a annoying delay
Timer{
id: scrollDelayer
interval: 300
onTriggered: backgroundMouseArea.blockWheel = false;
}
ColumnLayout {
id: content
@ -73,7 +137,7 @@ FocusScope {
Layout.minimumHeight: calculatedHeight
Layout.preferredWidth: width
Layout.preferredHeight: calculatedHeight
width: dialog.maxWidth
width: (dialog.appliedWidth - units.smallSpacing * 2)
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
@ -318,7 +382,7 @@ FocusScope {
PlasmaComponents.TabBar {
id: tabBar
Layout.fillWidth: true
Layout.maximumWidth: maxWidth
Layout.maximumWidth: (dialog.appliedWidth - units.smallSpacing * 2)
PlasmaComponents.TabButton {
id: behaviorTabBtn
@ -350,11 +414,11 @@ FocusScope {
id: pagesBackground
Layout.fillWidth: true
Layout.fillHeight: false
Layout.minimumWidth: maxWidth - 2*units.smallSpacing
Layout.minimumWidth: dialog.appliedWidth - units.smallSpacing * 4
Layout.minimumHeight: height
Layout.maximumHeight: height
width: maxWidth - units.smallSpacing
width: dialog.appliedWidth - units.smallSpacing * 3
height: availableFreeHeight + units.smallSpacing * 4
color: transparentBackgroundColor
@ -362,7 +426,7 @@ FocusScope {
border.color: theme.backgroundColor
//fix the height binding loop when showing the configuration window
property int availableFreeHeight: dialog.proposedHeight - header.height - headerSpacer.height - tabBar.height - actionButtons.height - 2 * units.smallSpacing
property int availableFreeHeight: dialog.appliedHeight - header.height - headerSpacer.height - tabBar.height - actionButtons.height - 2 * units.smallSpacing
PlasmaExtras.ScrollArea {
id: scrollArea

View File

@ -39,7 +39,7 @@ PlasmaComponents.Page {
ColumnLayout {
id: content
width: dialog.maxWidth - Layout.leftMargin * 2
width: (dialog.appliedWidth - units.smallSpacing * 2) - Layout.leftMargin * 2
spacing: dialog.subGroupSpacing
anchors.horizontalCenter: parent.horizontalCenter
Layout.leftMargin: units.smallSpacing * 2

View File

@ -35,7 +35,7 @@ PlasmaComponents.Page {
ColumnLayout {
id: content
width: dialog.maxWidth - Layout.leftMargin * 2
width: (dialog.appliedWidth - units.smallSpacing * 2) - Layout.leftMargin * 2
spacing: dialog.subGroupSpacing
anchors.horizontalCenter: parent.horizontalCenter
Layout.leftMargin: units.smallSpacing * 2
@ -99,7 +99,7 @@ PlasmaComponents.Page {
PlasmaComponents.CheckBox {
id: solidForMaximizedChk
Layout.leftMargin: units.smallSpacing * 2
Layout.maximumWidth: dialog.maxWidth - 3*units.smallSpacing
Layout.maximumWidth: (dialog.appliedWidth - units.smallSpacing * 2) - 3*units.smallSpacing
text: i18n("Force solid background for maximized or snapped windows")
checked: plasmoid.configuration.solidBackgroundForMaximized
tooltip: i18n("The panel background removes its transparency setting \n when there is a maximized or snapped window")
@ -126,7 +126,7 @@ PlasmaComponents.Page {
id: colorizeTransparentPanelsChk
Layout.leftMargin: units.smallSpacing * 2
Layout.bottomMargin: units.smallSpacing
Layout.maximumWidth: dialog.maxWidth - 3*units.smallSpacing
Layout.maximumWidth: (dialog.appliedWidth - units.smallSpacing * 2) - units.smallSpacing * 3
text: i18n("Monochrome contents when panel is transparent")
checked: plasmoid.configuration.colorizeTransparentPanels
tooltip: i18n("The panel contents are colorized in order to improve contrast \nwith the underlying desktop background when the panel is transparent")