Skip to content

Commit

Permalink
Move values to separate component
Browse files Browse the repository at this point in the history
Name most dimensional values. Baby steps towards device agnostic UI.

Signed-off-by: Tomi Leppänen <[email protected]>
  • Loading branch information
Tomin1 committed Sep 21, 2024
1 parent b55389e commit 00f5797
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 82 deletions.
54 changes: 54 additions & 0 deletions qml/Dimensions.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
This file is part of Trites.
Copyright (C) 2024 tomin <[email protected]>
Trites is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Trites is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Trites. If not, see <http://www.gnu.org/licenses/>.
*/

import Sailfish.Silica 1.0
import QtQuick 2.6

Item {
readonly property real scalingFactor: Math.min(Screen.width / 480, Screen.height / 854)

readonly property int buttonLeftMargin: scalingFactor * 96

readonly property int containerContentWidth: scalingFactor * 416
readonly property int containerHeight: scalingFactor * 724
readonly property int containerTopMargin: scalingFactor * 130

readonly property int fontSizeBig: scalingFactor * 48
readonly property int fontSizeSmall: scalingFactor * 24

readonly property int menuButtonHeight: scalingFactor * 60
readonly property int menuButtonWidth: scalingFactor * 288
readonly property int menuButtonFontSize: scalingFactor * 32

readonly property int placeholderFontSize: scalingFactor * 48

readonly property int marginLess: scalingFactor * 25
readonly property int marginMedium: scalingFactor * 32
readonly property int marginSmall: scalingFactor * 16
readonly property int marginTiny: scalingFactor * 5
readonly property int marginTop: Screen.height / 854 * 32

readonly property int pauseButtonSize: scalingFactor * 60

readonly property int sidebarFontSize: scalingFactor * 30
readonly property int sidebarRowHeight: scalingFactor * 33
readonly property int sidebarWidth: scalingFactor * 118

readonly property int titleLogoWidth: scalingFactor * 374
readonly property int titleLogoHeight: scalingFactor * 104
}
6 changes: 3 additions & 3 deletions qml/MenuButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import Sailfish.Silica 1.0
import QtQuick 2.6

Image {
width: window.scaledValue(288)
height: window.scaledValue(60)
width: dimensions.menuButtonWidth
height: dimensions.menuButtonHeight
source: mousearea.pressed ? "data/menubutton_pressed.svg" : "data/menubutton_unpressed.svg"

property bool bPressed: false
Expand All @@ -32,7 +32,7 @@ Image {
Text {
anchors.fill: parent
text: parent.label
font.pixelSize: window.scaledValue(24) * 1.5
font.pixelSize: dimensions.menuButtonFontSize
font.weight: Font.Bold
color: "white"
verticalAlignment: Text.AlignVCenter
Expand Down
Loading

0 comments on commit 00f5797

Please sign in to comment.