LicenseDialog.qml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. Label
  38. {
  39. text: catalog.i18nc("@text", "Please read and agree with the plugin licence.")
  40. color: UM.Theme.getColor("text")
  41. font: UM.Theme.getFont("large")
  42. anchors.verticalCenter: icon.verticalCenter
  43. height: UM.Theme.getSize("marketplace_large_icon").height
  44. verticalAlignment: Qt.AlignmentFlag.AlignVCenter
  45. wrapMode: Text.Wrap
  46. renderType: Text.NativeRendering
  47. }
  48. }
  49. Cura.ScrollableTextArea
  50. {
  51. Layout.fillWidth: true
  52. Layout.fillHeight: true
  53. anchors.topMargin: UM.Theme.getSize("default_margin").height
  54. textArea.text: licenseContent
  55. textArea.readOnly: true
  56. }
  57. }
  58. rightButtons:
  59. [
  60. Cura.PrimaryButton
  61. {
  62. text: catalog.i18nc("@button", "Accept")
  63. onClicked: handler.onLicenseAccepted(packageId)
  64. }
  65. ]
  66. leftButtons:
  67. [
  68. Cura.SecondaryButton
  69. {
  70. text: catalog.i18nc("@button", "Decline")
  71. onClicked: handler.onLicenseDeclined(packageId)
  72. }
  73. ]
  74. onAccepted: handler.onLicenseAccepted(packageId)
  75. onRejected: handler.onLicenseDeclined(packageId)
  76. onClosing: handler.onLicenseDeclined(packageId)
  77. }