Sometimes its the little things..
[qzeecontrol] / qml / QZeeControl / main.qml
1 /*
2  *  Copyright 2012 Ruediger Gad
3  *
4  *  This file is part of QZeeControl.
5  *
6  *  QZeeControl is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  QZeeControl is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with QZeeControl.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 import QtQuick 1.1
21 import com.nokia.meego 1.0
22
23 PageStackWindow {
24     id: appWindow
25
26     initialPage: mainPage
27
28     Page{
29         id: mainPage
30
31         tools: commonTools
32         orientationLock: PageOrientation.LockPortrait
33
34         TabGroup {
35             id: tabGroup
36
37             currentTab: zeeTab1
38
39             ZeeConnectPage{
40                 id: zeeTab1
41                 name: "Zee_1"
42             }
43
44             ZeeConnectPage{
45                 id: zeeTab2
46                 name: "Zee_2"
47                 usedAddresses: zeeTab1.currentAddress
48             }
49
50             onCurrentTabChanged: keyBindingsSettings.currentRemote = currentTab.name
51         }
52     }
53
54     ToolBarLayout {
55         id: commonTools
56         visible: true
57
58         ButtonRow{
59             id: tabButtonRow
60             style: TabButtonStyle {}
61
62             TabButton{
63                 text: zeeTab1.connected ? "*Zee 1*" : "Zee 1"
64                 tab: zeeTab1
65
66             }
67
68             TabButton{
69                 text: zeeTab2.connected ? "*Zee 2*" : "Zee 2"
70                 tab: zeeTab2
71                 enabled: zeeTab1.currentAddress !== "No Zeemote found yet."
72             }
73         }
74
75         ToolIcon {
76             platformIconId: "toolbar-view-menu"
77             anchors.right: (parent === undefined) ? undefined : parent.right
78             onClicked: (myMenu.status === DialogStatus.Closed) ? myMenu.open() : myMenu.close()
79         }
80     }
81
82     Menu {
83         id: myMenu
84         visualParent: pageStack
85
86         MenuLayout {
87             MenuItem {
88                 text: "Edit Key Bindings"
89                 onClicked: keyBindingsSettings.open()
90             }
91
92             MenuItem {
93                 text: "About"
94                 onClicked: aboutDialog.open()
95             }
96         }
97     }
98
99     AboutDialog{
100         id: aboutDialog
101     }
102
103     KeyBindingSettings{
104         id: keyBindingsSettings
105         onAccepted: tabGroup.currentTab.loadKeyBindings()
106     }
107 }