LicenseDialog.qml 2.7 KB

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