LicenseDialog.qml 2.6 KB

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