ToolboxLicenseDialog.qml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. Layout.fillWidth: true
  38. height: childrenRect.height
  39. spacing: UM.Theme.getSize("default_margin").width
  40. leftPadding: UM.Theme.getSize("narrow_margin").width
  41. Image
  42. {
  43. id: icon
  44. width: 30 * screenScaleFactor
  45. height: width
  46. sourceSize.width: width
  47. sourceSize.height: height
  48. fillMode: Image.PreserveAspectFit
  49. source: licenseModel.iconUrl || "../../images/placeholder.svg"
  50. mipmap: true
  51. }
  52. Label
  53. {
  54. id: packageName
  55. text: licenseModel.packageName
  56. color: UM.Theme.getColor("text")
  57. font.bold: true
  58. anchors.verticalCenter: icon.verticalCenter
  59. height: contentHeight
  60. wrapMode: Text.Wrap
  61. renderType: Text.NativeRendering
  62. }
  63. }
  64. Cura.ScrollableTextArea
  65. {
  66. Layout.fillWidth: true
  67. Layout.fillHeight: true
  68. anchors.topMargin: UM.Theme.getSize("default_margin").height
  69. textArea.text: licenseModel.licenseText
  70. textArea.readOnly: true
  71. }
  72. }
  73. rightButtons:
  74. [
  75. Cura.PrimaryButton
  76. {
  77. leftPadding: UM.Theme.getSize("dialog_primary_button_padding").width
  78. rightPadding: UM.Theme.getSize("dialog_primary_button_padding").width
  79. text: licenseModel.acceptButtonText
  80. onClicked: { handler.onLicenseAccepted() }
  81. }
  82. ]
  83. leftButtons:
  84. [
  85. Cura.SecondaryButton
  86. {
  87. id: declineButton
  88. text: licenseModel.declineButtonText
  89. onClicked: { handler.onLicenseDeclined() }
  90. }
  91. ]
  92. }