From 2ff14cfaa934b6604c241db6ef1c2b7638002e24 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Sat, 22 Nov 2014 18:24:44 +0100 Subject: [PATCH] Dialog and menu positioning --- common/GPodderPlatform.qml | 1 + touch/Dialog.qml | 14 ++++++++++++-- touch/EpisodesPage.qml | 2 +- touch/Main.qml | 4 +++- touch/PodcastDetail.qml | 2 +- touch/PodcastsPage.qml | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/common/GPodderPlatform.qml b/common/GPodderPlatform.qml index 0c5affc..3fe70b1 100644 --- a/common/GPodderPlatform.qml +++ b/common/GPodderPlatform.qml @@ -30,4 +30,5 @@ Item { property bool invertedToolbar: toolbarOnTop property bool titleInToolbar: toolbarOnTop property bool floatingPlayButton: android + property bool hideDisabledMenu: android } diff --git a/touch/Dialog.qml b/touch/Dialog.qml index a73f244..ff25352 100644 --- a/touch/Dialog.qml +++ b/touch/Dialog.qml @@ -25,6 +25,8 @@ import 'common/constants.js' as Constants Rectangle { id: page z: 200 + property bool activatedFromMenu: false + property bool attachToToolbar: platform.toolbarOnTop && activatedFromMenu color: Constants.colors.dialogBackground @@ -68,8 +70,16 @@ Rectangle { property int maxHeight: parent.height - toolbar.height height: ((page.contentHeight > 0 && page.contentHeight < maxHeight) ? page.contentHeight : maxHeight) * parent.opacity anchors { - horizontalCenter: parent.horizontalCenter - top: parent.top + horizontalCenter: activatedFromMenu ? undefined : parent.horizontalCenter + verticalCenter: activatedFromMenu ? undefined : parent.verticalCenter + + right: activatedFromMenu ? parent.right : undefined + + top: (activatedFromMenu && platform.toolbarOnTop) ? parent.top : undefined + topMargin: (activatedFromMenu && platform.toolbarOnTop) ? pgst.bottomSpacing : 0 + + bottom: (activatedFromMenu && !platform.toolbarOnTop) ? parent.bottom : undefined + bottomMargin: (activatedFromMenu && !platform.toolbarOnTop) ? pgst.bottomSpacing : 0 } color: Constants.colors.dialog clip: true diff --git a/touch/EpisodesPage.qml b/touch/EpisodesPage.qml index e1631dc..8215431 100644 --- a/touch/EpisodesPage.qml +++ b/touch/EpisodesPage.qml @@ -63,7 +63,7 @@ SlidePage { }); }, }, - ]); + ], undefined, undefined, true); } diff --git a/touch/Main.qml b/touch/Main.qml index b5fc357..675d5ef 100644 --- a/touch/Main.qml +++ b/touch/Main.qml @@ -129,7 +129,7 @@ Item { }); } - function showSelection(items, title, selectedIndex) { + function showSelection(items, title, selectedIndex, activatedFromMenu) { loadPage('SelectionDialog.qml', { title: title, callback: function (index, item) { @@ -143,6 +143,7 @@ Item { return result; }(), selectedIndex: selectedIndex, + activatedFromMenu: activatedFromMenu ? activatedFromMenu : false }); } @@ -256,6 +257,7 @@ Item { text: pgst.menuButtonLabel icon: pgst.menuButtonIcon + visible: enabled || !platform.hideDisabledMenu enabled: pgst.hasMenuButton onClicked: pgst.children[pgst.children.length-1].menuButtonClicked() diff --git a/touch/PodcastDetail.qml b/touch/PodcastDetail.qml index a1273a2..3f3a594 100644 --- a/touch/PodcastDetail.qml +++ b/touch/PodcastDetail.qml @@ -69,7 +69,7 @@ SlidePage { }); } }, - ]); + ], undefined, undefined, true); } PBusyIndicator { diff --git a/touch/PodcastsPage.qml b/touch/PodcastsPage.qml index cc48c19..309b8ca 100644 --- a/touch/PodcastsPage.qml +++ b/touch/PodcastsPage.qml @@ -88,7 +88,7 @@ SlidePage { }); }, }, - ]); + ], undefined, undefined, true); } PListView {