@ -62,13 +62,13 @@ FocusScope {
property int proposedWidth: 0.84 * proposedHeight + units . smallSpacing * 2
property int proposedWidth: 0.84 * proposedHeight + units . smallSpacing * 2
property int proposedHeight: 36 * theme . mSize ( theme . defaultFont ) . height
property int proposedHeight: 36 * theme . mSize ( theme . defaultFont ) . height
/ / ! u s e r s e t s c a l e s b a s e d o n i t s p r e f e r e n c e , e . g . 9 6 % o f t h e p r o p o s e d s i z e
property int userScaleWidth: plasmoid . configuration . windowWidthScale
property int userScaleHeight: plasmoid . configuration . windowHeightScale
/ / ! c h o s e n s i z e t o b e a p p l i e d , i f t h e u s e r h a s s e t o r n o t a d i f f e r e n t s c a l e f o r t h e s e t t i n g s w i n d o w
/ / ! c h o s e n s i z e t o b e a p p l i e d , i f t h e u s e r h a s s e t o r n o t a d i f f e r e n t s c a l e f o r t h e s e t t i n g s w i n d o w
property int chosenWidth: userScaleWidth !== 100 ? ( userScaleWidth / 100 ) * proposedWidth : proposedWidth
property int chosenWidth: userScaleWidth !== 1 ? userScaleWidth * proposedWidth : proposedWidth
property int chosenHeight: userScaleHeight !== 100 ? ( userScaleHeight / 100 ) * heightLevel * proposedHeight : heightLevel * proposedHeight
property int chosenHeight: userScaleHeight !== 1 ? userScaleHeight * heightLevel * proposedHeight : heightLevel * proposedHeight
/ / ! u s e r s e t s c a l e s b a s e d o n i t s p r e f e r e n c e , e . g . 9 6 % o f t h e p r o p o s e d s i z e
property real userScaleWidth: 1
property real userScaleHeight: 1
readonly property real heightLevel: ( dialog . expertLevel ? 100 : 1 )
readonly property real heightLevel: ( dialog . expertLevel ? 100 : 1 )
@ -105,6 +105,20 @@ FocusScope {
}
}
}
}
Component.onCompleted: {
updateScales ( ) ;
}
Connections {
target: latteView . positioner
onCurrentScreenNameChanged: dialog . updateScales ( ) ;
}
function updateScales ( ) {
userScaleWidth = universalSettings . screenWidthScale ( latteView . positioner . currentScreenName ) ;
userScaleHeight = universalSettings . screenHeightScale ( latteView . positioner . currentScreenName ) ;
}
PlasmaCore . FrameSvgItem {
PlasmaCore . FrameSvgItem {
anchors.fill: parent
anchors.fill: parent
imagePath: "dialogs/background"
imagePath: "dialogs/background"
@ -117,8 +131,10 @@ FocusScope {
hoverEnabled: true
hoverEnabled: true
property bool blockWheel: false
property bool blockWheel: false
property bool updatingWidthScale: false
property bool updatingHeightScale: false
property bool wheelTriggeredOnce: false
property bool wheelTriggeredOnce: false
property int scaleStep: 4
property real scaleStep: 0.0 4
onContainsMouseChanged: {
onContainsMouseChanged: {
if ( ! containsMouse ) {
if ( ! containsMouse ) {
@ -127,10 +143,16 @@ FocusScope {
}
}
onWheel: {
onWheel: {
if ( blockWheel || ! ( wheel . modifiers & Qt . MetaModifier ) ) {
var metaModifier = ( wheel . modifiers & Qt . MetaModifier ) ;
var ctrlModifier = ( wheel . modifiers & Qt . ControlModifier ) ;
if ( blockWheel || ! ( metaModifier || ctrlModifier ) ) {
return ;
return ;
}
}
updatingWidthScale = metaModifier || ( dialog . expertLevel && ctrlModifier ) ;
updatingHeightScale = ! dialog . expertLevel && ctrlModifier ;
blockWheel = true ;
blockWheel = true ;
wheelTriggeredOnce = true ;
wheelTriggeredOnce = true ;
scrollDelayer . start ( ) ;
scrollDelayer . start ( ) ;
@ -139,13 +161,27 @@ FocusScope {
/ / p o s i t i v e d i r e c t i o n
/ / p o s i t i v e d i r e c t i o n
if ( angle > 12 ) {
if ( angle > 12 ) {
plasmoid . configuration . windowWidthScale = plasmoid . configuration . windowWidthScale + scaleStep ;
var scales ;
plasmoid . configuration . windowHeightScale = plasmoid . configuration . windowHeightScale + scaleStep ;
if ( updatingWidthScale ) {
userScaleWidth = userScaleWidth + scaleStep ;
}
if ( updatingHeightScale ) {
userScaleHeight = userScaleHeight + scaleStep ;
}
universalSettings . setScreenScales ( latteView . positioner . currentScreenName , userScaleWidth , userScaleHeight ) ;
viewConfig . syncGeometry ( ) ;
viewConfig . syncGeometry ( ) ;
/ / n e g a t i v e d i r e c t i o n
/ / n e g a t i v e d i r e c t i o n
} else if ( angle < - 12 ) {
} else if ( angle < - 12 ) {
plasmoid . configuration . windowWidthScale = plasmoid . configuration . windowWidthScale - scaleStep ;
if ( updatingWidthScale ) {
plasmoid . configuration . windowHeightScale = plasmoid . configuration . windowHeightScale - scaleStep ;
userScaleWidth = userScaleWidth - scaleStep ;
}
if ( updatingHeightScale ) {
userScaleHeight = userScaleHeight - scaleStep ;
}
universalSettings . setScreenScales ( latteView . positioner . currentScreenName , userScaleWidth , userScaleHeight ) ;
viewConfig . syncGeometry ( ) ;
viewConfig . syncGeometry ( ) ;
}
}
}
}
@ -154,7 +190,9 @@ FocusScope {
PlasmaComponents . Label {
PlasmaComponents . Label {
anchors.top: parent . top
anchors.top: parent . top
anchors.horizontalCenter: parent . horizontalCenter
anchors.horizontalCenter: parent . horizontalCenter
text: i18nc ( "view settings window scale" , "Window scale at %0%" ) . arg ( userScaleWidth )
text: backgroundMouseArea . updatingWidthScale ?
i18nc ( "view settings width scale" , "Width scale at %0%" ) . arg ( userScaleWidth * 100 ) :
i18nc ( "view settings height scale" , "Height scale at %0%" ) . arg ( userScaleHeight * 100 )
visible: backgroundMouseArea . containsMouse && backgroundMouseArea . wheelTriggeredOnce
visible: backgroundMouseArea . containsMouse && backgroundMouseArea . wheelTriggeredOnce
}
}