Refactor code. Add tabs for enabling using two remote controls at once.
[qzeecontrol] / qml / QZeeControl / main.qml
index bfb4552..783ee85 100644 (file)
@@ -1,3 +1,22 @@
+/*
+ *  Copyright 2012 Ruediger Gad
+ *
+ *  This file is part of QZeeControl.
+ *
+ *  QZeeControl is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  QZeeControl 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with QZeeControl.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 import QtQuick 1.1
 import com.nokia.meego 1.0
 
@@ -6,13 +25,51 @@ PageStackWindow {
 
     initialPage: mainPage
 
-    MainPage {
+    Page{
         id: mainPage
+
+        tools: commonTools
+        orientationLock: PageOrientation.LockPortrait
+
+        TabGroup {
+            id: tabGroup
+
+            currentTab: zeeTab1
+
+            ZeeConnectPage{
+                id: zeeTab1
+                name: "Zee_1"
+            }
+
+            ZeeConnectPage{
+                id: zeeTab2
+                name: "Zee_2"
+                usedAddresses: zeeTab1.currentAddress
+            }
+        }
     }
 
     ToolBarLayout {
         id: commonTools
         visible: true
+
+        ButtonRow{
+            id: tabButtonRow
+            style: TabButtonStyle {}
+
+            TabButton{
+                text: zeeTab1.connected ? "*Zee 1*" : "Zee 1"
+                tab: zeeTab1
+
+            }
+
+            TabButton{
+                text: zeeTab2.connected ? "*Zee 2*" : "Zee 2"
+                tab: zeeTab2
+                enabled: zeeTab1.currentAddress !== "No Zeemote found yet."
+            }
+        }
+
         ToolIcon {
             platformIconId: "toolbar-view-menu"
             anchors.right: (parent === undefined) ? undefined : parent.right
@@ -23,8 +80,26 @@ PageStackWindow {
     Menu {
         id: myMenu
         visualParent: pageStack
+
         MenuLayout {
-            MenuItem { text: qsTr("Sample menu item") }
+            MenuItem {
+                text: "Edit Key Bindings"
+                onClicked: keyBindingsSettings.open()
+            }
+
+            MenuItem {
+                text: "About"
+                onClicked: aboutDialog.open()
+            }
         }
     }
+
+    AboutDialog{
+        id: aboutDialog
+    }
+
+    KeyBindingSettings{
+        id: keyBindingsSettings
+        onAccepted: mainPage.loadKeyBindings()
+    }
 }