Dialog and menu positioning

This commit is contained in:
Thomas Perl 2014-11-22 18:24:44 +01:00
parent b0c7071c56
commit 2ff14cfaa9
6 changed files with 19 additions and 6 deletions

View file

@ -30,4 +30,5 @@ Item {
property bool invertedToolbar: toolbarOnTop property bool invertedToolbar: toolbarOnTop
property bool titleInToolbar: toolbarOnTop property bool titleInToolbar: toolbarOnTop
property bool floatingPlayButton: android property bool floatingPlayButton: android
property bool hideDisabledMenu: android
} }

View file

@ -25,6 +25,8 @@ import 'common/constants.js' as Constants
Rectangle { Rectangle {
id: page id: page
z: 200 z: 200
property bool activatedFromMenu: false
property bool attachToToolbar: platform.toolbarOnTop && activatedFromMenu
color: Constants.colors.dialogBackground color: Constants.colors.dialogBackground
@ -68,8 +70,16 @@ Rectangle {
property int maxHeight: parent.height - toolbar.height property int maxHeight: parent.height - toolbar.height
height: ((page.contentHeight > 0 && page.contentHeight < maxHeight) ? page.contentHeight : maxHeight) * parent.opacity height: ((page.contentHeight > 0 && page.contentHeight < maxHeight) ? page.contentHeight : maxHeight) * parent.opacity
anchors { anchors {
horizontalCenter: parent.horizontalCenter horizontalCenter: activatedFromMenu ? undefined : parent.horizontalCenter
top: parent.top 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 color: Constants.colors.dialog
clip: true clip: true

View file

@ -63,7 +63,7 @@ SlidePage {
}); });
}, },
}, },
]); ], undefined, undefined, true);
} }

View file

@ -129,7 +129,7 @@ Item {
}); });
} }
function showSelection(items, title, selectedIndex) { function showSelection(items, title, selectedIndex, activatedFromMenu) {
loadPage('SelectionDialog.qml', { loadPage('SelectionDialog.qml', {
title: title, title: title,
callback: function (index, item) { callback: function (index, item) {
@ -143,6 +143,7 @@ Item {
return result; return result;
}(), }(),
selectedIndex: selectedIndex, selectedIndex: selectedIndex,
activatedFromMenu: activatedFromMenu ? activatedFromMenu : false
}); });
} }
@ -256,6 +257,7 @@ Item {
text: pgst.menuButtonLabel text: pgst.menuButtonLabel
icon: pgst.menuButtonIcon icon: pgst.menuButtonIcon
visible: enabled || !platform.hideDisabledMenu
enabled: pgst.hasMenuButton enabled: pgst.hasMenuButton
onClicked: pgst.children[pgst.children.length-1].menuButtonClicked() onClicked: pgst.children[pgst.children.length-1].menuButtonClicked()

View file

@ -69,7 +69,7 @@ SlidePage {
}); });
} }
}, },
]); ], undefined, undefined, true);
} }
PBusyIndicator { PBusyIndicator {

View file

@ -88,7 +88,7 @@ SlidePage {
}); });
}, },
}, },
]); ], undefined, undefined, true);
} }
PListView { PListView {