ToolboxLicenseDialog.qml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // PluginBrowser is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  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. title: catalog.i18nc("@title:window", "Plugin License Agreement")
  12. minimumWidth: UM.Theme.getSize("license_window_minimum").width
  13. minimumHeight: UM.Theme.getSize("license_window_minimum").height
  14. width: minimumWidth
  15. height: minimumHeight
  16. property var pluginName;
  17. property var licenseContent;
  18. property var pluginFileLocation;
  19. Item
  20. {
  21. anchors.fill: parent
  22. Label
  23. {
  24. id: licenseTitle
  25. anchors.top: parent.top
  26. anchors.left: parent.left
  27. anchors.right: parent.right
  28. 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?")
  29. wrapMode: Text.Wrap
  30. }
  31. TextArea
  32. {
  33. id: licenseText
  34. anchors.top: licenseTitle.bottom
  35. anchors.bottom: parent.bottom
  36. anchors.left: parent.left
  37. anchors.right: parent.right
  38. anchors.topMargin: UM.Theme.getSize("default_margin").height
  39. readOnly: true
  40. text: licenseDialog.licenseContent != null ? licenseDialog.licenseContent : ""
  41. }
  42. }
  43. rightButtons: [
  44. Button
  45. {
  46. id: acceptButton
  47. anchors.margins: UM.Theme.getSize("default_margin").width
  48. text: catalog.i18nc("@action:button", "Accept")
  49. onClicked:
  50. {
  51. licenseDialog.close();
  52. manager.installPlugin(licenseDialog.pluginFileLocation);
  53. }
  54. },
  55. Button
  56. {
  57. id: declineButton
  58. anchors.margins: UM.Theme.getSize("default_margin").width
  59. text: catalog.i18nc("@action:button", "Decline")
  60. onClicked:
  61. {
  62. licenseDialog.close();
  63. }
  64. }
  65. ]
  66. }