ReceivingFileTemplate.ui.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import QtQuick 2.12
  2. import QtQuick.Controls 2.5
  3. import QtQuick.Layouts 1.3
  4. Item {
  5. width: 1250
  6. height: 50
  7. property string fileNameText: "Name Placeholder"
  8. property string fileSizeText: "Size Placeholder"
  9. property string fileProgressText: "Progress Placeholder"
  10. property string fileDecryptableText: "Decryptable Placeholder"
  11. property bool fileExists: false
  12. property bool fileQueued: false
  13. Connections {
  14. target: _qmlHandler
  15. onReceivingDisableDownloadButton: {
  16. if (fileNameText == fileName) {
  17. fileExists = true
  18. }
  19. }
  20. onReceivingUpdateFile: {
  21. if (fileNameText == fileName) {
  22. fileProgressText = fileProgress
  23. fileQueued = isQueued
  24. }
  25. }
  26. onReceivingCloseConfirmDeletePopup: {
  27. confirmDeletePopup.close()
  28. }
  29. }
  30. RowLayout {
  31. id: rowLayout
  32. anchors.fill: parent
  33. Text {
  34. id: fileTemplateFileName
  35. Layout.alignment: Qt.AlignCenter
  36. Layout.preferredHeight: parent.height
  37. Layout.preferredWidth: 400
  38. verticalAlignment: Text.AlignVCenter
  39. text: fileNameText
  40. color: "#ffffff"
  41. }
  42. Text {
  43. id: fileTemplateFileSize
  44. Layout.alignment: Qt.AlignCenter
  45. Layout.preferredHeight: parent.height
  46. Layout.preferredWidth: 100
  47. verticalAlignment: Text.AlignVCenter
  48. horizontalAlignment: Text.AlignHCenter
  49. text: fileSizeText
  50. color: "#ffffff"
  51. }
  52. Text {
  53. id: fileTemplateFileProgress
  54. Layout.alignment: Qt.AlignCenter
  55. Layout.preferredHeight: parent.height
  56. Layout.preferredWidth: 100
  57. verticalAlignment: Text.AlignVCenter
  58. horizontalAlignment: Text.AlignHCenter
  59. text: fileProgressText
  60. color: "#ffffff"
  61. }
  62. Text {
  63. id: fileTemplateFileDecryptable
  64. Layout.alignment: Qt.AlignCenter
  65. Layout.preferredHeight: parent.height
  66. Layout.preferredWidth: 150
  67. verticalAlignment: Text.AlignVCenter
  68. horizontalAlignment: Text.AlignHCenter
  69. text: fileDecryptableText
  70. color: (fileDecryptableText == "decryptable") ? "#3fdf3f" : (fileDecryptableText == "undecryptable") ? "#df3f3f" : "#ffffff"
  71. }
  72. Button {
  73. id: fileTemplateQueueButton
  74. Layout.alignment: Qt.AlignCenter
  75. Layout.preferredHeight: parent.height
  76. Layout.preferredWidth: 100
  77. text: fileQueued ? qsTr("Dequeue") : qsTr("Enqueue")
  78. // @disable-check M223
  79. onClicked: {
  80. // @disable-check M222
  81. fileQueued ? _qmlHandler.onReceivingDequeueFileButton(
  82. // @disable-check M222
  83. fileNameText) : _qmlHandler.onReceivingQueueFileButton(
  84. fileNameText)
  85. }
  86. }
  87. Button {
  88. id: fileTemplateDownloadButton
  89. Layout.alignment: Qt.AlignCenter
  90. Layout.preferredHeight: parent.height
  91. Layout.preferredWidth: 200
  92. enabled: !fileExists
  93. text: fileExists ? qsTr("Already Downloaded") : qsTr("Download")
  94. // @disable-check M223
  95. onClicked: {
  96. // @disable-check M222
  97. _qmlHandler.onReceivingDownloadFileButton(fileNameText)
  98. }
  99. }
  100. Button {
  101. id: fileTemplateDeleteButton
  102. Layout.alignment: Qt.AlignCenter
  103. Layout.preferredHeight: parent.height
  104. Layout.preferredWidth: 200
  105. text: qsTr("Delete from server")
  106. // @disable-check M223
  107. onClicked: {
  108. // @disable-check M222
  109. confirmDeletePopup.open()
  110. }
  111. }
  112. }
  113. ReceivingFileTemplateDeletePopup {
  114. id: confirmDeletePopup
  115. }
  116. }