ReceivingFileTemplate.ui.qml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 fileDecryptableText: "Decryptable Placeholder"
  10. property bool fileExists: false
  11. Connections {
  12. target: _qmlHandler
  13. onReceivingDisableDownloadButton: {
  14. if (fileNameText == fileName) {
  15. fileExists = true
  16. }
  17. }
  18. onReceivingCloseConfirmDeletePopup: {
  19. confirmDeletePopup.close()
  20. }
  21. }
  22. RowLayout {
  23. id: rowLayout
  24. anchors.fill: parent
  25. Text {
  26. id: fileTemplateFileName
  27. Layout.alignment: Qt.AlignCenter
  28. Layout.preferredHeight: parent.height
  29. Layout.preferredWidth: 400
  30. verticalAlignment: Text.AlignVCenter
  31. text: fileNameText
  32. color: "#ffffff"
  33. }
  34. Text {
  35. id: fileTemplateFileSize
  36. Layout.alignment: Qt.AlignCenter
  37. Layout.preferredHeight: parent.height
  38. Layout.preferredWidth: 200
  39. verticalAlignment: Text.AlignVCenter
  40. horizontalAlignment: Text.AlignHCenter
  41. text: fileSizeText
  42. color: "#ffffff"
  43. }
  44. Text {
  45. id: fileTemplateFileDecryptable
  46. Layout.alignment: Qt.AlignCenter
  47. Layout.preferredHeight: parent.height
  48. Layout.preferredWidth: 200
  49. verticalAlignment: Text.AlignVCenter
  50. horizontalAlignment: Text.AlignHCenter
  51. text: fileDecryptableText
  52. color: "#ffffff"
  53. }
  54. Button {
  55. id: fileTemplateDownloadButton
  56. Layout.alignment: Qt.AlignCenter
  57. Layout.preferredHeight: parent.height
  58. Layout.preferredWidth: 200
  59. enabled: !fileExists
  60. text: fileExists ? qsTr("Already Downloaded") : qsTr("Download")
  61. onClicked: _qmlHandler.onReceivingDownloadFileButton(fileNameText)
  62. }
  63. Button {
  64. id: fileTemplateDeleteButton
  65. Layout.alignment: Qt.AlignCenter
  66. Layout.preferredHeight: parent.height
  67. Layout.preferredWidth: 200
  68. text: qsTr("Delete from server")
  69. onClicked: confirmDeletePopup.open()
  70. }
  71. }
  72. ReceivingFileTemplateDeletePopup {
  73. id: confirmDeletePopup
  74. }
  75. }