ToolboxLicenseDialog.qml 2.9 KB

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