From af578de55451b1764d801a2f34a7d787a5834112 Mon Sep 17 00:00:00 2001
From: Joakim Bygdell <j.bygdell@gmail.com>
Date: Sun, 26 Jul 2015 12:48:33 +0200
Subject: [PATCH 1/4] QML UI: create menu to house the buttons

Runing the android version on a phone the screen must be tilted
sideways to accommodate all buttons.
This creates a single button that triggers a popup menu that houses the buttons.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
---
 qt-mobile/main.qml | 64 +++++++++++++++++++++++++++++++-----------------------
 1 file changed, 37 insertions(+), 27 deletions(-)

diff --git a/qt-mobile/main.qml b/qt-mobile/main.qml
index 9553197..812a274 100644
--- a/qt-mobile/main.qml
+++ b/qt-mobile/main.qml
@@ -11,6 +11,38 @@ ApplicationWindow {
 	property alias messageText: message.text
 	visible: true
 
+	Menu {
+		id: prefsMenu
+		title: "Menu"
+
+		MenuItem {
+			text: "Preferences"
+			onTriggered: {
+				stackView.push(prefsWindow)
+			}
+		}
+
+		MenuItem {
+			text: "Load Dives"
+			onTriggered: {
+				manager.loadDives();
+			}
+		}
+
+		MenuItem {
+			text: "Download Dives"
+			onTriggered: {
+				stackView.push(downloadDivesWindow)
+			}
+		}
+		MenuItem {
+			text: "Save Changes"
+			onTriggered: {
+				manager.saveChanges();
+			}
+		}
+	}
+
 	StackView {
 		id: stackView
 		anchors.fill: parent
@@ -39,39 +71,17 @@ ApplicationWindow {
 						anchors.bottomMargin: prefsButton.height * 0.1
 						anchors.left: topPart.left
 						anchors.leftMargin: prefsButton.height * 0.1
+						anchors.right: topPart.right
+						anchors.rightMargin: prefsButton.height * 0.1
 						Button {
 							id: prefsButton
-							text: "Preferences"
-							onClicked: {
-								stackView.push(prefsWindow)
-							}
-						}
-
-						Button {
-							id: loadDivesButton
-							text: "Load Dives"
+							text: "\u22ee"
+							anchors.right: parent.right
 							onClicked: {
-								manager.loadDives();
+								prefsMenu.popup()
 							}
 						}
 
-						Button {
-							id: downloadDivesButton
-							text: "Download Dives"
-							onClicked: {
-								downloadDivesWindow.height = parent.height
-								downloadDivesWindow.width = parent.width
-								stackView.push(downloadDivesWindow)
-							}
-						}
-
-						Button {
-							id: saveChanges
-							text: "Save Changes"
-							onClicked: {
-								manager.saveChanges();
-							}
-						}
 					}
 
 				}
-- 
2.3.2 (Apple Git-55)

