ToolboxLicenseDialog.qml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Toolbox 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. {
  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. }
  32. TextArea
  33. {
  34. id: licenseText
  35. anchors.top: licenseTitle.bottom
  36. anchors.bottom: parent.bottom
  37. anchors.left: parent.left
  38. anchors.right: parent.right
  39. anchors.topMargin: UM.Theme.getSize("default_margin").height
  40. readOnly: true
  41. text: licenseDialog.licenseContent || ""
  42. }
  43. }
  44. rightButtons:
  45. [
  46. Button
  47. {
  48. id: acceptButton
  49. anchors.margins: UM.Theme.getSize("default_margin").width
  50. text: catalog.i18nc("@action:button", "Accept")
  51. onClicked:
  52. {
  53. licenseDialog.close();
  54. toolbox.install(licenseDialog.pluginFileLocation);
  55. }
  56. },
  57. Button
  58. {
  59. id: declineButton
  60. anchors.margins: UM.Theme.getSize("default_margin").width
  61. text: catalog.i18nc("@action:button", "Decline")
  62. onClicked:
  63. {
  64. licenseDialog.close();
  65. }
  66. }
  67. ]
  68. }