MainPage.qml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. /**
  2. * Copyright (c) 2012 Nokia Corporation.
  3. */
  4. import QtQuick 1.1
  5. import com.nokia.symbian 1.1
  6. import "Constants.js" as Constants
  7. Page {
  8. id: mainPage
  9. ListModel {
  10. id: componentsModel
  11. ListElement {
  12. title: "Buttons"
  13. picture: "Images/Icons/menu_buttons.svg"
  14. page: "Buttons/MainPage.qml"
  15. }
  16. ListElement {
  17. title: "Dialogs"
  18. picture: "Images/Icons/menu_dialogs.svg"
  19. page: "Dialogs/MainPage.qml"
  20. }
  21. ListElement {
  22. title: "Info banners"
  23. picture: "Images/Icons/menu_infobanners.svg"
  24. page: "InfoBanner/MainPage.qml"
  25. }
  26. ListElement {
  27. title: "List items"
  28. picture: "Images/Icons/menu_listitems.svg"
  29. page: "ListItems/ListPage.qml"
  30. }
  31. ListElement {
  32. title: "Menus"
  33. picture: "Images/Icons/menu_menus.svg"
  34. page: "Menus/MainPage.qml"
  35. }
  36. ListElement {
  37. title: "Progress"
  38. picture: "Images/Icons/menu_progress.svg"
  39. page: "ProgressIndicators/MainPage.qml"
  40. }
  41. ListElement {
  42. title: "Sliders"
  43. picture: "Images/Icons/menu_sliders.svg"
  44. page: "Sliders/MainPage.qml"
  45. }
  46. ListElement {
  47. title: "Tab bars"
  48. picture: "Images/Icons/menu_tabs.svg"
  49. page: "TabBars/MainPage.qml"
  50. }
  51. ListElement {
  52. title: "Time stamps"
  53. picture: "Images/Icons/menu_time.svg"
  54. page: "Time/MainPage.qml"
  55. }
  56. ListElement {
  57. title: "Toolbars"
  58. picture: "Images/Icons/menu_toolbars.svg"
  59. page: "Tollbars/ToolbarPage.qml"
  60. }
  61. ListElement {
  62. title: "Tumblers"
  63. picture: "Images/Icons/menu_tumblers.svg"
  64. page: "Tumblers/MainPage.qml"
  65. }
  66. }
  67. ListModel {
  68. id: patternsModel
  69. ListElement {
  70. title: "Arrange items"
  71. picture: "Images/Icons/menu_arrange.svg"
  72. page: "ArrangeItems/MainPage.qml"
  73. }
  74. ListElement {
  75. title: "Delete multiple"
  76. picture: "Images/Icons/menu_delete.svg"
  77. page: "DeleteMultiple/MainPage.qml"
  78. }
  79. ListElement {
  80. title: "Drill down"
  81. picture: "Images/Icons/menu_drill.svg"
  82. page: "DrillDown/MainPage.qml"
  83. }
  84. ListElement {
  85. title: "Empty content"
  86. picture: "Images/Icons/menu_empty.svg"
  87. page: "EmptyContent/MainPage.qml"
  88. }
  89. ListElement {
  90. title: "Header + button"
  91. picture: "Images/Icons/menu_headerbutton.svg"
  92. page: "HeaderButton/MainPage.qml"
  93. }
  94. ListElement {
  95. title: "Scrolling"
  96. picture: "Images/Icons/menu_scrolling.svg"
  97. page: "FastScrolling/MainPage.qml"
  98. }
  99. ListElement {
  100. title: "Search"
  101. picture: "Images/Icons/menu_search.svg"
  102. page: "Search/MainPage.qml"
  103. }
  104. ListElement {
  105. title: "Tabs"
  106. picture: "Images/Icons/menu_tabs.svg"
  107. page: "Tabs/MainPage.qml"
  108. }
  109. ListElement {
  110. title: "Tabs - sticky"
  111. picture: "Images/Icons/menu_stickeytabs.svg"
  112. page: "StickyTabs/MainPage.qml"
  113. }
  114. ListElement {
  115. title: "Tabs - toolbar"
  116. picture: "Images/Icons/menu_toolbartabs.svg"
  117. page: "ToolBarTabs/MainPage.qml"
  118. }
  119. ListElement {
  120. title: "Text - direct"
  121. picture: "Images/Icons/menu_text.svg"
  122. page: "DirectText/MainPage.qml"
  123. }
  124. ListElement {
  125. title: "Text - safe"
  126. picture: "Images/Icons/menu_text_safe.svg"
  127. page: "SafeText/MainPage.qml"
  128. }
  129. ListElement {
  130. title: "Wizard"
  131. picture: "Images/Icons/menu_wizard.svg"
  132. page: "Wizard/WizardMainPage.qml"
  133. }
  134. ListElement {
  135. title: "Zooming"
  136. picture: "Images/Icons/menu_image.svg"
  137. page: "ImageControl/MainPage.qml"
  138. }
  139. }
  140. Component {
  141. id: mainGridDelegate
  142. Rectangle {
  143. color: mousearea.pressed ? platformStyle.colorDisabledLight
  144. : (window.platformInverted ? platformStyle.colorBackgroundInverted: platformStyle.colorBackground)
  145. width: mainGrid.cellWidth
  146. height: mainGrid.cellHeight
  147. Column {
  148. id: column
  149. anchors.centerIn: parent
  150. spacing: 10
  151. Image { source: picture; anchors.horizontalCenter: parent.horizontalCenter }
  152. Label {
  153. text: title;
  154. platformInverted: window.platformInverted;
  155. font.pixelSize: 15
  156. font.bold: true
  157. anchors.horizontalCenter: parent.horizontalCenter
  158. }
  159. }
  160. MouseArea {
  161. id: mousearea
  162. anchors.fill: parent
  163. onClicked: {
  164. mainPage.pageStack.push(Qt.resolvedUrl(page))
  165. }
  166. }
  167. }
  168. }
  169. Flickable{
  170. id: flickable
  171. contentHeight: col.implicitHeight + platformStyle.paddingLarge
  172. width: parent.width
  173. height: parent.height
  174. Column{
  175. id: col
  176. width: parent.width
  177. spacing: platformStyle.paddingLarge
  178. ListHeading {
  179. platformInverted: window.platformInverted
  180. ListItemText {
  181. anchors.verticalCenter: parent.verticalCenter
  182. anchors.right: parent.right
  183. anchors.rightMargin: platformStyle.paddingLarge
  184. platformInverted: window.platformInverted
  185. role: "Heading"
  186. text: "Components"
  187. }
  188. }
  189. GridView {
  190. id: mainGrid
  191. property int colsNumber: mainPage.height > mainPage.width ?
  192. Constants.GRID_COLS_PER_SCREEN_VERTICAL :
  193. Constants.GRID_COLS_PER_SCREEN_HORIZONTAL
  194. property int rowsNumber: mainPage.height > mainPage.width ?
  195. Constants.GRID_ROWS_PER_SCREEN_VERTICAL :
  196. Constants.GRID_ROWS_PER_SCREEN_HORIZONTAL
  197. width: parent.width
  198. height: cellHeight * Math.ceil(count / colsNumber)
  199. model: componentsModel
  200. interactive: false
  201. cellWidth: mainPage.width / colsNumber
  202. cellHeight: mainPage.height / rowsNumber
  203. delegate: mainGridDelegate
  204. }
  205. ListHeading {
  206. platformInverted: window.platformInverted
  207. ListItemText {
  208. anchors.verticalCenter: parent.verticalCenter
  209. anchors.right: parent.right
  210. anchors.rightMargin: platformStyle.paddingLarge
  211. platformInverted: window.platformInverted
  212. role: "Heading"
  213. text: "Patterns"
  214. }
  215. }
  216. GridView {
  217. property int colsNumber: mainPage.height > mainPage.width ?
  218. Constants.GRID_COLS_PER_SCREEN_VERTICAL :
  219. Constants.GRID_COLS_PER_SCREEN_HORIZONTAL
  220. property int rowsNumber: mainPage.height > mainPage.width ?
  221. Constants.GRID_ROWS_PER_SCREEN_VERTICAL :
  222. Constants.GRID_ROWS_PER_SCREEN_HORIZONTAL
  223. width: parent.width
  224. height: cellHeight * Math.ceil(count / colsNumber)
  225. model: patternsModel
  226. interactive: false
  227. cellWidth: mainPage.width / colsNumber
  228. cellHeight: mainPage.height / rowsNumber
  229. delegate: mainGridDelegate
  230. }
  231. }
  232. }
  233. }