main.qml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*****************************************************************************
  2. * main.qml - DictionaryStar, stardict dictionary for MeeGo Harmattan *
  3. * Copyright (C) 2012 Jari P.T. Alhonen *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 3 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License along *
  16. * with this program; if not, see <http://www.gnu.org/licenses/>. *
  17. *****************************************************************************/
  18. import QtQuick 1.1
  19. import com.nokia.meego 1.0
  20. PageStackWindow {
  21. id: rootWindow
  22. initialPage: DictionaryStar { }
  23. Rectangle {
  24. id: commonTools
  25. visible: false
  26. width: parent.width
  27. height: 64
  28. anchors.bottom: parent.bottom
  29. parent: pageStack.currentPage
  30. z: 1
  31. ToolIcon {
  32. id: return_img
  33. iconId: "toolbar-back"
  34. anchors.left: parent.left
  35. anchors.verticalCenter: parent.verticalCenter
  36. MouseArea {
  37. anchors.fill: parent
  38. onClicked: pageStack.pop()
  39. onPressed: return_img.iconId = "toolbar-back-selected"
  40. onReleased: return_img.iconId = "toolbar-back"
  41. }
  42. }
  43. ButtonRow {
  44. id: moveButtons
  45. visible: false
  46. anchors.left: return_img.right
  47. anchors.right: menuIcon.left
  48. //anchors.horizontalCenter: parent.horizontalCenter
  49. anchors.verticalCenter: parent.verticalCenter
  50. platformStyle: ButtonStyle {
  51. checkedBackground: background
  52. checkedDisabledBackground: disabledBackground
  53. }
  54. Button {
  55. id: back_img
  56. enabled: false
  57. iconSource: "image://theme/icon-m-toolbar-previous"
  58. onClicked: {
  59. pageStack.currentPage.movePage(true)
  60. forward_img.enabled = true
  61. }
  62. }
  63. Button {
  64. id: forward_img
  65. enabled: false
  66. iconSource: "image://theme/icon-m-toolbar-next"
  67. onClicked: {
  68. pageStack.currentPage.movePage(false)
  69. back_img.enabled = true
  70. }
  71. }
  72. }
  73. ToolIcon {
  74. id: menuIcon
  75. platformIconId: "toolbar-view-menu"
  76. anchors.right: (parent === undefined) ? undefined : parent.right
  77. onClicked: (myMenu.status == DialogStatus.Closed) ? myMenu.open() : myMenu.close()
  78. }
  79. } // rectangle commonTools
  80. Menu {
  81. id: myMenu
  82. visualParent: pageStack.currentPage
  83. platformStyle: MenuStyle {
  84. //background: "" // PR1.0 doesn't support setting the background!
  85. bottomPadding: commonTools.height
  86. }
  87. function openPage(url) {
  88. if(pageStack.depth > 2) {
  89. pageStack.replace(Qt.resolvedUrl("DictWebView.qml"), {
  90. loadUrl: url
  91. });
  92. } else {
  93. pageStack.push(Qt.resolvedUrl("DictWebView.qml"), {
  94. loadUrl: url
  95. });
  96. }
  97. }
  98. MenuLayout {
  99. MenuItem {
  100. text: qsTr("Adding Dictionaries")
  101. platformStyle: MenuItemStyle {
  102. fontPixelSize: 32
  103. fontWeight: Font.Bold
  104. }
  105. onClicked: {
  106. if(pageStack.depth > 2) {
  107. pageStack.pop()
  108. pageStack.currentPage.moveToFooter()
  109. } else {
  110. pageStack.currentPage.moveToFooter()
  111. }
  112. }
  113. }
  114. MenuItem {
  115. text: "-> abloz.com"
  116. platformStyle: MenuItemStyle {
  117. fontWeight: Font.Normal
  118. leftMargin: 150
  119. }
  120. onClicked: myMenu.openPage("http://abloz.com/huzheng/stardict-dic/")
  121. }
  122. MenuItem {
  123. text: "-> sourceforge.net"
  124. platformStyle: MenuItemStyle {
  125. fontWeight: Font.Normal
  126. leftMargin: 150
  127. }
  128. onClicked: myMenu.openPage("http://sourceforge.net/projects/xdxf/files/dicts-stardict-form-xdxf/")
  129. }
  130. }
  131. } // menu
  132. }