GemRequirementDialog.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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/GemRequirementDialog.h>
  9. #include <GemCatalog/GemRequirementListView.h>
  10. #include <GemCatalog/GemRequirementFilterProxyModel.h>
  11. #include <QVBoxLayout>
  12. #include <QHBoxLayout>
  13. #include <QLabel>
  14. #include <QPushButton>
  15. #include <QDialogButtonBox>
  16. #include <QSpacerItem>
  17. namespace O3DE::ProjectManager
  18. {
  19. GemRequirementDialog::GemRequirementDialog(GemModel* model, QWidget* parent)
  20. : QDialog(parent)
  21. {
  22. setWindowTitle(tr("Manual setup is required"));
  23. setModal(true);
  24. setAttribute(Qt::WA_DeleteOnClose);
  25. QVBoxLayout* vLayout = new QVBoxLayout();
  26. vLayout->setMargin(0);
  27. vLayout->setContentsMargins(25, 10, 25, 10);
  28. vLayout->setSizeConstraint(QLayout::SetFixedSize);
  29. setLayout(vLayout);
  30. QHBoxLayout* instructionLayout = new QHBoxLayout();
  31. instructionLayout->setMargin(0);
  32. QLabel* instructionIconLabel = new QLabel();
  33. instructionIconLabel->setPixmap(QIcon(":/Info.svg").pixmap(32, 32));
  34. instructionLayout->addWidget(instructionIconLabel);
  35. instructionLayout->addSpacing(10);
  36. QLabel* instructionLabel = new QLabel(tr("The following Gem(s) require manual setup before the project can be built successfully."));
  37. instructionLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  38. instructionLayout->addWidget(instructionLabel);
  39. QSpacerItem* instructionSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
  40. instructionLayout->addSpacerItem(instructionSpacer);
  41. vLayout->addLayout(instructionLayout);
  42. vLayout->addSpacing(20);
  43. GemRequirementFilterProxyModel* proxModel = new GemRequirementFilterProxyModel(model, this);
  44. GemRequirementListView* m_gemListView = new GemRequirementListView(proxModel, proxModel->GetSelectionModel(), this);
  45. vLayout->addWidget(m_gemListView);
  46. QDialogButtonBox* dialogButtons = new QDialogButtonBox();
  47. dialogButtons->setObjectName("footer");
  48. vLayout->addWidget(dialogButtons);
  49. QPushButton* cancelButton = dialogButtons->addButton(tr("Cancel"), QDialogButtonBox::RejectRole);
  50. cancelButton->setProperty("secondary", true);
  51. QPushButton* continueButton = dialogButtons->addButton(tr("Continue"), QDialogButtonBox::AcceptRole);
  52. continueButton->setProperty("primary", true);
  53. connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
  54. connect(continueButton, &QPushButton::clicked, this, &QDialog::accept);
  55. }
  56. } // namespace O3DE::ProjectManager