|
|
|
@ -11,6 +11,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QResizeEvent>
|
|
|
|
#include <QResizeEvent>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QPushButton>
|
|
|
|
@ -20,6 +21,7 @@
|
|
|
|
#include <QProgressBar>
|
|
|
|
#include <QProgressBar>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QFileInfo>
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
|
|
|
#include <QDesktopServices>
|
|
|
|
|
|
|
|
|
|
|
|
namespace O3DE::ProjectManager
|
|
|
|
namespace O3DE::ProjectManager
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -40,8 +42,57 @@ namespace O3DE::ProjectManager
|
|
|
|
m_overlayLabel->setVisible(false);
|
|
|
|
m_overlayLabel->setVisible(false);
|
|
|
|
vLayout->addWidget(m_overlayLabel);
|
|
|
|
vLayout->addWidget(m_overlayLabel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_buildOverlayLayout = new QVBoxLayout();
|
|
|
|
|
|
|
|
m_buildOverlayLayout->addSpacing(10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QHBoxLayout* horizontalMessageLayout = new QHBoxLayout();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
horizontalMessageLayout->addSpacing(10);
|
|
|
|
|
|
|
|
m_warningIcon = new QLabel(this);
|
|
|
|
|
|
|
|
m_warningIcon->setPixmap(QIcon(":/Warning.svg").pixmap(20, 20));
|
|
|
|
|
|
|
|
m_warningIcon->setAlignment(Qt::AlignTop);
|
|
|
|
|
|
|
|
m_warningIcon->setVisible(false);
|
|
|
|
|
|
|
|
horizontalMessageLayout->addWidget(m_warningIcon);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
horizontalMessageLayout->addSpacing(10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_warningText = new QLabel("", this);
|
|
|
|
|
|
|
|
m_warningText->setObjectName("projectWarningOverlay");
|
|
|
|
|
|
|
|
m_warningText->setWordWrap(true);
|
|
|
|
|
|
|
|
m_warningText->setAlignment(Qt::AlignLeft);
|
|
|
|
|
|
|
|
m_warningText->setVisible(false);
|
|
|
|
|
|
|
|
connect(m_warningText, &QLabel::linkActivated, this, &LabelButton::OnLinkActivated);
|
|
|
|
|
|
|
|
horizontalMessageLayout->addWidget(m_warningText);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QSpacerItem* textSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
|
|
|
|
horizontalMessageLayout->addSpacerItem(textSpacer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_buildOverlayLayout->addLayout(horizontalMessageLayout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QSpacerItem* buttonSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
|
|
|
|
|
|
m_buildOverlayLayout->addSpacerItem(buttonSpacer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QHBoxLayout* horizontalOpenEditorButtonLayout = new QHBoxLayout();
|
|
|
|
|
|
|
|
horizontalOpenEditorButtonLayout->addSpacing(34);
|
|
|
|
|
|
|
|
m_openEditorButton = new QPushButton(tr("Open Editor"), this);
|
|
|
|
|
|
|
|
m_openEditorButton->setObjectName("openEditorButton");
|
|
|
|
|
|
|
|
m_openEditorButton->setDefault(true);
|
|
|
|
|
|
|
|
m_openEditorButton->setVisible(false);
|
|
|
|
|
|
|
|
horizontalOpenEditorButtonLayout->addWidget(m_openEditorButton);
|
|
|
|
|
|
|
|
horizontalOpenEditorButtonLayout->addSpacing(34);
|
|
|
|
|
|
|
|
m_buildOverlayLayout->addLayout(horizontalOpenEditorButtonLayout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QHBoxLayout* horizontalButtonLayout = new QHBoxLayout();
|
|
|
|
|
|
|
|
horizontalButtonLayout->addSpacing(34);
|
|
|
|
m_actionButton = new QPushButton(tr("Project Action"), this);
|
|
|
|
m_actionButton = new QPushButton(tr("Project Action"), this);
|
|
|
|
m_actionButton->setVisible(false);
|
|
|
|
m_actionButton->setVisible(false);
|
|
|
|
|
|
|
|
horizontalButtonLayout->addWidget(m_actionButton);
|
|
|
|
|
|
|
|
horizontalButtonLayout->addSpacing(34);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_buildOverlayLayout->addLayout(horizontalButtonLayout);
|
|
|
|
|
|
|
|
m_buildOverlayLayout->addSpacing(16);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vLayout->addItem(m_buildOverlayLayout);
|
|
|
|
|
|
|
|
|
|
|
|
m_progressBar = new QProgressBar(this);
|
|
|
|
m_progressBar = new QProgressBar(this);
|
|
|
|
m_progressBar->setObjectName("labelButtonProgressBar");
|
|
|
|
m_progressBar->setObjectName("labelButtonProgressBar");
|
|
|
|
@ -73,16 +124,41 @@ namespace O3DE::ProjectManager
|
|
|
|
return m_overlayLabel;
|
|
|
|
return m_overlayLabel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LabelButton::SetLogUrl(const QUrl& url)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_logUrl = url;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QProgressBar* LabelButton::GetProgressBar()
|
|
|
|
QProgressBar* LabelButton::GetProgressBar()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_progressBar;
|
|
|
|
return m_progressBar;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QPushButton* LabelButton::GetOpenEditorButton()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return m_openEditorButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QPushButton* LabelButton::GetActionButton()
|
|
|
|
QPushButton* LabelButton::GetActionButton()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_actionButton;
|
|
|
|
return m_actionButton;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QLabel* LabelButton::GetWarningLabel()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return m_warningText;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QLabel* LabelButton::GetWarningIcon()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return m_warningIcon;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LabelButton::OnLinkActivated(const QString& /*link*/)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QDesktopServices::openUrl(m_logUrl);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ProjectButton::ProjectButton(const ProjectInfo& projectInfo, QWidget* parent, bool processing)
|
|
|
|
ProjectButton::ProjectButton(const ProjectInfo& projectInfo, QWidget* parent, bool processing)
|
|
|
|
: QFrame(parent)
|
|
|
|
: QFrame(parent)
|
|
|
|
, m_projectInfo(projectInfo)
|
|
|
|
, m_projectInfo(projectInfo)
|
|
|
|
@ -110,7 +186,6 @@ namespace O3DE::ProjectManager
|
|
|
|
m_projectImageLabel = new LabelButton(this);
|
|
|
|
m_projectImageLabel = new LabelButton(this);
|
|
|
|
m_projectImageLabel->setFixedSize(ProjectPreviewImageWidth, ProjectPreviewImageHeight);
|
|
|
|
m_projectImageLabel->setFixedSize(ProjectPreviewImageWidth, ProjectPreviewImageHeight);
|
|
|
|
m_projectImageLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
m_projectImageLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
|
|
|
connect(m_projectImageLabel, &LabelButton::triggered, [this]() { emit OpenProject(m_projectInfo.m_path); });
|
|
|
|
|
|
|
|
vLayout->addWidget(m_projectImageLabel);
|
|
|
|
vLayout->addWidget(m_projectImageLabel);
|
|
|
|
|
|
|
|
|
|
|
|
QString projectPreviewPath = QDir(m_projectInfo.m_path).filePath(m_projectInfo.m_iconPath);
|
|
|
|
QString projectPreviewPath = QDir(m_projectInfo.m_path).filePath(m_projectInfo.m_iconPath);
|
|
|
|
@ -145,6 +220,8 @@ namespace O3DE::ProjectManager
|
|
|
|
|
|
|
|
|
|
|
|
void ProjectButton::ReadySetup()
|
|
|
|
void ProjectButton::ReadySetup()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
connect(m_projectImageLabel->GetOpenEditorButton(), &QPushButton::clicked, [this](){ emit OpenProject(m_projectInfo.m_path); });
|
|
|
|
|
|
|
|
|
|
|
|
QMenu* menu = new QMenu(this);
|
|
|
|
QMenu* menu = new QMenu(this);
|
|
|
|
menu->addAction(tr("Edit Project Settings..."), this, [this]() { emit EditProject(m_projectInfo.m_path); });
|
|
|
|
menu->addAction(tr("Edit Project Settings..."), this, [this]() { emit EditProject(m_projectInfo.m_path); });
|
|
|
|
menu->addAction(tr("Build"), this, [this]() { emit BuildProject(m_projectInfo); });
|
|
|
|
menu->addAction(tr("Build"), this, [this]() { emit BuildProject(m_projectInfo); });
|
|
|
|
@ -170,9 +247,6 @@ namespace O3DE::ProjectManager
|
|
|
|
QPushButton* projectActionButton = m_projectImageLabel->GetActionButton();
|
|
|
|
QPushButton* projectActionButton = m_projectImageLabel->GetActionButton();
|
|
|
|
if (!m_actionButtonConnection)
|
|
|
|
if (!m_actionButtonConnection)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QSpacerItem* buttonSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
|
|
|
|
|
|
|
m_projectImageLabel->layout()->addItem(buttonSpacer);
|
|
|
|
|
|
|
|
m_projectImageLabel->layout()->addWidget(projectActionButton);
|
|
|
|
|
|
|
|
projectActionButton->setVisible(true);
|
|
|
|
projectActionButton->setVisible(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@ -186,6 +260,27 @@ namespace O3DE::ProjectManager
|
|
|
|
|
|
|
|
|
|
|
|
void ProjectButton::SetProjectBuildButtonAction()
|
|
|
|
void ProjectButton::SetProjectBuildButtonAction()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
m_projectImageLabel->GetWarningLabel()->setText(tr("Building project required."));
|
|
|
|
|
|
|
|
m_projectImageLabel->GetWarningIcon()->setVisible(true);
|
|
|
|
|
|
|
|
m_projectImageLabel->GetWarningLabel()->setVisible(true);
|
|
|
|
|
|
|
|
SetProjectButtonAction(tr("Build Project"), [this]() { emit BuildProject(m_projectInfo); });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ProjectButton::ShowBuildFailed(bool show, const QUrl& logUrl)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!logUrl.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_projectImageLabel->GetWarningLabel()->setText(tr("Failed to build. Click to <a href=\"logs\">view logs</a>."));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_projectImageLabel->GetWarningLabel()->setText(tr("Project failed to build."));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_projectImageLabel->GetWarningLabel()->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
|
|
|
|
|
|
|
m_projectImageLabel->GetWarningIcon()->setVisible(show);
|
|
|
|
|
|
|
|
m_projectImageLabel->GetWarningLabel()->setVisible(show);
|
|
|
|
|
|
|
|
m_projectImageLabel->SetLogUrl(logUrl);
|
|
|
|
SetProjectButtonAction(tr("Build Project"), [this]() { emit BuildProject(m_projectInfo); });
|
|
|
|
SetProjectButtonAction(tr("Build Project"), [this]() { emit BuildProject(m_projectInfo); });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -209,6 +304,16 @@ namespace O3DE::ProjectManager
|
|
|
|
m_projectImageLabel->GetProgressBar()->setValue(progress);
|
|
|
|
m_projectImageLabel->GetProgressBar()->setValue(progress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ProjectButton::enterEvent(QEvent* /*event*/)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_projectImageLabel->GetOpenEditorButton()->setVisible(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ProjectButton::leaveEvent(QEvent* /*event*/)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_projectImageLabel->GetOpenEditorButton()->setVisible(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LabelButton* ProjectButton::GetLabelButton()
|
|
|
|
LabelButton* ProjectButton::GetLabelButton()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_projectImageLabel;
|
|
|
|
return m_projectImageLabel;
|
|
|
|
|