mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile-widgets/qml: secure subsurfaceTheme.initial*
move initialWidth/initialHeight out of subsurfaceTheme to placeHolder, this secures no change in behaviour. Signed-off-by: jan Iversen <jan@casacondor.com>
This commit is contained in:
parent
c3be85fbd9
commit
38120d555f
1 changed files with 25 additions and 20 deletions
|
@ -590,6 +590,23 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
||||||
manager.appendTextToLog("Done setting up sizes")
|
manager.appendTextToLog("Done setting up sizes")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: placeHolder
|
||||||
|
|
||||||
|
property int initialWidth: rootItem.width
|
||||||
|
property int initialHeight: rootItem.height
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
// break the binding
|
||||||
|
initialWidth = initialWidth * 1
|
||||||
|
manager.appendTextToLog("SubsufaceTheme constructor completed, initial width " + initialWidth)
|
||||||
|
if (rootItem.firstChange) // only run the setup if we haven't seen a change, yet
|
||||||
|
setupUnits() // but don't count this as a change (after all, it's not)
|
||||||
|
else
|
||||||
|
manager.appendTextToLog("Already adjusted size, ignoring this")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: subsurfaceTheme
|
id: subsurfaceTheme
|
||||||
|
|
||||||
|
@ -612,28 +629,16 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
||||||
property color contrastAccentColor: ThemeNew.contrastAccentColor
|
property color contrastAccentColor: ThemeNew.contrastAccentColor
|
||||||
property color lightDrawerColor: ThemeNew.lightDrawerColor
|
property color lightDrawerColor: ThemeNew.lightDrawerColor
|
||||||
|
|
||||||
property int initialWidth: rootItem.width
|
|
||||||
property int initialHeight: rootItem.height
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
// break the binding
|
|
||||||
initialWidth = initialWidth * 1
|
|
||||||
manager.appendTextToLog("SubsufaceTheme constructor completed, initial width " + initialWidth)
|
|
||||||
if (rootItem.firstChange) // only run the setup if we haven't seen a change, yet
|
|
||||||
setupUnits() // but don't count this as a change (after all, it's not)
|
|
||||||
else
|
|
||||||
manager.appendTextToLog("Already adjusted size, ignoring this")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onWidthChanged: {
|
onWidthChanged: {
|
||||||
manager.appendTextToLog("Window width changed to " + width + " orientation " + Screen.primaryOrientation)
|
manager.appendTextToLog("Window width changed to " + width + " orientation " + Screen.primaryOrientation)
|
||||||
if (subsurfaceTheme.initialWidth !== undefined) {
|
if (placeHolder.initialWidth !== undefined) {
|
||||||
if (width !== subsurfaceTheme.initialWidth && rootItem.firstChange) {
|
if (width !== placeHolder.initialWidth && rootItem.firstChange) {
|
||||||
rootItem.firstChange = false
|
rootItem.firstChange = false
|
||||||
rootItem.lastOrientation = Screen.primaryOrientation
|
rootItem.lastOrientation = Screen.primaryOrientation
|
||||||
subsurfaceTheme.initialWidth = width
|
placeHolder.initialWidth = width
|
||||||
subsurfaceTheme.initialHeight = height
|
placeHolder.initialHeight = height
|
||||||
manager.appendTextToLog("first real change, so recalculating units and recording size as " + width + " x " + height)
|
manager.appendTextToLog("first real change, so recalculating units and recording size as " + width + " x " + height)
|
||||||
setupUnits()
|
setupUnits()
|
||||||
} else if (rootItem.lastOrientation !== undefined && rootItem.lastOrientation !== Screen.primaryOrientation) {
|
} else if (rootItem.lastOrientation !== undefined && rootItem.lastOrientation !== Screen.primaryOrientation) {
|
||||||
|
@ -642,10 +647,10 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
||||||
setupUnits()
|
setupUnits()
|
||||||
} else {
|
} else {
|
||||||
manager.appendTextToLog("size change without rotation to " + width + " x " + height)
|
manager.appendTextToLog("size change without rotation to " + width + " x " + height)
|
||||||
if (width > subsurfaceTheme.initialWidth) {
|
if (width > placeHolder.initialWidth) {
|
||||||
manager.appendTextToLog("resetting to initial width " + subsurfaceTheme.initialWidth + " and height " + subsurfaceTheme.initialHeight)
|
manager.appendTextToLog("resetting to initial width " + placeHolder.initialWidth + " and height " + placeHolder.initialHeight)
|
||||||
rootItem.width = subsurfaceTheme.initialWidth
|
rootItem.width = placeHolder.initialWidth
|
||||||
rootItem.height = subsurfaceTheme.initialHeight
|
rootItem.height = placeHolder.initialHeight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue