Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.54 KB | None | 0 0
  1. import QtQuick 2.5
  2. import QtQuick.Controls 1.4
  3. import QtQuick.Controls.Styles 1.4
  4. import com.mistermagister.options 1.0
  5.  
  6. ApplicationWindow {
  7. id: applicationWindow
  8. visible: true
  9. width: 640
  10. height: 480
  11. title: qsTr("Fishbook Messenger 0.0.0.1")
  12.  
  13. menuBar: MenuBar {
  14. style: MenuBarStyle {
  15. background: Rectangle {
  16. radius: 0
  17. color: "#00000000"
  18. implicitWidth: 300
  19. implicitHeight: 24
  20. }
  21. }
  22.  
  23. Menu {
  24. title: qsTr("File")
  25. style: MenuStyle {
  26. itemDelegate.label: Label {
  27. color: "white"
  28. text: styleData.text
  29. }
  30.  
  31. frame: Rectangle {
  32. radius: 0
  33. color: "#232629"
  34. implicitWidth: 100
  35. implicitHeight: 24
  36. }
  37. }
  38.  
  39. MenuItem {
  40. text: qsTr("Connect")
  41. }
  42. MenuItem {
  43. text: qsTr("Exit")
  44. onTriggered: Qt.quit();
  45. }
  46. }
  47. }
  48.  
  49. property Options option: null
  50.  
  51. ListView {
  52. id: listView
  53. width: 200
  54. height: 460
  55. anchors.leftMargin: 0
  56. anchors.left: parent.left
  57. clip: true
  58. highlightFollowsCurrentItem: false
  59. model: buddyModel
  60. delegate: Item {
  61. x: 5
  62. height: 24
  63. width: listView.width
  64. Row {
  65. id: row1
  66. anchors.verticalCenter: parent.verticalCenter
  67. Text {
  68. id: text1
  69. text: username
  70. color: '#eff0f1'
  71. }
  72. Text {
  73. id: text2
  74. text: protocol
  75. visible: false
  76. }
  77. }
  78. MouseArea {
  79. anchors.fill: parent
  80. onClicked: {
  81. console.log(username, protocol, Item.enabled, options)
  82. listView.currentIndex = index
  83. option = options
  84. // window.activeId = text2.text
  85. }
  86. }
  87. }
  88. highlight: Rectangle
  89. {
  90. color:"#41474d"
  91. focus: true
  92. y: listView.currentItem.y
  93. height: 24
  94. width: listView.width
  95. }
  96. }
  97.  
  98.  
  99. ListView {
  100. id: listView2
  101. y: 0
  102. width: 400
  103. height: parent.height
  104. anchors.leftMargin: 0
  105. anchors.left: listView.right
  106. clip: true
  107. highlightFollowsCurrentItem: false
  108. model: option
  109. delegate: optionsDelegate/*Item {
  110. x: 5
  111. height: 24
  112. width: listView.width
  113. Row {
  114. id: row2
  115. anchors.verticalCenter: parent.verticalCenter
  116. }
  117. MouseArea {
  118. anchors.fill: parent
  119. onClicked: {
  120. console.log(name)
  121. listView.currentIndex = index
  122. // window.activeId = text2.text
  123. }
  124. }
  125. }*/
  126. highlight: Rectangle
  127. {
  128. color:"#41474d"
  129. focus: true
  130. y: listView.currentItem.y
  131. height: 24
  132. width: listView.width
  133. }
  134. }
  135.  
  136. Component {
  137. id: stringComponent
  138.  
  139. Column {
  140. Text {
  141. id: fieldName
  142. text: name
  143. color: '#eff0f1'
  144. }
  145.  
  146. TextInput {
  147. id: fieldValue
  148. text: value
  149. width: 200;
  150. height: 20;
  151. }
  152. }
  153. }
  154.  
  155. Component {
  156. id: passwordComponent
  157.  
  158. Column {
  159. Text {
  160. id: fieldName
  161. text: name
  162. color: '#eff0f1'
  163. }
  164.  
  165. TextInput {
  166. id: fieldValue
  167. text: value
  168. echoMode: TextInput.Password
  169. width: 200;
  170. height: 20;
  171. }
  172. }
  173. }
  174.  
  175. Component {
  176. id: intComponent
  177.  
  178. Column {
  179. Text {
  180. id: fieldName
  181. text: name
  182. color: '#eff0f1'
  183. }
  184.  
  185. TextInput {
  186. id: fieldValue
  187. text: value
  188. width: 200;
  189. height: 20;
  190. color: "#fff"
  191. validator: RegExpValidator { regExp : /[0-9]{5}/ }
  192.  
  193. }
  194. }
  195. }
  196.  
  197. Component {
  198. id: boolComponent
  199.  
  200. Column {
  201. Text {
  202. id: fieldName
  203. text: name
  204. color: '#eff0f1'
  205. }
  206.  
  207. CheckBox {
  208. id: fieldValue
  209. checked: value
  210. onCheckedChanged: option.value = fieldValue.checked;
  211. }
  212. }
  213. }
  214.  
  215. Component {
  216. id: optionsDelegate
  217.  
  218. Loader {
  219. property var itemIndex: index
  220. property var name: optionName
  221. property var type: optionType
  222. property var value: optionValue
  223. property var defValue: optionDefaultValue
  224.  
  225. sourceComponent: switch(type) {
  226. case "string":
  227. return stringComponent;
  228. case "password":
  229. return passwordComponent;
  230. case "int":
  231. return intComponent;
  232. case "bool":
  233. return boolComponent;
  234. }
  235. }
  236. }
  237.  
  238. TextField {
  239. id: textInput
  240. x: 206
  241. y: 460
  242. width: 434
  243. height: 20
  244. inputMask: qsTr("")
  245. placeholderText: "Say something..."
  246. font.pixelSize: 12
  247. Keys.onReturnPressed: {
  248. // Messenger.writeMessage(textInput.text, activeId)
  249. textInput.text = ""
  250. }
  251. style: TextFieldStyle {
  252. placeholderTextColor: "dimgrey"
  253. background: Rectangle {
  254. y: 1
  255. height: 443
  256. radius: 0
  257. color: "#232629"
  258. implicitWidth: 100
  259. implicitHeight: 24
  260. }
  261. }
  262. }
  263. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement