MultipleLicenseDialog.qml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // Copyright (c) 2021 Ultimaker B.V.
  2. // Marketplace 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.5 as UM
  8. import Cura 1.6 as Cura
  9. UM.Dialog
  10. {
  11. id: licenseDialog
  12. title: licenseModel.dialogTitle
  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. margin: UM.Theme.getSize("default_margin").width
  19. ColumnLayout
  20. {
  21. anchors.fill: parent
  22. spacing: UM.Theme.getSize("thick_margin").height
  23. UM.I18nCatalog { id: catalog; name: "cura" }
  24. UM.Label
  25. {
  26. id: licenseHeader
  27. Layout.fillWidth: true
  28. text: catalog.i18nc("@label", "You need to accept the license to install the package")
  29. }
  30. Row {
  31. id: packageRow
  32. Layout.fillWidth: true
  33. height: childrenRect.height
  34. spacing: UM.Theme.getSize("default_margin").width
  35. leftPadding: UM.Theme.getSize("narrow_margin").width
  36. Image
  37. {
  38. id: icon
  39. width: UM.Theme.getSize("card_icon").width
  40. height: width
  41. sourceSize.width: width
  42. sourceSize.height: height
  43. fillMode: Image.PreserveAspectFit
  44. source: licenseModel.iconUrl || Qt.resolvedUrl("../images/placeholder.svg")
  45. mipmap: true
  46. }
  47. UM.Label
  48. {
  49. id: packageName
  50. text: licenseModel.packageName
  51. font.bold: true
  52. anchors.verticalCenter: icon.verticalCenter
  53. height: contentHeight
  54. }
  55. }
  56. Cura.ScrollableTextArea
  57. {
  58. Layout.fillWidth: true
  59. Layout.fillHeight: true
  60. anchors.topMargin: UM.Theme.getSize("default_margin").height
  61. textArea.text: licenseModel.licenseText
  62. textArea.readOnly: true
  63. }
  64. }
  65. rightButtons:
  66. [
  67. Cura.PrimaryButton
  68. {
  69. text: licenseModel.acceptButtonText
  70. onClicked: handler.onLicenseAccepted()
  71. }
  72. ]
  73. leftButtons:
  74. [
  75. Cura.SecondaryButton
  76. {
  77. id: declineButton
  78. text: licenseModel.declineButtonText
  79. onClicked: handler.onLicenseDeclined()
  80. }
  81. ]
  82. }