ServerFilesForm.ui.qml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. import QtQuick 2.12
  2. import QtQuick.Controls 2.5
  3. import QtQuick.Controls.Material 2.3
  4. import QtQuick.Layouts 1.3
  5. import QtQuick.Dialogs 1.0
  6. Page {
  7. width: 1280
  8. height: 570
  9. id: serverFilesForm
  10. font.capitalization: Font.MixedCase
  11. Connections {
  12. target: _qmlHandler
  13. onServerFilesListFile: {
  14. fileList.append({
  15. "fileName": fileName,
  16. "fileSize": fileSize + " kB",
  17. "fileProgress": "",
  18. "fileDecryptable": fileDecryptable,
  19. "fileExistsLocally": existsLocally
  20. })
  21. }
  22. onServerFilesClearFileList: {
  23. fileList.clear()
  24. }
  25. onServerFilesSetFileUrlText: {
  26. sendingSelectedFileText.text = signalText
  27. }
  28. onServerFilesEnableSendButton: {
  29. sendingSendFileButton.enabled = true
  30. }
  31. onServerFilesDisableSendButton: {
  32. sendingSendFileButton.enabled = false
  33. }
  34. }
  35. ColumnLayout {
  36. anchors.fill: parent
  37. RowLayout {
  38. Layout.preferredWidth: 750
  39. Layout.preferredHeight: 30
  40. Text {
  41. text: qsTr("File Name")
  42. Layout.alignment: Qt.AlignCenter
  43. Layout.preferredWidth: 400
  44. Layout.preferredHeight: parent.height
  45. verticalAlignment: Text.AlignVCenter
  46. horizontalAlignment: Text.AlignLeft
  47. font.pixelSize: 15
  48. }
  49. Text {
  50. text: qsTr("Size")
  51. Layout.alignment: Qt.AlignCenter
  52. Layout.preferredWidth: 100
  53. Layout.preferredHeight: parent.height
  54. verticalAlignment: Text.AlignVCenter
  55. horizontalAlignment: Text.AlignHCenter
  56. font.pixelSize: 15
  57. }
  58. Text {
  59. text: qsTr("Status")
  60. Layout.alignment: Qt.AlignCenter
  61. Layout.preferredWidth: 100
  62. Layout.preferredHeight: parent.height
  63. verticalAlignment: Text.AlignVCenter
  64. horizontalAlignment: Text.AlignHCenter
  65. font.pixelSize: 15
  66. }
  67. Text {
  68. text: qsTr("Encryption")
  69. Layout.alignment: Qt.AlignCenter
  70. Layout.preferredWidth: 150
  71. Layout.preferredHeight: parent.height
  72. verticalAlignment: Text.AlignVCenter
  73. horizontalAlignment: Text.AlignHCenter
  74. font.pixelSize: 15
  75. }
  76. }
  77. Rectangle {
  78. Layout.alignment: Qt.AlignCenter
  79. Layout.preferredWidth: parent.width
  80. Layout.preferredHeight: 2
  81. color: "#404040"
  82. }
  83. ScrollView {
  84. Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
  85. Layout.preferredWidth: parent.width
  86. Layout.preferredHeight: 440
  87. ListView {
  88. anchors.fill: parent
  89. model: fileList
  90. clip: true
  91. delegate: ServerFilesFileTemplate {
  92. fileNameText: fileName
  93. fileSizeText: fileSize
  94. fileProgressText: fileProgress
  95. fileDecryptableText: fileDecryptable
  96. fileExists: fileExistsLocally
  97. }
  98. }
  99. }
  100. ListModel {
  101. id: fileList
  102. }
  103. Rectangle {
  104. Layout.alignment: Qt.AlignCenter
  105. Layout.preferredWidth: parent.width
  106. Layout.preferredHeight: 2
  107. color: Material.accent
  108. }
  109. RowLayout {
  110. Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
  111. Layout.preferredWidth: parent.width
  112. Text {
  113. text: qsTr("Selected File: ")
  114. Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
  115. Layout.preferredWidth: 150
  116. Layout.preferredHeight: 50
  117. verticalAlignment: Text.AlignVCenter
  118. horizontalAlignment: Text.AlignHCenter
  119. font.pixelSize: 23
  120. }
  121. Text {
  122. id: sendingSelectedFileText
  123. text: qsTr("None")
  124. Layout.preferredWidth: 450
  125. Layout.preferredHeight: 50
  126. verticalAlignment: Text.AlignVCenter
  127. horizontalAlignment: Text.AlignLeft
  128. font.pixelSize: 23
  129. elide: Text.ElideLeft
  130. ToolTip.visible: mouseArea.containsMouse
  131. ToolTip.text: text
  132. ToolTip.delay: 200
  133. MouseArea {
  134. id: mouseArea
  135. anchors.fill: parent
  136. hoverEnabled: true
  137. }
  138. }
  139. Button {
  140. id: sendingClearFileButton
  141. text: qsTr("Clear Selection")
  142. Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
  143. Layout.preferredWidth: 200
  144. Layout.preferredHeight: 50
  145. enabled: sendingSendFileButton.enabled
  146. font.pointSize: 16
  147. // @disable-check M223
  148. onClicked: {
  149. // @disable-check M222
  150. _qmlHandler.onServerFilesClearSelectionButton()
  151. }
  152. }
  153. Button {
  154. id: sendingSelectFileButton
  155. text: qsTr("Select File")
  156. Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
  157. Layout.preferredWidth: 200
  158. Layout.preferredHeight: 50
  159. font.pointSize: 16
  160. // @disable-check M223
  161. onClicked: {
  162. // @disable-check M222
  163. sendingFileDialog.open()
  164. }
  165. }
  166. Button {
  167. id: sendingSendFileButton
  168. enabled: false
  169. text: qsTr("Upload File")
  170. Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
  171. Layout.preferredWidth: 200
  172. Layout.preferredHeight: 50
  173. font.pointSize: 16
  174. // @disable-check M223
  175. onClicked: {
  176. // @disable-check M222
  177. _qmlHandler.onServerFilesSendFileButton()
  178. }
  179. }
  180. }
  181. }
  182. FileDialog {
  183. id: sendingFileDialog
  184. title: "Please choose a file"
  185. folder: shortcuts.home
  186. // @disable-check M223
  187. onAccepted: {
  188. // @disable-check M222
  189. _qmlHandler.onServerFilesSelectFileButton(sendingFileDialog.fileUrl)
  190. }
  191. }
  192. }