Skip to content

Commit

Permalink
Screen rotation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Aug 22, 2024
1 parent ff0517f commit dce07ed
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 31 deletions.
2 changes: 1 addition & 1 deletion WatchFlower.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TARGET = WatchFlower

VERSION = 6.0

DEFINES+= APP_NAME=\\\"$$TARGET\\\"
DEFINES+= APP_VERSION=\\\"$$VERSION\\\"

Expand Down
6 changes: 3 additions & 3 deletions qml/About.qml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Loader {
spacing: Theme.componentMargin

ButtonSolid {
width: 150
width: isPhone ? 150 : 160
height: 40

text: qsTr("WEBSITE")
Expand All @@ -122,7 +122,7 @@ Loader {
}

ButtonSolid {
width: 150
width: isPhone ? 150 : 160
height: 40

text: qsTr("SUPPORT")
Expand All @@ -135,7 +135,7 @@ Loader {
}

ButtonSolid {
width: 150
width: isPhone ? 150 : 160
height: 40

visible: (appWindow.width > 800)
Expand Down
21 changes: 20 additions & 1 deletion qml/ComponentLibrary/ThemeEngine.qml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,26 @@ Item {
var rightnow = new Date()
var hour = Qt.formatDateTime(rightnow, "hh")
if (hour >= 21 || hour <= 8) {
themeIndex = ThemeEngine.THEME_NIGHT
if (themeIndex === ThemeEngine.THEME_MOBILE_LIGHT)
themeIndex = ThemeEngine.THEME_MOBILE_DARK

if (themeIndex === ThemeEngine.THEME_MATERIAL_LIGHT)
themeIndex = ThemeEngine.THEME_MATERIAL_DARK

if (themeIndex === ThemeEngine.THEME_DESKTOP_LIGHT)
themeIndex = ThemeEngine.THEME_DESKTOP_DARK

if (themeIndex === ThemeEngine.THEME_SNOW ||
themeIndex === ThemeEngine.THEME_PLANT ||
themeIndex === ThemeEngine.THEME_RAIN ||
themeIndex === ThemeEngine.THEME_DAY)
themeIndex = ThemeEngine.THEME_NIGHT

if (themeIndex === ThemeEngine.THEME_LIGHT_AND_WARM ||
themeIndex === ThemeEngine.THEME_PLAIN_AND_BORING)
themeIndex = ThemeEngine.THEME_DARK_AND_SPOOKY

// theme doesn't have a dark variant set? just don't change the theme...
}
}

Expand Down
2 changes: 1 addition & 1 deletion qml/ComponentLibrary/generic/IconSvg.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Item {
property alias source: sourceImg.source
property alias color: overlayImg.colorizationColor
property alias fillMode: sourceImg.fillMode
property alias smooth: sourceImg.smooth
//property alias smooth: sourceImg.smooth // Qt 6.7+ only
property alias asynchronous: sourceImg.asynchronous

Image {
Expand Down
1 change: 1 addition & 0 deletions qml/DeviceEnvironmental.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "qrc:/js/UtilsDeviceSensors.js" as UtilsDeviceSensors

Loader {
id: deviceEnvironmental
anchors.fill: parent

property var currentDevice: null

Expand Down
1 change: 1 addition & 0 deletions qml/DevicePlantSensor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ThemeEngine

Loader {
id: devicePlantSensor
anchors.fill: parent

property var currentDevice: null

Expand Down
1 change: 1 addition & 0 deletions qml/DeviceThermometer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "qrc:/js/UtilsDeviceSensors.js" as UtilsDeviceSensors

Loader {
id: deviceThermometer
anchors.fill: parent

property var currentDevice: null

Expand Down
20 changes: 11 additions & 9 deletions qml/MobileApplication.qml
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,9 @@ ApplicationWindow {

anchors.top: appHeader.bottom
anchors.left: parent.left
anchors.leftMargin: screenPaddingLeft
anchors.right: parent.right
anchors.rightMargin: screenPaddingRight
anchors.bottom: parent.bottom
anchors.bottomMargin: screenPaddingBottom
anchors.bottomMargin: screenPaddingNavbar + screenPaddingBottom

focus: true
Keys.onBackPressed: {
Expand Down Expand Up @@ -327,45 +325,49 @@ ApplicationWindow {

Tutorial {
id: screenTutorial
anchors.fill: parent
}

DeviceList {
id: screenDeviceList
anchors.fill: parent
anchors.leftMargin: screenPaddingLeft
anchors.rightMargin: screenPaddingRight
anchors.bottomMargin: mobileMenu.hhv
}
DevicePlantSensor {
id: screenDevicePlantSensor
anchors.fill: parent
anchors.bottomMargin: mobileMenu.hhv
}
DeviceThermometer {
id: screenDeviceThermometer
anchors.fill: parent
anchors.bottomMargin: mobileMenu.hhv
}
DeviceEnvironmental {
id: screenDeviceEnvironmental
anchors.fill: parent
anchors.bottomMargin: mobileMenu.hhv
}

Settings {
id: screenSettings
anchors.fill: parent
anchors.leftMargin: screenPaddingLeft
anchors.rightMargin: screenPaddingRight
anchors.bottomMargin: mobileMenu.hhv
}
SettingsAdvanced {
id: screenSettingsAdvanced
anchors.leftMargin: screenPaddingLeft
anchors.rightMargin: screenPaddingRight
anchors.bottomMargin: mobileMenu.hhv
}
About {
id: screenAbout
anchors.leftMargin: screenPaddingLeft
anchors.rightMargin: screenPaddingRight
anchors.bottomMargin: mobileMenu.hhv
}
MobilePermissions {
id: screenAboutPermissions
anchors.leftMargin: screenPaddingLeft
anchors.rightMargin: screenPaddingRight
anchors.bottomMargin: mobileMenu.hhv
}

Expand Down
2 changes: 2 additions & 0 deletions qml/MobileDrawer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ DrawerThemed {
anchors.bottom: parent.bottom
anchors.bottomMargin: screenPaddingNavbar + screenPaddingBottom

visible: (screenOrientation === Qt.PortraitOrientation)

DrawerItem {
highlighted: (appContent.state === "PlantBrowser")
text: qsTr("Plant browser")
Expand Down
12 changes: 0 additions & 12 deletions qml/SettingsAdvanced.qml
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,12 @@ Loader {
textFormat: Text.PlainText
font.pixelSize: Theme.fontSizeContent
}
Text {
color: Theme.colorSubText
text: "OS theme: %1".arg(utilsApp.isOsThemeDark() ? "dark" : "light")
textFormat: Text.PlainText
font.pixelSize: Theme.fontSizeContent
}
Text {
color: Theme.colorSubText
text: "Qt version: %1".arg(utilsApp.qtVersion())
textFormat: Text.PlainText
font.pixelSize: Theme.fontSizeContent
}
Text {
color: Theme.colorSubText
text: "Qt arch: %1".arg(utilsApp.qtArchitecture())
textFormat: Text.PlainText
font.pixelSize: Theme.fontSizeContent
}
Text {
color: Theme.colorSubText
text: "Qt Connectivity patched: %1".arg(qtConnectivityPatched ? "TRUE" : "FALSE")
Expand Down
10 changes: 6 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ int main(int argc, char *argv[])
#endif
}

// GUI application /////////////////////////////////////////////////////////

// Qt 6.7+ debugger hack
qputenv("QT_ANDROID_DEBUGGER_MAIN_THREAD_SLEEP_MS", "0");
// Hacks ///////////////////////////////////////////////////////////////////

#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
// NVIDIA suspend&resume hack
Expand All @@ -142,6 +139,11 @@ int main(int argc, char *argv[])
qputenv("QT_QUICK_FLICKABLE_WHEEL_DECELERATION", "2500");
#endif

// Qt 6.7+ debugger hack
qputenv("QT_ANDROID_DEBUGGER_MAIN_THREAD_SLEEP_MS", "0");

// GUI application /////////////////////////////////////////////////////////

SingleApplication app(argc, argv, true);

// Application name
Expand Down

0 comments on commit dce07ed

Please sign in to comment.