1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2024-07-03 13:43:51 +00:00
harbour-sailfin/sailfish/qml/Constants.qml
Chris Josten edcd3a93af sailfin: Improve layout on landscape and tablet screens
I've dropped the whole `<constant> * Theme.pixelRatio`-approach[^1]
for determining when the UI should split into two columns, because
the values seemed quite arbitrary and I was entering random numbers.
I'm now doing it on multiples of `Theme.itemSizeHuge`, which is easier
to reason about.

This also fixes occasions where items in a grid would leave a bit of
space to the right in the CollectionPage.

Backdrop images in VideoPage and MusicAlbumPage now have a maximum
height of half of the screen, to avoid filling the entire screen in
landscape mode. Perhaps it doesn't always look good, but it makes the
layout more usable.

Images on the SeasonPage and MusicAlbumPage (in landscape) are now
aligned to the right, to avoid blocking the Page back indicator.
2024-06-03 21:50:14 +02:00

69 lines
2.1 KiB
QML

/*
Sailfin: a Jellyfin client written using Qt
Copyright (C) 2020-2024 Chris Josten
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
pragma Singleton
import QtQuick 2.6
import Sailfish.Silica 1.0
QtObject {
readonly property int gridColumns: {
switch(Screen.sizeCategory) {
case Screen.Small:
case Screen.Medium:
return 3
case Screen.Large:
return 5
case Screen.ExtraLarge:
return 7
}
}
readonly property real libraryDelegateWidth: {
switch(Screen.sizeCategory) {
case Screen.Small:
case Screen.Medium:
return Screen.width / 3
case Screen.Large:
return Screen.width / 5
case Screen.ExtraLarge:
return Screen.width / 7
}
}
readonly property real libraryDelegateHeight: {
switch(Screen.sizeCategory) {
case Screen.Small:
case Screen.Medium:
return Screen.width / 3
case Screen.Large:
return Screen.width / 5
case Screen.ExtraLarge:
return Screen.width / 7
}
}
readonly property real libraryDelegatePosterRatio: 1.5
readonly property real libraryDelegatePosterHeight: libraryDelegateHeight * libraryDelegatePosterRatio
readonly property real libraryProgressHeight: Theme.paddingMedium
readonly property real horizontalVideoAspectRatio: 1.66666 //itemData.PrimaryImageAspectRatio
}