00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 import QtQuick 1.0
00043 import com.nokia.symbian 1.0
00044
00045 ApplicationWindow {
00046 id: window
00047
00048 function setStateIfFound(target, name) {
00049 for (var i = 0; i < target.states.length; i++) {
00050 var curState = target.states[i];
00051 if(curState.name == name) {
00052 target.state = name
00053 break
00054 }
00055 }
00056 }
00057
00058 ToolBarLayout {
00059 id: commonTools
00060 ToolButton {
00061 flat: true
00062 iconSource: "qrc:/qtg_toolbar_back.svg"
00063 onClicked: pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
00064 }
00065 ToolButton {
00066 flat: true
00067 iconSource: "qrc:/qtg_toolbar_options.svg"
00068 onClicked: viewMenu.open();
00069 }
00070 }
00071
00072 Page {
00073 id: page
00074 anchors.fill: parent
00075 tools: commonTools
00076
00077 Component.onCompleted: {
00078 if(screen.currentOrientation == Screen.Portrait) {
00079 setStateIfFound(page, "PortraitState")
00080 } else if(screen.currentOrientation == Screen.Landscape) {
00081 setStateIfFound(page, "LandscapeState")
00082 }
00083 }
00084
00085 PageHeading{
00086 id: heading
00087 anchors.top: parent.top
00088 width: parent.width
00089 text: qsTr("Descriptors")
00090 fontItalic:true
00091 }
00092
00093
00094 Rectangle{
00095 id: editorLayout
00096 anchors.top: parent.top
00097 anchors.topMargin: 70
00098 anchors.left: parent.left
00099 anchors.leftMargin: 10
00100 anchors.right: parent.right
00101 anchors.rightMargin: 10
00102 anchors.bottom: parent.bottom
00103 anchors.bottomMargin: 60
00104 border.color: "grey"
00105 border.width: 4
00106 Flickable {
00107 id: flick
00108 width: editorLayout.width; height: editorLayout.height;
00109 contentWidth: textEdit.paintedWidth
00110 contentHeight: textEdit.paintedHeight
00111 clip: true
00112
00113 function ensureVisible(r)
00114 {
00115 if (contentX >= r.x)
00116 contentX = r.x;
00117 else if (contentX+width <= r.x+r.width)
00118 contentX = r.x+r.width-width;
00119 if (contentY >= r.y)
00120 contentY = r.y;
00121 else if (contentY+height <= r.y+r.height)
00122 contentY = r.y+r.height-height;
00123 }
00124
00125 TextEdit {
00126 id: textEdit
00127 width: flick.width
00128 height: flick.height
00129 anchors.top: parent.top
00130 anchors.topMargin: 10
00131 anchors.left: parent.left
00132 anchors.leftMargin: 10
00133 font.family: "Helvetica"
00134 font.pointSize: 7
00135 color: "darkblue"
00136 text: "Welcome To Descriptors Example"
00137 smooth: true
00138 activeFocusOnPress: false
00139 wrapMode: TextEdit.Wrap
00140 onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
00141 }
00142 }
00143 }
00144
00145 Menu{
00146 id: viewMenu
00147
00148 content:
00149 Column{
00150 MenuItem {
00151 text: "Declarations"
00152
00153 onClicked:
00154 {
00155
00156 viewMenuDeclaration.open()
00157 viewMenu.close()
00158 }
00159 }
00160 MenuItem { text: "Manipulations"
00161 onClicked:
00162 {
00163 viewMenuManipulations.open()
00164 viewMenu.close()
00165 }
00166 }
00167 MenuItem { text: "Other Buffers"
00168 onClicked:
00169 {
00170 viewMenuOtherBuffer.open()
00171 viewMenu.close()
00172 }
00173 }
00174
00175
00176 }
00177
00178 }
00179
00180
00181
00182 Menu{
00183 id: viewMenuDeclaration
00184
00185 content:
00186 Column{
00187 MenuItem {
00188 text: "OnStack"
00189
00190 onClicked:
00191 {
00192 descriptors.createOnStack()
00193 viewMenuDeclaration.close()
00194 viewMenu.close()
00195 }
00196 }
00197 MenuItem { text: "OnHeap"
00198 onClicked:
00199 {
00200 descriptors.createOnHeap()
00201 viewMenuDeclaration.close()
00202 viewMenu.close()
00203 }
00204 }
00205 MenuItem { text: "Literals"
00206 onClicked:
00207 {
00208 descriptors.createLiterals()
00209 viewMenuDeclaration.close()
00210 viewMenu.close()
00211 }
00212 }
00213 }
00214
00215 }
00216
00217
00218
00219 Menu{
00220 id: viewMenuManipulations
00221
00222 content:
00223 Column{
00224 MenuItem {
00225 text: "NonModifying Methods"
00226
00227 onClicked:
00228 {
00229 descriptors.callNonModifyingMethods()
00230 viewMenuManipulations.close()
00231 viewMenu.close()
00232 }
00233 }
00234 MenuItem { text: "Modifying Methods"
00235 onClicked:
00236 {
00237 descriptors.callModifyingMethods()
00238 viewMenuManipulations.close()
00239 viewMenu.close()
00240 }
00241 }
00242 MenuItem { text: "Character Conversions"
00243 onClicked:
00244 {
00245 descriptors.callCharacterConversions()
00246 viewMenuManipulations.close()
00247 viewMenu.close()
00248 }
00249 }
00250
00251 MenuItem { text: "Lexical Analysis"
00252 onClicked:
00253 {
00254 descriptors.doLexicalAnalysis()
00255 viewMenuManipulations.close()
00256 viewMenu.close()
00257 }
00258 }
00259
00260
00261 }
00262
00263 }
00264
00265
00266
00267 Menu{
00268 id: viewMenuOtherBuffer
00269
00270 content:
00271 Column{
00272 MenuItem {
00273 text: "Circular Buffers"
00274
00275 onClicked:
00276 {
00277 descriptors.useCircularBuffers()
00278 viewMenuOtherBuffer.close()
00279 viewMenu.close()
00280 }
00281 }
00282 MenuItem { text: "Flat Dynamic Buffers"
00283 onClicked:
00284 {
00285 descriptors.useFlatDynamicBuffers()
00286 viewMenuOtherBuffer.close()
00287 viewMenu.close()
00288 }
00289 }
00290 MenuItem { text: "Segmntd Dynamic Buffers"
00291 onClicked:
00292 {
00293 descriptors.useSegmentedDynamicBuffers()
00294 viewMenuOtherBuffer.close()
00295 viewMenu.close()
00296 }
00297 }
00298
00299 MenuItem { text: "Package Buffers"
00300 onClicked:
00301 {
00302 descriptors.usePackageBuffers()
00303 viewMenuOtherBuffer.close()
00304 viewMenu.close()
00305 }
00306 }
00307
00308
00309 }
00310
00311 }
00312
00313
00314
00315 Connections {
00316 target: descriptors
00317 onPrintMessage: textEdit.text = descriptors.showResponse();
00318 }
00319 }
00320 Component.onCompleted: pageStack.push(page)
00321 }