ToolboxConfirmUninstallResetDialog.qml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Controls.Styles 1.1
  6. import QtQuick.Layouts 1.1
  7. import QtQuick.Dialogs 1.1
  8. import QtQuick.Window 2.1
  9. import UM 1.3 as UM
  10. import Cura 1.0 as Cura
  11. UM.Dialog
  12. {
  13. // This dialog asks the user to confirm he/she wants to uninstall materials/pprofiles which are currently in use
  14. id: base
  15. title: catalog.i18nc("@title:window", "Confirm uninstall") + toolbox.pluginToUninstall
  16. width: 450 * screenScaleFactor
  17. height: 50 * screenScaleFactor + dialogText.height + buttonBar.height
  18. maximumWidth: 450 * screenScaleFactor
  19. maximumHeight: 450 * screenScaleFactor
  20. minimumWidth: 450 * screenScaleFactor
  21. minimumHeight: 150 * screenScaleFactor
  22. modality: Qt.WindowModal
  23. Column
  24. {
  25. UM.I18nCatalog { id: catalog; name: "cura" }
  26. anchors
  27. {
  28. fill: parent
  29. leftMargin: Math.round(20 * screenScaleFactor)
  30. rightMargin: Math.round(20 * screenScaleFactor)
  31. topMargin: Math.round(10 * screenScaleFactor)
  32. bottomMargin: Math.round(10 * screenScaleFactor)
  33. }
  34. spacing: Math.round(15 * screenScaleFactor)
  35. Label
  36. {
  37. id: dialogText
  38. text:
  39. {
  40. var base_text = catalog.i18nc("@text:window", "You are uninstalling materials and/or profiles that are still in use. Confirming will reset the following materials/profiles to their defaults.")
  41. var materials_text = catalog.i18nc("@text:window", "Materials")
  42. var qualities_text = catalog.i18nc("@text:window", "Profiles")
  43. var machines_with_materials = toolbox.uninstallUsedMaterials
  44. var machines_with_qualities = toolbox.uninstallUsedQualities
  45. if (machines_with_materials != "")
  46. {
  47. base_text += "\n\n" + materials_text +": \n" + machines_with_materials
  48. }
  49. if (machines_with_qualities != "")
  50. {
  51. base_text += "\n\n" + qualities_text + ": \n" + machines_with_qualities
  52. }
  53. return base_text
  54. }
  55. anchors.left: parent.left
  56. anchors.right: parent.right
  57. font: UM.Theme.getFont("default")
  58. wrapMode: Text.WordWrap
  59. renderType: Text.NativeRendering
  60. }
  61. // Buttons
  62. Item {
  63. id: buttonBar
  64. anchors.right: parent.right
  65. anchors.left: parent.left
  66. height: childrenRect.height
  67. Button {
  68. id: cancelButton
  69. text: catalog.i18nc("@action:button", "Cancel")
  70. anchors.right: confirmButton.left
  71. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  72. isDefault: true
  73. onClicked: toolbox.closeConfirmResetDialog()
  74. }
  75. Button {
  76. id: confirmButton
  77. text: catalog.i18nc("@action:button", "Confirm")
  78. anchors.right: parent.right
  79. onClicked: toolbox.resetMaterialsQualitiesAndUninstall()
  80. }
  81. }
  82. }
  83. }