TransferControls.qml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. import QtQuick 1.1
  2. import com.nokia.meego 1.0
  3. import TransferUI 1.0
  4. Item {
  5. id: transferControls
  6. property int estimate: estimateTextField.text
  7. property alias progress: progressSlider.value
  8. property Style platformStyle: LabelStyle {}
  9. signal markCancelledButtonClicked()
  10. signal markCompletedButtonClicked()
  11. signal markDoneButtonClicked()
  12. signal markFailureButtonClicked()
  13. signal markPausedButtonClicked()
  14. signal markResumedButtonClicked()
  15. signal setActiveButtonClicked()
  16. signal setPendingButtonClicked()
  17. onEstimateChanged: {
  18. estimateTextField.text = estimate;
  19. }
  20. Grid {
  21. id: controlButtonsGrid
  22. width: parent.width
  23. property int buttonWidth: (parent.width - spacing) / 2
  24. anchors {
  25. top: parent.top
  26. left: parent.left
  27. right: parent.right
  28. }
  29. columns: 2
  30. spacing: 10
  31. Button {
  32. width: controlButtonsGrid.buttonWidth
  33. text: "Cancel"
  34. onClicked: transferControls.markCancelledButtonClicked();
  35. }
  36. Button {
  37. width: controlButtonsGrid.buttonWidth
  38. text: "Mark completed"
  39. onClicked: transferControls.markCompletedButtonClicked();
  40. }
  41. Button {
  42. width: controlButtonsGrid.buttonWidth
  43. text: "Mark done"
  44. onClicked: transferControls.markDoneButtonClicked();
  45. }
  46. Button {
  47. width: controlButtonsGrid.buttonWidth
  48. text: "Mark failure"
  49. onClicked: transferControls.markFailureButtonClicked();
  50. }
  51. Button {
  52. width: controlButtonsGrid.buttonWidth
  53. text: "Pause"
  54. onClicked: transferControls.markPausedButtonClicked();
  55. }
  56. Button {
  57. width: controlButtonsGrid.buttonWidth
  58. text: "Resume"
  59. onClicked: transferControls.markResumedButtonClicked();
  60. }
  61. Button {
  62. width: controlButtonsGrid.buttonWidth
  63. text: "Set active"
  64. onClicked: transferControls.setActiveButtonClicked();
  65. }
  66. Button {
  67. width: controlButtonsGrid.buttonWidth
  68. text: "Set pending"
  69. onClicked: transferControls.setPendingButtonClicked();
  70. }
  71. }
  72. Grid {
  73. id: labeledControlsGrid
  74. width: parent.width
  75. anchors {
  76. top: controlButtonsGrid.bottom
  77. left: parent.left
  78. right: parent.right
  79. topMargin: spacing
  80. }
  81. columns: 2
  82. spacing: 10
  83. Text {
  84. id: estimateLabel
  85. width: 150
  86. height: estimateTextField.height
  87. verticalAlignment: Text.AlignVCenter
  88. text: "Estimate"
  89. font {
  90. family: platformStyle.fontFamily
  91. pixelSize: platformStyle.fontPixelSize
  92. }
  93. }
  94. TextField {
  95. id: estimateTextField
  96. width: transferControls.width - labeledControlsGrid.spacing / 2
  97. - estimateLabel.width
  98. validator: IntValidator {}
  99. inputMethodHints: Qt.ImhPreferNumbers
  100. onTextChanged: {
  101. var textAsNum = estimateTextField.text;
  102. transferControls.estimate = textAsNum;
  103. }
  104. }
  105. Text {
  106. width: estimateLabel.width
  107. height: progressSlider.height
  108. verticalAlignment: Text.AlignVCenter
  109. text: "Progress"
  110. font {
  111. family: platformStyle.fontFamily
  112. pixelSize: platformStyle.fontPixelSize
  113. }
  114. }
  115. Slider {
  116. id: progressSlider
  117. width: estimateTextField.width
  118. minimumValue: 0.0
  119. maximumValue: 1.0
  120. }
  121. }
  122. }
  123. // End of file.