GemUninstallDialog.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <GemCatalog/GemUninstallDialog.h>
  9. #include <QVBoxLayout>
  10. #include <QLabel>
  11. #include <QDialogButtonBox>
  12. #include <QPushButton>
  13. #include <QVariant>
  14. namespace O3DE::ProjectManager
  15. {
  16. GemUninstallDialog::GemUninstallDialog(const QString& gemName, QWidget* parent)
  17. : QDialog(parent)
  18. {
  19. setWindowTitle(tr("Uninstall Remote Gem"));
  20. setObjectName("GemUninstallDialog");
  21. setAttribute(Qt::WA_DeleteOnClose);
  22. setModal(true);
  23. QVBoxLayout* layout = new QVBoxLayout();
  24. layout->setMargin(30);
  25. layout->setAlignment(Qt::AlignTop);
  26. setLayout(layout);
  27. // Body
  28. QLabel* subTitleLabel = new QLabel(tr("Are you sure you want to uninstall %1?").arg(gemName));
  29. subTitleLabel->setObjectName("dialogSubTitle");
  30. layout->addWidget(subTitleLabel);
  31. layout->addSpacing(10);
  32. QLabel* bodyLabel = new QLabel(tr("The Gem and its related files will be uninstalled. This does not affect the Gem's repository. "
  33. "You can re-install this Gem from the Catalog, but its contents may be subject to change."));
  34. bodyLabel->setWordWrap(true);
  35. bodyLabel->setFixedSize(QSize(440, 80));
  36. layout->addWidget(bodyLabel);
  37. layout->addSpacing(40);
  38. // Buttons
  39. QDialogButtonBox* dialogButtons = new QDialogButtonBox();
  40. dialogButtons->setObjectName("footer");
  41. layout->addWidget(dialogButtons);
  42. QPushButton* cancelButton = dialogButtons->addButton(tr("Cancel"), QDialogButtonBox::RejectRole);
  43. cancelButton->setProperty("secondary", true);
  44. QPushButton* uninstallButton = dialogButtons->addButton(tr("Uninstall Gem"), QDialogButtonBox::ApplyRole);
  45. uninstallButton->setProperty("danger", true);
  46. connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
  47. connect(uninstallButton, &QPushButton::clicked, this, &QDialog::accept);
  48. }
  49. } // namespace O3DE::ProjectManager