Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2015
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.46 KB | None | 0 0
  1. /***************************************************************************
  2. * Copyright (c) 2013 Abdurrahman AVCI <[email protected]
  3. *
  4. * Permission is hereby granted, free of charge, to any person
  5. * obtaining a copy of this software and associated documentation
  6. * files (the "Software"), to deal in the Software without restriction,
  7. * including without limitation the rights to use, copy, modify, merge,
  8. * publish, distribute, sublicense, and/or sell copies of the Software,
  9. * and to permit persons to whom the Software is furnished to do so,
  10. * subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included
  13. * in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  16. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  19. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  20. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  21. * OR OTHER DEALINGS IN THE SOFTWARE.
  22. *
  23. ***************************************************************************/
  24. import QtMultimedia 5.0
  25. import QtQuick 2.0
  26. import SddmComponents 2.0
  27.  
  28. Rectangle {
  29. id: container
  30. width: 1024
  31. height: 768
  32.  
  33. property int sessionIndex: session.index
  34.  
  35. TextConstants { id: textConstants }
  36.  
  37. Connections {
  38. target: sddm
  39. onLoginSucceeded: {
  40. }
  41.  
  42. onLoginFailed: {
  43. txtMessage.text = textConstants.loginFailed
  44. listView.currentItem.password.text = ""
  45. }
  46. }
  47.  
  48. Repeater {
  49. model: screenModel
  50. Background {
  51. VideoOutput {
  52. anchors.fill: parent
  53. source: /home/phil/background/party.mp4
  54.  
  55. MediaPlayer {
  56. id: video_path
  57. autoLoad: true
  58. autoPlay true
  59. loops: -1
  60. }
  61. }
  62. }
  63. }
  64. }
  65. }
  66.  
  67. Rectangle {
  68. property variant geometry: screenModel.geometry(screenModel.primary)
  69. x: geometry.x; y: geometry.y; width: geometry.width; height: geometry.height
  70. color: "transparent"
  71.  
  72. Component {
  73. id: userDelegate
  74.  
  75. PictureBox {
  76. anchors.verticalCenter: parent.verticalCenter
  77. name: (model.realName === "") ? model.name : model.realName
  78. icon: model.icon
  79.  
  80. focus: (listView.currentIndex === index) ? true : false
  81. state: (listView.currentIndex === index) ? "active" : ""
  82.  
  83. onLogin: sddm.login(model.name, password, sessionIndex);
  84.  
  85. MouseArea {
  86. anchors.fill: parent
  87. hoverEnabled: true
  88. onEntered: listView.currentIndex = index
  89. onClicked: listView.focus = true
  90. }
  91. }
  92. }
  93.  
  94. Row {
  95. anchors.fill: parent
  96.  
  97. Rectangle {
  98. width: parent.width / 2; height: parent.height
  99. color: "#00000000"
  100.  
  101. Clock {
  102. id: clock
  103. anchors.centerIn: parent
  104. color: "white"
  105. timeFont.family: "Oxygen"
  106. }
  107. }
  108.  
  109. Rectangle {
  110. width: parent.width / 2; height: parent.height
  111. color: "#22000000"
  112. clip: true
  113.  
  114. Item {
  115. id: usersContainer
  116. width: parent.width; height: 300
  117. anchors.verticalCenter: parent.verticalCenter
  118.  
  119. ImageButton {
  120. id: prevUser
  121. anchors.left: parent.left
  122. anchors.verticalCenter: parent.verticalCenter
  123. anchors.margins: 10
  124. source: "angle-left.png"
  125. onClicked: listView.decrementCurrentIndex()
  126.  
  127. KeyNavigation.backtab: btnShutdown; KeyNavigation.tab: listView
  128. }
  129.  
  130. ListView {
  131. id: listView
  132. height: parent.height
  133. anchors.left: prevUser.right; anchors.right: nextUser.left
  134. anchors.verticalCenter: parent.verticalCenter
  135. anchors.margins: 10
  136.  
  137. clip: true
  138. focus: true
  139.  
  140. spacing: 5
  141.  
  142. model: userModel
  143. delegate: userDelegate
  144. orientation: ListView.Horizontal
  145. currentIndex: userModel.lastIndex
  146.  
  147. KeyNavigation.backtab: prevUser; KeyNavigation.tab: nextUser
  148. }
  149.  
  150. ImageButton {
  151. id: nextUser
  152. anchors.right: parent.right
  153. anchors.verticalCenter: parent.verticalCenter
  154. anchors.margins: 10
  155. source: "angle-right.png"
  156. onClicked: listView.incrementCurrentIndex()
  157. KeyNavigation.backtab: listView; KeyNavigation.tab: session
  158. }
  159. }
  160.  
  161. Text {
  162. id: txtMessage
  163. anchors.top: usersContainer.bottom;
  164. anchors.margins: 20
  165. anchors.horizontalCenter: parent.horizontalCenter
  166. color: "white"
  167. text: textConstants.promptSelectUser
  168.  
  169. font.pixelSize: 20
  170. }
  171. }
  172. }
  173.  
  174. Rectangle {
  175. id: actionBar
  176. anchors.top: parent.top;
  177. anchors.horizontalCenter: parent.horizontalCenter
  178. width: parent.width; height: 40
  179.  
  180. Row {
  181. anchors.left: parent.left
  182. anchors.margins: 5
  183. height: parent.height
  184. spacing: 5
  185.  
  186. Text {
  187. height: parent.height
  188. anchors.verticalCenter: parent.verticalCenter
  189.  
  190. text: textConstants.session
  191. font.pixelSize: 16
  192. verticalAlignment: Text.AlignVCenter
  193. }
  194.  
  195. ComboBox {
  196. id: session
  197. width: 245
  198. anchors.verticalCenter: parent.verticalCenter
  199.  
  200. arrowIcon: "angle-down.png"
  201.  
  202. model: sessionModel
  203. index: sessionModel.lastIndex
  204.  
  205. font.pixelSize: 14
  206.  
  207. KeyNavigation.backtab: nextUser; KeyNavigation.tab: layoutBox
  208. }
  209.  
  210. Text {
  211. height: parent.height
  212. anchors.verticalCenter: parent.verticalCenter
  213.  
  214. text: textConstants.layout
  215. font.pixelSize: 16
  216. verticalAlignment: Text.AlignVCenter
  217. }
  218.  
  219. LayoutBox {
  220. id: layoutBox
  221. width: 90
  222. anchors.verticalCenter: parent.verticalCenter
  223. font.pixelSize: 14
  224.  
  225. arrowIcon: "angle-down.png"
  226.  
  227. KeyNavigation.backtab: session; KeyNavigation.tab: btnShutdown
  228. }
  229. }
  230.  
  231. Row {
  232. height: parent.height
  233. anchors.right: parent.right
  234. anchors.margins: 5
  235. spacing: 5
  236.  
  237. ImageButton {
  238. id: btnReboot
  239. height: parent.height
  240. source: "reboot.png"
  241.  
  242. visible: sddm.canReboot
  243.  
  244. onClicked: sddm.reboot()
  245.  
  246. KeyNavigation.backtab: layoutBox; KeyNavigation.tab: btnShutdown
  247. }
  248.  
  249. ImageButton {
  250. id: btnShutdown
  251. height: parent.height
  252. source: "shutdown.png"
  253.  
  254. visible: sddm.canPowerOff
  255.  
  256. onClicked: sddm.powerOff()
  257.  
  258. KeyNavigation.backtab: btnReboot; KeyNavigation.tab: prevUser
  259. }
  260. }
  261. }
  262. }
  263. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement