|
@@ -9,10 +9,13 @@
|
|
#include <TemplateButtonWidget.h>
|
|
#include <TemplateButtonWidget.h>
|
|
#include <ProjectManagerDefs.h>
|
|
#include <ProjectManagerDefs.h>
|
|
|
|
|
|
|
|
+#include <QHBoxLayout>
|
|
#include <QVBoxLayout>
|
|
#include <QVBoxLayout>
|
|
#include <QLabel>
|
|
#include <QLabel>
|
|
#include <QPixmap>
|
|
#include <QPixmap>
|
|
#include <QAbstractButton>
|
|
#include <QAbstractButton>
|
|
|
|
+#include <QProgressBar>
|
|
|
|
+#include <QSpacerItem>
|
|
#include <QStyle>
|
|
#include <QStyle>
|
|
#include <QVariant>
|
|
#include <QVariant>
|
|
|
|
|
|
@@ -41,9 +44,93 @@ namespace O3DE::ProjectManager
|
|
label->setWordWrap(true);
|
|
label->setWordWrap(true);
|
|
vLayout->addWidget(label);
|
|
vLayout->addWidget(label);
|
|
|
|
|
|
|
|
+ // Create an overlay for remote templates
|
|
|
|
+ QGridLayout* overlayLayout = new QGridLayout();
|
|
|
|
+ overlayLayout->setAlignment(Qt::AlignTop);
|
|
|
|
+ overlayLayout->setSpacing(0);
|
|
|
|
+ overlayLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
+
|
|
|
|
+ // Dark overlay to make text clearer
|
|
|
|
+ m_darkenOverlay = new QLabel(this);
|
|
|
|
+ m_darkenOverlay->setObjectName("labelButtonOverlay");
|
|
|
|
+ m_darkenOverlay->setFixedSize(ProjectTemplateImageWidth, ProjectTemplateImageWidth);
|
|
|
|
+ m_darkenOverlay->setVisible(false);
|
|
|
|
+ overlayLayout->addWidget(m_darkenOverlay,0,0);
|
|
|
|
+
|
|
|
|
+ QVBoxLayout* contentsLayout = new QVBoxLayout();
|
|
|
|
+ contentsLayout->setSpacing(0);
|
|
|
|
+ contentsLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
+ contentsLayout->setAlignment(Qt::AlignTop);
|
|
|
|
+ overlayLayout->addLayout(contentsLayout, 0, 0);
|
|
|
|
+
|
|
|
|
+ // Top status icons
|
|
|
|
+ QHBoxLayout* statusIconsLayout = new QHBoxLayout();
|
|
|
|
+ statusIconsLayout->setSpacing(0);
|
|
|
|
+ statusIconsLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
+ statusIconsLayout->addStretch();
|
|
|
|
+ m_cloudIcon = new QLabel(this);
|
|
|
|
+ m_cloudIcon->setObjectName("projectCloudIconOverlay");
|
|
|
|
+ m_cloudIcon->setPixmap(QIcon(":/Download.svg").pixmap(24, 24));
|
|
|
|
+ m_cloudIcon->setVisible(false);
|
|
|
|
+ statusIconsLayout->addWidget(m_cloudIcon);
|
|
|
|
+ statusIconsLayout->addSpacing(5);
|
|
|
|
+ image->setLayout(overlayLayout);
|
|
|
|
+
|
|
|
|
+ QWidget* statusIconArea = new QWidget();
|
|
|
|
+ statusIconArea->setFixedSize(ProjectTemplateImageWidth, 24);
|
|
|
|
+ statusIconArea->setLayout(statusIconsLayout);
|
|
|
|
+ contentsLayout->addWidget(statusIconArea);
|
|
|
|
+
|
|
|
|
+ QWidget* templateCenter = new QWidget();
|
|
|
|
+ templateCenter->setFixedSize(ProjectTemplateImageWidth, 35);
|
|
|
|
+
|
|
|
|
+ // Center area for download information
|
|
|
|
+ QVBoxLayout* centerBlock = new QVBoxLayout();
|
|
|
|
+ templateCenter->setLayout(centerBlock);
|
|
|
|
+
|
|
|
|
+ QHBoxLayout* downloadProgressTextBlock = new QHBoxLayout();
|
|
|
|
+ m_progressMessageLabel = new QLabel(tr("0%"), this);
|
|
|
|
+ m_progressMessageLabel->setAlignment(Qt::AlignRight);
|
|
|
|
+ m_progressMessageLabel->setVisible(false);
|
|
|
|
+ downloadProgressTextBlock->addWidget(m_progressMessageLabel);
|
|
|
|
+ centerBlock->addLayout(downloadProgressTextBlock);
|
|
|
|
+
|
|
|
|
+ QHBoxLayout* downloadProgressBlock = new QHBoxLayout();
|
|
|
|
+ m_progessBar = new QProgressBar(this);
|
|
|
|
+ m_progessBar->setValue(100);
|
|
|
|
+ m_progessBar->setVisible(false);
|
|
|
|
+
|
|
|
|
+ downloadProgressBlock->addSpacing(10);
|
|
|
|
+ downloadProgressBlock->addWidget(m_progessBar);
|
|
|
|
+ downloadProgressBlock->addSpacing(10);
|
|
|
|
+ centerBlock->addLayout(downloadProgressBlock);
|
|
|
|
+ contentsLayout->addWidget(templateCenter);
|
|
|
|
+
|
|
|
|
+ QSpacerItem* spacer =
|
|
|
|
+ new QSpacerItem(ProjectTemplateImageWidth, ProjectTemplateImageWidth - 35 - 24, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
+ contentsLayout->addSpacerItem(spacer);
|
|
|
|
+
|
|
connect(this, &QAbstractButton::toggled, this, &TemplateButton::onToggled);
|
|
connect(this, &QAbstractButton::toggled, this, &TemplateButton::onToggled);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ void TemplateButton::SetIsRemote(bool isRemote)
|
|
|
|
+ {
|
|
|
|
+ m_cloudIcon->setVisible(isRemote);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void TemplateButton::ShowDownloadProgress(bool showProgress)
|
|
|
|
+ {
|
|
|
|
+ m_progessBar->setVisible(showProgress);
|
|
|
|
+ m_progressMessageLabel->setVisible(showProgress);
|
|
|
|
+ m_darkenOverlay->setVisible(showProgress);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void TemplateButton::SetProgressPercentage(float percentage)
|
|
|
|
+ {
|
|
|
|
+ m_progessBar->setValue(static_cast<int>(percentage));
|
|
|
|
+ m_progressMessageLabel->setText(QString("%1%").arg(static_cast<int>(percentage)));
|
|
|
|
+ }
|
|
|
|
+
|
|
void TemplateButton::onToggled()
|
|
void TemplateButton::onToggled()
|
|
{
|
|
{
|
|
setProperty("Checked", isChecked());
|
|
setProperty("Checked", isChecked());
|