ServerFilesFileTemplate.ui.qml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. onServerFilesDisableDownloadButton: {
  16. if (fileNameText == fileName) {
  17. fileExists = true
  18. }
  19. }
  20. onServerFilesUpdateFile: {
  21. if (fileNameText == fileName) {
  22. fileProgressText = fileProgress
  23. fileQueued = isQueued
  24. }
  25. }
  26. onServerFilesCloseConfirmDeletePopup: {
  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. }
  41. Text {
  42. id: fileTemplateFileSize
  43. Layout.alignment: Qt.AlignCenter
  44. Layout.preferredHeight: parent.height
  45. Layout.preferredWidth: 100
  46. verticalAlignment: Text.AlignVCenter
  47. horizontalAlignment: Text.AlignRight
  48. text: fileSizeText
  49. }
  50. Text {
  51. id: fileTemplateFileProgress
  52. Layout.alignment: Qt.AlignCenter
  53. Layout.preferredHeight: parent.height
  54. Layout.preferredWidth: 100
  55. verticalAlignment: Text.AlignVCenter
  56. horizontalAlignment: Text.AlignHCenter
  57. text: fileProgressText
  58. }
  59. Text {
  60. id: fileTemplateFileDecryptable
  61. Layout.alignment: Qt.AlignCenter
  62. Layout.preferredHeight: parent.height
  63. Layout.preferredWidth: 150
  64. verticalAlignment: Text.AlignVCenter
  65. horizontalAlignment: Text.AlignHCenter
  66. text: fileDecryptableText
  67. color: (fileDecryptableText
  68. == "decryptable") ? "#00ad11" : (fileDecryptableText
  69. == "undecryptable") ? "#df3f3f" : "#000000"
  70. }
  71. Button {
  72. id: fileTemplateQueueButton
  73. Layout.alignment: Qt.AlignCenter
  74. Layout.preferredHeight: parent.height
  75. Layout.preferredWidth: 100
  76. text: fileQueued ? qsTr("Dequeue") : qsTr("Enqueue")
  77. // @disable-check M223
  78. onClicked: {
  79. // @disable-check M222
  80. fileQueued ? _qmlHandler.onReceivingDequeueFileButton(
  81. // @disable-check M222
  82. fileNameText) : _qmlHandler.onReceivingQueueFileButton(
  83. fileNameText)
  84. }
  85. }
  86. Button {
  87. id: fileTemplateDownloadButton
  88. Layout.alignment: Qt.AlignCenter
  89. Layout.preferredHeight: parent.height
  90. Layout.preferredWidth: 200
  91. enabled: !fileExists
  92. text: fileExists ? qsTr("Already Downloaded") : qsTr("Download")
  93. // @disable-check M223
  94. onClicked: {
  95. // @disable-check M222
  96. _qmlHandler.onServerFilesDownloadFileButton(fileNameText)
  97. }
  98. }
  99. Button {
  100. id: fileTemplateDeleteButton
  101. Layout.alignment: Qt.AlignCenter
  102. Layout.preferredHeight: parent.height
  103. Layout.preferredWidth: 200
  104. text: qsTr("Delete from server")
  105. // @disable-check M223
  106. onClicked: {
  107. // @disable-check M222
  108. confirmDeletePopup.open()
  109. }
  110. }
  111. }
  112. ServerFilesFileTemplateDeletePopup {
  113. id: confirmDeletePopup
  114. }
  115. }