ToolboxLicenseDialog.qml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 1.4
  7. import QtQuick.Controls.Styles 1.4
  8. // TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles
  9. import UM 1.1 as UM
  10. UM.Dialog
  11. {
  12. title: catalog.i18nc("@title:window", "Plugin License Agreement")
  13. minimumWidth: UM.Theme.getSize("license_window_minimum").width
  14. minimumHeight: UM.Theme.getSize("license_window_minimum").height
  15. width: minimumWidth
  16. height: minimumHeight
  17. property var pluginName;
  18. property var licenseContent;
  19. property var pluginFileLocation;
  20. Item
  21. {
  22. anchors.fill: parent
  23. Label
  24. {
  25. id: licenseTitle
  26. anchors.top: parent.top
  27. anchors.left: parent.left
  28. anchors.right: parent.right
  29. text: licenseDialog.pluginName + catalog.i18nc("@label", "This plugin contains a license.\nYou need to accept this license to install this plugin.\nDo you agree with the terms below?")
  30. wrapMode: Text.Wrap
  31. renderType: Text.NativeRendering
  32. }
  33. TextArea
  34. {
  35. id: licenseText
  36. anchors.top: licenseTitle.bottom
  37. anchors.bottom: parent.bottom
  38. anchors.left: parent.left
  39. anchors.right: parent.right
  40. anchors.topMargin: UM.Theme.getSize("default_margin").height
  41. readOnly: true
  42. text: licenseDialog.licenseContent || ""
  43. }
  44. }
  45. rightButtons:
  46. [
  47. Button
  48. {
  49. id: acceptButton
  50. anchors.margins: UM.Theme.getSize("default_margin").width
  51. text: catalog.i18nc("@action:button", "Accept")
  52. onClicked:
  53. {
  54. licenseDialog.close();
  55. toolbox.install(licenseDialog.pluginFileLocation);
  56. }
  57. },
  58. Button
  59. {
  60. id: declineButton
  61. anchors.margins: UM.Theme.getSize("default_margin").width
  62. text: catalog.i18nc("@action:button", "Decline")
  63. onClicked:
  64. {
  65. licenseDialog.close();
  66. }
  67. }
  68. ]
  69. }