Addressed review feedback

Signed-off-by: nggieber <nggieber@amazon.com>
monroegm-disable-blank-issue-2
nggieber 4 years ago
parent 0b5aaa297e
commit 16e66cfa71

@ -617,6 +617,10 @@ QProgressBar::chunk {
font-size:14px; font-size:14px;
} }
#addGemRepoDialog #formFrame {
margin-left:0px;
}
/************** Gem Repo Inspector **************/ /************** Gem Repo Inspector **************/
#gemRepoInspectorNameLabel { #gemRepoInspectorNameLabel {

@ -12,6 +12,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QLabel> #include <QLabel>
#include <QLineEdit.h> #include <QLineEdit.h>
#include <QDialogButtonBox>
#include <QPushButton> #include <QPushButton>
namespace O3DE::ProjectManager namespace O3DE::ProjectManager
@ -21,6 +22,7 @@ namespace O3DE::ProjectManager
{ {
setWindowTitle(tr("Add a User Repository")); setWindowTitle(tr("Add a User Repository"));
setModal(true); setModal(true);
setObjectName("addGemRepoDialog");
QVBoxLayout* vLayout = new QVBoxLayout(); QVBoxLayout* vLayout = new QVBoxLayout();
vLayout->setContentsMargins(30, 30, 25, 10); vLayout->setContentsMargins(30, 30, 25, 10);
@ -39,7 +41,7 @@ namespace O3DE::ProjectManager
vLayout->addWidget(instructionContextLabel); vLayout->addWidget(instructionContextLabel);
m_repoPath = new FormLineEditWidget(tr("Repository Path"), "", this); m_repoPath = new FormLineEditWidget(tr("Repository Path"), "", this);
m_repoPath->setFixedWidth(500); m_repoPath->setFixedWidth(600);
vLayout->addWidget(m_repoPath); vLayout->addWidget(m_repoPath);
vLayout->addSpacing(40); vLayout->addSpacing(40);
@ -50,31 +52,14 @@ namespace O3DE::ProjectManager
QPushButton* cancelButton = dialogButtons->addButton(tr("Cancel"), QDialogButtonBox::RejectRole); QPushButton* cancelButton = dialogButtons->addButton(tr("Cancel"), QDialogButtonBox::RejectRole);
cancelButton->setProperty("secondary", true); cancelButton->setProperty("secondary", true);
QPushButton* continueButton = dialogButtons->addButton(tr("Add"), QDialogButtonBox::ApplyRole); QPushButton* applyButton = dialogButtons->addButton(tr("Add"), QDialogButtonBox::ApplyRole);
connect(cancelButton, &QPushButton::clicked, this, &GemRepoAddDialog::CancelButtonPressed); connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
connect(continueButton, &QPushButton::clicked, this, &GemRepoAddDialog::ContinueButtonPressed); connect(applyButton, &QPushButton::clicked, this, &QDialog::accept);
}
QDialogButtonBox::ButtonRole GemRepoAddDialog::GetButtonResult()
{
return m_buttonResult;
} }
QString GemRepoAddDialog::GetRepoPath() QString GemRepoAddDialog::GetRepoPath()
{ {
return m_repoPath->lineEdit()->text(); return m_repoPath->lineEdit()->text();
} }
void GemRepoAddDialog::CancelButtonPressed()
{
m_buttonResult = QDialogButtonBox::RejectRole;
close();
}
void GemRepoAddDialog::ContinueButtonPressed()
{
m_buttonResult = QDialogButtonBox::ApplyRole;
close();
}
} // namespace O3DE::ProjectManager } // namespace O3DE::ProjectManager

@ -10,8 +10,6 @@
#if !defined(Q_MOC_RUN) #if !defined(Q_MOC_RUN)
#include <QDialog.h> #include <QDialog.h>
#include <QDialogButtonBox>
#endif #endif
namespace O3DE::ProjectManager namespace O3DE::ProjectManager
@ -25,15 +23,9 @@ namespace O3DE::ProjectManager
explicit GemRepoAddDialog(QWidget* parent = nullptr); explicit GemRepoAddDialog(QWidget* parent = nullptr);
~GemRepoAddDialog() = default; ~GemRepoAddDialog() = default;
QDialogButtonBox::ButtonRole GetButtonResult();
QString GetRepoPath(); QString GetRepoPath();
private: private:
void CancelButtonPressed();
void ContinueButtonPressed();
FormLineEditWidget* m_repoPath = nullptr; FormLineEditWidget* m_repoPath = nullptr;
QDialogButtonBox::ButtonRole m_buttonResult = QDialogButtonBox::RejectRole;
}; };
} // namespace O3DE::ProjectManager } // namespace O3DE::ProjectManager

@ -75,9 +75,8 @@ namespace O3DE::ProjectManager
void GemRepoScreen::HandleAddRepoButton() void GemRepoScreen::HandleAddRepoButton()
{ {
GemRepoAddDialog* repoAddDialog = new GemRepoAddDialog(this); GemRepoAddDialog* repoAddDialog = new GemRepoAddDialog(this);
repoAddDialog->exec();
if (repoAddDialog->GetButtonResult() == QDialogButtonBox::ApplyRole) if (repoAddDialog->exec() == QDialog::DialogCode::Accepted)
{ {
QString repoUrl = repoAddDialog->GetRepoPath(); QString repoUrl = repoAddDialog->GetRepoPath();
if (repoUrl.isEmpty()) if (repoUrl.isEmpty())
@ -93,7 +92,7 @@ namespace O3DE::ProjectManager
else else
{ {
QMessageBox::critical(this, tr("Operation failed"), QMessageBox::critical(this, tr("Operation failed"),
QString("Failed to add gem repo: %1.\nError:\n%2").arg(repoUrl, addGemRepoResult.GetError().c_str())); QString("Failed to add gem repo: %1.<br>Error:<br>%2").arg(repoUrl, addGemRepoResult.GetError().c_str()));
} }
} }
} }
@ -112,7 +111,7 @@ namespace O3DE::ProjectManager
} }
else else
{ {
QMessageBox::critical(this, tr("Operation failed"), QString("Cannot retrieve gem repos for engine.\n\nError:\n%2").arg(allGemRepoInfosResult.GetError().c_str())); QMessageBox::critical(this, tr("Operation failed"), QString("Cannot retrieve gem repos for engine.<br>Error:<br>%2").arg(allGemRepoInfosResult.GetError().c_str()));
} }
} }

@ -57,7 +57,7 @@ namespace O3DE::ProjectManager
AZ::Outcome<QVector<ProjectTemplateInfo>> GetProjectTemplates(const QString& projectPath = {}) override; AZ::Outcome<QVector<ProjectTemplateInfo>> GetProjectTemplates(const QString& projectPath = {}) override;
// Gem Repos // Gem Repos
AZ::Outcome<void, AZStd::string> AddGemRepo(const QString& repoUri = {}) override; AZ::Outcome<void, AZStd::string> AddGemRepo(const QString& repoUri) override;
AZ::Outcome<QVector<GemRepoInfo>, AZStd::string> GetAllGemRepoInfos() override; AZ::Outcome<QVector<GemRepoInfo>, AZStd::string> GetAllGemRepoInfos() override;
private: private:

@ -165,7 +165,7 @@ namespace O3DE::ProjectManager
* @param repoUri the absolute filesystem path or url to the gem repo manifest file. * @param repoUri the absolute filesystem path or url to the gem repo manifest file.
* @return An outcome with the success flag as well as an error message in case of a failure. * @return An outcome with the success flag as well as an error message in case of a failure.
*/ */
virtual AZ::Outcome<void, AZStd::string> AddGemRepo(const QString& repoUri = {}) = 0; virtual AZ::Outcome<void, AZStd::string> AddGemRepo(const QString& repoUri) = 0;
/** /**
* Get all available gem repo infos. Gathers all repos registered with the engine. * Get all available gem repo infos. Gathers all repos registered with the engine.

Loading…
Cancel
Save