Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.15 KB | None | 0 0
  1. root /home/djszapi/Projects/kde/gluon_mobile/player/touch # cat LineEdit.qml
  2. import Qt 4.7
  3.  
  4. /**
  5. * A LineEdit in Mana style
  6. */
  7. FocusScope {
  8. property alias text: textInput.text
  9. property alias labelText: label.text
  10. property alias echoMode: textInput.echoMode
  11. property variant tabTarget: KeyNavigation.down;
  12. property variant backtabTarget: KeyNavigation.up;
  13.  
  14. height: 50;
  15. anchors.margins: 5;
  16.  
  17. Keys.onTabPressed: if (tabTarget) tabTarget.focus = true;
  18. Keys.onBacktabPressed: if (backtabTarget) backtabTarget.focus = true;
  19.  
  20. onActiveFocusChanged: {
  21. if (activeFocus)
  22. textInput.selectAll();
  23. }
  24.  
  25. BorderImage {
  26. anchors.fill: parent
  27.  
  28. source: "icons/lineedit.png"
  29. border.bottom: 20;
  30. border.top: 20;
  31. border.right: 20;
  32. border.left: 20;
  33. }
  34.  
  35. Text {
  36. id: label;
  37. x: textInput.x;
  38. y: textInput.y;
  39. color: "darkGray";
  40. font: textInput.font;
  41.  
  42. states: [
  43. State {
  44. name: "labelHidden";
  45. when: textInput.text != "";
  46. PropertyChanges { target: label; opacity: 0; }
  47. }
  48. ]
  49. transitions: [
  50. Transition {
  51. from: "labelHidden";
  52. NumberAnimation {
  53. property: "opacity";
  54. easing.type: Easing.InOutQuad;
  55. }
  56. }
  57. ]
  58. }
  59.  
  60. TextInput {
  61. id: textInput
  62.  
  63. y: 5
  64. anchors.verticalCenter: parent.verticalCenter;
  65. anchors.verticalCenterOffset: 2;
  66. anchors.right: parent.right
  67. anchors.rightMargin: 12
  68. anchors.left: parent.left
  69. anchors.leftMargin: 12
  70.  
  71. focus: true
  72.  
  73. selectByMouse: true
  74. passwordCharacter: "*"
  75.  
  76. font.pixelSize: 24;
  77. }
  78. }
  79. root /home/djszapi/Projects/kde/gluon_mobile/player/touch # cat Login.qml
  80. import Qt 4.7
  81.  
  82. Rectangle {
  83. x: 0
  84. y: 0
  85.  
  86. signal clicked
  87.  
  88. border.color: "black"
  89. color: "darkGrey"
  90. property alias username: usernameLineEdit.text;
  91. property alias password: passwordLineEdit.text;
  92.  
  93. Text {
  94. id: usernameText
  95. text: "Username"
  96. color: "white"
  97. font.pixelSize: 24
  98. }
  99.  
  100. LineEdit {
  101. id: usernameLineEdit
  102. x: 15
  103. width: usernameText.width * 3
  104. anchors.top: usernameText.bottom
  105. }
  106.  
  107. Text {
  108. id: passwordText
  109. text: "Password"
  110. color: "white"
  111. width: usernameText.width
  112. font.pixelSize: usernameText.font.pixelSize
  113. anchors.top: usernameLineEdit.bottom
  114. }
  115.  
  116. LineEdit {
  117. id: passwordLineEdit
  118. x: 15
  119. width: usernameText.width * 3
  120. anchors.top: passwordText.bottom
  121. echoMode: TextInput.Password
  122. }
  123.  
  124. // MouseArea {
  125. // id: mr
  126. // anchors.fill: parent
  127. // onClicked: {
  128. // parent.focus = true
  129. // lgn.clicked()
  130. // }
  131. // }
  132.  
  133. states: State {
  134. name: "pressed"; when: mr.pressed
  135. // PropertyChanges { target: textelement; x: 5 }
  136. // PropertyChanges { target: pix; x: textelement.x + textelement.width + 3 }
  137. }
  138.  
  139. transitions: Transition {
  140. NumberAnimation {
  141. // properties: "x,left"
  142. easing.type: Easing.InOutQuad
  143. duration: 200
  144. }
  145. }
  146. }
  147. root /home/djszapi/Projects/kde/gluon_mobile/player/touch # cat Startup.qml
  148. import Qt 4.7
  149.  
  150. Rectangle {
  151. id: gluon_player
  152. color: "black"
  153.  
  154. x: 0
  155. y: 0
  156.  
  157. width: 490
  158. height: 720
  159.  
  160. SystemPalette {
  161. id: activePalette
  162. }
  163.  
  164. Image {
  165. id: gluon_logo
  166. // anchors.fill: parent
  167. source: "icons/hi256-app-gluon.png"
  168. width: parent.width/2 * 4/5
  169. height: parent.height * 3/5
  170. fillMode: Image.PreserveAspectFit
  171. anchors.horizontalCenter: parent.horizontalCenter
  172. anchors.horizontalCenterOffset: -parent.width/4
  173. anchors.verticalCenter: parent.verticalCenter
  174. anchors.margins: 10
  175. }
  176.  
  177. Login {
  178. id: lgn
  179. width: parent.width / 2
  180. height: parent.height * 2 / 5
  181. anchors.left: gluon_logo.right
  182. anchors.margins: 10
  183. }
  184.  
  185. Button {
  186. id: new_user
  187. width: parent.width / 4
  188. height: parent.height * 1 / 5
  189. icon: "icons/user-group-new.png"
  190. text: "New User"
  191. onClicked: console.log("this doesn't do anything yet...")
  192. anchors.top: lgn.bottom
  193. anchors.left: gluon_logo.right
  194. anchors.margins: 10
  195. }
  196.  
  197. Button {
  198. id: log_on
  199. width: parent.width / 4
  200. height: parent.height * 1 / 5
  201. icon: "icons/im-user.png"
  202. text: "Log On"
  203. onClicked: {
  204. authentication.login(lgn.username, "test");
  205. }
  206. anchors.top: lgn.bottom
  207. anchors.left: new_user.right
  208. anchors.margins: 10
  209. }
  210.  
  211. Button {
  212. id: forgotten_details
  213. width: parent.width / 2
  214. height: parent.height * 1 / 5
  215. icon: "icons/help-hint.png"
  216. text: "Forgotten Your Details?"
  217. subtext: "Send new password to your email address"
  218. onClicked: console.log("this doesn't do anything yet...")
  219. anchors.top: log_on.bottom
  220. anchors.left: gluon_logo.right
  221. anchors.margins: 10
  222. }
  223.  
  224. Button {
  225. id: play
  226. width: parent.width / 2
  227. height: parent.height * 1 / 5
  228. icon: "icons/media-playback-start.png"
  229. text: "Play Without Logging On"
  230. subtext: "3 games available"
  231. onClicked: console.log("this doesn't do anything yet...")
  232. anchors.top: forgotten_details.bottom
  233. anchors.left: gluon_logo.right
  234. anchors.margins: 10
  235. }
  236. }
  237. root /home/djszapi/Projects/kde/gluon_mobile/player/touch #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement