GemRepoAddDialog.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 <GemRepo/GemRepoAddDialog.h>
  9. #include <FormFolderBrowseEditWidget.h>
  10. #include <QVBoxLayout>
  11. #include <QLabel>
  12. #include <QLineEdit>
  13. #include <QDialogButtonBox>
  14. #include <QPushButton>
  15. namespace O3DE::ProjectManager
  16. {
  17. GemRepoAddDialog::GemRepoAddDialog(QWidget* parent)
  18. : QDialog(parent)
  19. {
  20. setWindowTitle(tr("Add a User Repository"));
  21. setModal(true);
  22. setObjectName("addGemRepoDialog");
  23. QVBoxLayout* vLayout = new QVBoxLayout();
  24. vLayout->setContentsMargins(30, 30, 25, 10);
  25. vLayout->setSpacing(0);
  26. vLayout->setAlignment(Qt::AlignTop);
  27. setLayout(vLayout);
  28. QLabel* instructionTitleLabel = new QLabel(tr("Enter a valid path to add a new user repository"));
  29. instructionTitleLabel->setObjectName("gemRepoAddDialogInstructionTitleLabel");
  30. instructionTitleLabel->setAlignment(Qt::AlignLeft);
  31. vLayout->addWidget(instructionTitleLabel);
  32. vLayout->addSpacing(10);
  33. QLabel* instructionContextLabel = new QLabel(tr("The path can be a Repository URL or a Local Path in your directory."));
  34. instructionContextLabel->setAlignment(Qt::AlignLeft);
  35. vLayout->addWidget(instructionContextLabel);
  36. m_repoPath = new FormFolderBrowseEditWidget(tr("Repository Path"), "", this);
  37. m_repoPath->setFixedSize(QSize(600, 100));
  38. vLayout->addWidget(m_repoPath);
  39. vLayout->addSpacing(10);
  40. QLabel* warningLabel = new QLabel(tr("Online repositories may contain files that could potentially harm your computer,"
  41. " please ensure you understand the risks before downloading Gems from third-party sources."));
  42. warningLabel->setObjectName("gemRepoAddDialogWarningLabel");
  43. warningLabel->setWordWrap(true);
  44. warningLabel->setAlignment(Qt::AlignLeft);
  45. vLayout->addWidget(warningLabel);
  46. vLayout->addSpacing(40);
  47. QDialogButtonBox* dialogButtons = new QDialogButtonBox();
  48. dialogButtons->setObjectName("footer");
  49. vLayout->addWidget(dialogButtons);
  50. QPushButton* cancelButton = dialogButtons->addButton(tr("Cancel"), QDialogButtonBox::RejectRole);
  51. cancelButton->setProperty("secondary", true);
  52. QPushButton* applyButton = dialogButtons->addButton(tr("Add"), QDialogButtonBox::ApplyRole);
  53. applyButton->setProperty("primary", true);
  54. connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
  55. connect(applyButton, &QPushButton::clicked, this, &QDialog::accept);
  56. }
  57. QString GemRepoAddDialog::GetRepoPath()
  58. {
  59. return m_repoPath->lineEdit()->text();
  60. }
  61. } // namespace O3DE::ProjectManager