Add support for inverted orientations

This commit is contained in:
Renaud Casenave-Péré 2021-02-14 16:50:01 +01:00
parent af6777047a
commit be64929d27
25 changed files with 106 additions and 78 deletions

View file

@ -28,11 +28,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -28,11 +28,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -65,11 +65,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
SilicaWebView {

View file

@ -28,11 +28,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait
return Orientation.All;
}
ActiveDetector {}

View file

@ -43,7 +43,7 @@ Item {
property Flickable flick: null
// other
readonly property bool isPortrait: app.orientation === Orientation.Portrait
readonly property bool isPortrait: app.orientation == Orientation.Portrait || app.orientation == Orientation.PortraitInverted
readonly property int stdHeight: isPortrait ? Theme.itemSizeMedium : 0.8 * Theme.itemSizeMedium
height: root.stdHeight

View file

@ -29,11 +29,11 @@ Dialog {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -29,11 +29,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -28,11 +28,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -28,11 +28,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
property bool showBar: true

View file

@ -32,11 +32,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
property string title

View file

@ -70,11 +70,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
Component.onCompleted: {

View file

@ -29,11 +29,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
SilicaListView {

View file

@ -32,11 +32,11 @@ Dialog {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -31,11 +31,11 @@ Dialog {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -46,11 +46,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
onStatusChanged: {

View file

@ -45,11 +45,11 @@ Dialog {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
onAccepted: {

View file

@ -30,11 +30,11 @@ Dialog {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -28,11 +28,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -33,11 +33,11 @@ Dialog {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -29,11 +29,11 @@ Dialog {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -32,11 +32,11 @@ Dialog {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -31,11 +31,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait
return Orientation.All;
}
ActiveDetector {

View file

@ -30,11 +30,11 @@ Dialog {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
ActiveDetector {}

View file

@ -189,11 +189,11 @@ Page {
allowedOrientations: {
switch (settings.allowedOrientations) {
case 1:
return Orientation.Portrait;
return Orientation.PortraitMask;
case 2:
return Orientation.Landscape;
return Orientation.LandscapeMask;
}
return Orientation.Landscape | Orientation.Portrait;
return Orientation.All;
}
Component.onCompleted: init()

View file

@ -31,7 +31,7 @@ ApplicationWindow {
readonly property bool isNetvibes: settings.signinType >= 0 && settings.signinType < 10
readonly property bool isOldReader: settings.signinType >= 10 && settings.signinType < 20
readonly property bool isTTRss: settings.signinType >= 30 && settings.signinType < 40
readonly property int stdHeight: orientation==Orientation.Portrait ? Theme.itemSizeMedium : 0.8 * Theme.itemSizeMedium
readonly property int stdHeight: isPortraitOrientation(orientation) ? Theme.itemSizeMedium : 0.8 * Theme.itemSizeMedium
cover: CoverPage {}
@ -51,6 +51,10 @@ ApplicationWindow {
}
}
function isPortraitOrientation(orientation) {
return orientation == Orientation.Portrait || orientation == Orientation.PortraitInverted;
}
function hideBar() {
bar.hide();
}
@ -407,25 +411,49 @@ ApplicationWindow {
id: notification
}
property int panelWidth: app.orientation==Orientation.Portrait ? Screen.width : Screen.height
property int panelWidth: isPortraitOrientation(app.orientation) ? Screen.width : Screen.height
property int landscapeContentPanelWidth: isTablet ?
app.orientation === Orientation.Portrait ? Screen.width-700 : Screen.height-700 :
app.orientation === Orientation.Portrait ? Screen.width/2 : Screen.height/2
isPortraitOrientation(app.orientation) ? Screen.width-700 : Screen.height-700 :
isPortraitOrientation(app.orientation) ? Screen.width/2 : Screen.height/2
property int flickHeight: {
var size = 0
if (bar.open)
size += bar.stdHeight
return app.orientation === Orientation.Portrait ? Screen.height-size : Screen.width-size;
return isPortraitOrientation(app.orientation) ? Screen.height-size : Screen.width-size;
}
property int barX: {
switch (app.orientation) {
case Orientation.Portrait: return 0;
case Orientation.Landscape: return bar.height;
case Orientation.PortraitInverted: return Screen.width;
case Orientation.LandscapeInverted: return Screen.width - bar.height;
}
}
property int barY: {
switch (app.orientation) {
case Orientation.Portrait: return Screen.height - bar.height;
case Orientation.Landscape: return 0;
case Orientation.PortraitInverted: return bar.height;
case Orientation.LandscapeInverted: return Screen.height;
}
}
property int barX: app.orientation === Orientation.Portrait ? 0 : bar.height
property int barY: app.orientation === Orientation.Portrait ? Screen.height - bar.height : 0
readonly property alias barHeight: bar.height
ControlBar {
id: bar
busy: app.fetcherBusyStatus || dm.removerBusy || dm.busy
rotation: app.orientation === Orientation.Portrait ? 0 : 90
rotation: {
switch (app.orientation) {
case Orientation.Portrait: return 0;
case Orientation.Landscape: return 90;
case Orientation.PortraitInverted: 180;
case Orientation.LandscapeInverted: 270;
}
transformOrigin: Item.TopLeft
width: app.panelWidth