~brady.brenot/stellarium/android-port

« back to all changes in this revision

Viewing changes to src/mobileGui/qml/PopupMenu.qml

  • Committer: Brady Brenot
  • Date: 2013-01-02 05:18:25 UTC
  • Revision ID: brady@brenot.ca-20130102051825-83wdeltn4eo1s8su
- adding initial Sky/View/Plugins 'button drawers'. They work, but:
-- there's only one function in Sky and View (toggle nebulas), and none in plugins
-- it doesn't match the mockup even a little; these drawers are currently just menus like the main popup menu
- switch Clickable over to taking QAction*s directly
- switch PopupMenu's model over to using QAction*s directly, but with the option to use an action name string (because QML won't let you use scripts in the property value of a model element, so using getGuiAction() in there is disallowed)
- add a C++ model to correspond to the QML model for the PopupMenu
- disable initial fullscreen on Android. This hides the status bar, and the window resizing appears to cause some position issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
Item {
7
7
        id:popupMenu
8
8
 
9
 
        property ListModel model //the menu model to display
 
9
    property variant model //the menu model to display
10
10
 
11
11
        property int lineHeight: dp(48)  //the height of each item
12
12
    property int imageSize: dp(36) //size (rather, either height or width) of images for each item (if they have them)
73
73
 
74
74
                /* Expected model format:
75
75
                ListModel {
76
 
                                 ListElement { action: "some_action";
77
 
                                                           text: "label";
78
 
                                                           onClicked: function; }
 
76
                 ListElement { action: baseGui.getGuiAction("actionSettings_Dialog")
 
77
                               imageSource: "image://mobileGui/settings"
 
78
                               overrideActionText: true //if false or omitted, the action's text property is used instead of the "text" property here
 
79
                               text: "Settings" }
79
80
                                 ...
80
81
                         }*/
81
82
 
82
83
                Component {
83
84
                        id: popupMenuDelegate
84
85
                        Clickable {
85
 
                                action: model.action
 
86
                id: myClickable
 
87
                action: model.action == undefined ? baseGui.getGuiAction(model.actionString) : model.action
86
88
                height: lineHeight
87
89
 
88
90
                                state: "UNCHECKABLE"
165
167
 
166
168
                                        Text {
167
169
                        id: textField
168
 
                        text: model.useActionText ? baseGui.getGuiAction(model.action).text : model.text
 
170
                        text: myClickable.action.text
169
171
                        anchors.verticalCenter: parent.verticalCenter
170
172
                        font.pixelSize: popupMenu.fontSize
171
173
                                                color: "white"
172
 
                                        }
 
174
                    }
173
175
 
174
176
                                        Checkbox
175
177
                    {
177
179
                        anchors.verticalCenter: parent.verticalCenter
178
180
                                        }
179
181
                                }
180
 
                                onClicked: model.onClicked
 
182
                //onClicked: model.onClicked
181
183
                width: widestWidth(rowContent.childrenRect.width + dp(24))
182
184
                        }
183
185
                }