TransferEditor.qml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. import QtQuick 1.1
  2. import com.nokia.meego 1.0
  3. import TransferUI 1.0
  4. import "Consts.js" as Constants
  5. Item {
  6. id: transferEditor
  7. property alias id: idTextField.text
  8. property alias name: nameTextField.text
  9. property alias targetName: targetNameTextField.text
  10. property int size: sizeTextField.text
  11. property int type: Constants.TransferType.Upload
  12. property alias typeButtonsEnabled: typeButtonColumn.enabled
  13. property alias registerButtonEnabled: registerButton.enabled
  14. property alias commitButtonEnabled: commitButton.enabled
  15. property Style platformStyle: LabelStyle {}
  16. signal registerButtonClicked()
  17. signal commitButtonClicked()
  18. onSizeChanged: {
  19. sizeTextField.text = size;
  20. }
  21. Grid {
  22. id: editorGrid
  23. width: parent.width
  24. property int firstColumnWidth: 150
  25. property int secondColumnWidth: parent.width - spacing / 2
  26. - firstColumnWidth
  27. anchors {
  28. top: parent.top
  29. left: parent.left
  30. right: parent.right
  31. }
  32. columns: 2
  33. spacing: 10
  34. Text {
  35. width: editorGrid.firstColumnWidth
  36. height: idTextField.height
  37. verticalAlignment: Text.AlignVCenter
  38. text: "ID"
  39. font {
  40. family: platformStyle.fontFamily
  41. pixelSize: platformStyle.fontPixelSize
  42. }
  43. }
  44. TextField {
  45. id: idTextField
  46. width: editorGrid.secondColumnWidth
  47. }
  48. Text {
  49. width: editorGrid.firstColumnWidth
  50. height: nameTextField.height
  51. verticalAlignment: Text.AlignVCenter
  52. text: "Name"
  53. font {
  54. family: platformStyle.fontFamily
  55. pixelSize: platformStyle.fontPixelSize
  56. }
  57. }
  58. TextField {
  59. id: nameTextField
  60. width: editorGrid.secondColumnWidth
  61. }
  62. Text {
  63. width: editorGrid.firstColumnWidth
  64. height: targetNameTextField.height
  65. verticalAlignment: Text.AlignVCenter
  66. text: "Target name"
  67. font {
  68. family: platformStyle.fontFamily
  69. pixelSize: platformStyle.fontPixelSize
  70. }
  71. }
  72. TextField {
  73. id: targetNameTextField
  74. width: editorGrid.secondColumnWidth
  75. }
  76. Text {
  77. width: editorGrid.firstColumnWidth
  78. height: sizeTextField.height
  79. verticalAlignment: Text.AlignVCenter
  80. text: "Size"
  81. font {
  82. family: platformStyle.fontFamily
  83. pixelSize: platformStyle.fontPixelSize
  84. }
  85. }
  86. TextField {
  87. id: sizeTextField
  88. width: editorGrid.secondColumnWidth
  89. validator: IntValidator {}
  90. inputMethodHints: Qt.ImhPreferNumbers
  91. onTextChanged: {
  92. var textAsNum = sizeTextField.text;
  93. transferEditor.size = textAsNum;
  94. }
  95. }
  96. Text {
  97. width: editorGrid.firstColumnWidth
  98. height: typeButtonColumn.height
  99. verticalAlignment: Text.AlignVCenter
  100. text: "Type"
  101. font {
  102. family: platformStyle.fontFamily
  103. pixelSize: platformStyle.fontPixelSize
  104. }
  105. }
  106. ButtonColumn {
  107. id: typeButtonColumn
  108. width: editorGrid.secondColumnWidth
  109. checkedButton: uploadButton
  110. Button {
  111. id: uploadButton
  112. text: "Upload"
  113. onClicked: transferEditor.type = Constants.TransferType.Upload;
  114. }
  115. Button {
  116. id: downloadButton
  117. text: "Download"
  118. onClicked: transferEditor.type = Constants.TransferType.Download;
  119. }
  120. Button {
  121. id: syncButton
  122. text: "Sync"
  123. onClicked: transferEditor.type = Constants.TransferType.Sync;
  124. }
  125. }
  126. }
  127. Row {
  128. id: buttonRow
  129. anchors {
  130. top: editorGrid.bottom
  131. left: parent.left
  132. right: parent.right
  133. topMargin: 20
  134. }
  135. spacing: 10
  136. Button {
  137. id: registerButton
  138. width: (buttonRow.width - buttonRow.spacing) / 2
  139. text: "Register"
  140. onClicked: transferEditor.registerButtonClicked();
  141. }
  142. Button {
  143. id: commitButton
  144. width: registerButton.width
  145. text: "Commit"
  146. onClicked: transferEditor.commitButtonClicked();
  147. }
  148. }
  149. }
  150. // End of file.