LicenseDialog.qml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //Copyright (c) 2021 Ultimaker B.V.
  2. //Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Window 2.2
  5. import QtQuick.Controls 2.3
  6. import QtQuick.Layouts 1.3
  7. import UM 1.6 as UM
  8. import Cura 1.6 as Cura
  9. UM.Dialog
  10. {
  11. id: licenseDialog
  12. title: catalog.i18nc("@button", "Plugin license agreement")
  13. minimumWidth: UM.Theme.getSize("modal_window_minimum").width
  14. minimumHeight: UM.Theme.getSize("modal_window_minimum").height
  15. width: minimumWidth
  16. height: minimumHeight
  17. backgroundColor: UM.Theme.getColor("main_background")
  18. property variant catalog: UM.I18nCatalog { name: "cura" }
  19. ColumnLayout
  20. {
  21. anchors.fill: parent
  22. spacing: UM.Theme.getSize("thick_margin").height
  23. Row
  24. {
  25. Layout.fillWidth: true
  26. height: childrenRect.height
  27. spacing: UM.Theme.getSize("default_margin").width
  28. leftPadding: UM.Theme.getSize("narrow_margin").width
  29. UM.ColorImage
  30. {
  31. id: icon
  32. width: UM.Theme.getSize("marketplace_large_icon").width
  33. height: UM.Theme.getSize("marketplace_large_icon").height
  34. color: UM.Theme.getColor("text")
  35. source: UM.Theme.getIcon("Certificate", "high")
  36. }
  37. UM.Label
  38. {
  39. text: catalog.i18nc("@text", "Please read and agree with the plugin licence.")
  40. font: UM.Theme.getFont("large")
  41. anchors.verticalCenter: icon.verticalCenter
  42. height: UM.Theme.getSize("marketplace_large_icon").height
  43. verticalAlignment: Qt.AlignmentFlag.AlignVCenter
  44. }
  45. }
  46. Cura.ScrollableTextArea
  47. {
  48. Layout.fillWidth: true
  49. Layout.fillHeight: true
  50. anchors.topMargin: UM.Theme.getSize("default_margin").height
  51. textArea.text: licenseContent
  52. textArea.readOnly: true
  53. }
  54. }
  55. rightButtons:
  56. [
  57. Cura.PrimaryButton
  58. {
  59. text: catalog.i18nc("@button", "Accept")
  60. onClicked: handler.onLicenseAccepted(packageId)
  61. }
  62. ]
  63. leftButtons:
  64. [
  65. Cura.SecondaryButton
  66. {
  67. text: catalog.i18nc("@button", "Decline")
  68. onClicked: handler.onLicenseDeclined(packageId)
  69. }
  70. ]
  71. onAccepted: handler.onLicenseAccepted(packageId)
  72. onRejected: handler.onLicenseDeclined(packageId)
  73. onClosing: handler.onLicenseDeclined(packageId)
  74. }