Merge branch 'development' into Prism/RemoveTabFocus

This commit is contained in:
nggieber
2021-08-18 08:20:21 -07:00
2382 changed files with 50519 additions and 75682 deletions
@@ -56,8 +56,6 @@ namespace O3DE::ProjectManager
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
AzQtComponents::Utilities::HandleDpiAwareness(AzQtComponents::Utilities::SystemDpiAware);
@@ -170,9 +168,13 @@ namespace O3DE::ProjectManager
// the decoration wrapper is intended to remember window positioning and sizing
auto wrapper = new AzQtComponents::WindowDecorationWrapper();
wrapper->setGuest(m_mainWindow.data());
// show the main window here to apply the stylesheet before restoring geometry or we
// can end up with empty white space at the bottom of the window until the frame is resized again
m_mainWindow->show();
wrapper->enableSaveRestoreGeometry("O3DE", "ProjectManager", "mainWindowGeometry");
wrapper->showFromSettings();
m_mainWindow->show();
qApp->setQuitOnLastWindowClosed(true);
@@ -108,7 +108,7 @@ namespace O3DE::ProjectManager
{
// Gem name, creator and summary
m_nameLabel = CreateStyledLabel(m_mainLayout, 18, s_headerColor);
m_creatorLabel = CreateStyledLabel(m_mainLayout, 12, s_creatorColor);
m_creatorLabel = CreateStyledLabel(m_mainLayout, 12, s_headerColor);
m_mainLayout->addSpacing(5);
// TODO: QLabel seems to have issues determining the right sizeHint() for our font with the given font size.
@@ -116,6 +116,8 @@ namespace O3DE::ProjectManager
m_summaryLabel = CreateStyledLabel(m_mainLayout, 12, s_textColor);
m_mainLayout->addWidget(m_summaryLabel);
m_summaryLabel->setWordWrap(true);
m_summaryLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
m_summaryLabel->setOpenExternalLinks(true);
m_mainLayout->addSpacing(5);
// Directory and documentation links
@@ -161,6 +163,8 @@ namespace O3DE::ProjectManager
m_reqirementsTextLabel = GemInspector::CreateStyledLabel(requrementsLayout, 10, s_textColor);
m_reqirementsTextLabel->setWordWrap(true);
m_reqirementsTextLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
m_reqirementsTextLabel->setOpenExternalLinks(true);
QSpacerItem* reqirementsSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding);
requrementsLayout->addSpacerItem(reqirementsSpacer);
@@ -38,7 +38,6 @@ namespace O3DE::ProjectManager
// Colors
inline constexpr static const char* s_headerColor = "#FFFFFF";
inline constexpr static const char* s_textColor = "#DDDDDD";
inline constexpr static const char* s_creatorColor = "#94D2FF";
private slots:
void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
@@ -95,7 +95,6 @@ namespace O3DE::ProjectManager
gemCreatorRect.moveTo(contentRect.left(), contentRect.top() + gemNameRect.height());
painter->setFont(standardFont);
painter->setPen(m_linkColor);
gemCreatorRect = painter->boundingRect(gemCreatorRect, Qt::TextSingleLine, gemCreator);
painter->drawText(gemCreatorRect, Qt::TextSingleLine, gemCreator);
@@ -39,7 +39,7 @@ namespace O3DE::ProjectManager
NewProjectSettingsScreen::NewProjectSettingsScreen(QWidget* parent)
: ProjectSettingsScreen(parent)
{
const QString defaultName{ "NewProject" };
const QString defaultName = GetDefaultProjectName();
const QString defaultPath = QDir::toNativeSeparators(GetDefaultProjectPath() + "/" + defaultName);
m_projectName->lineEdit()->setText(defaultName);
@@ -162,6 +162,17 @@ namespace O3DE::ProjectManager
return defaultPath;
}
QString NewProjectSettingsScreen::GetDefaultProjectName()
{
return "NewProject";
}
QString NewProjectSettingsScreen::GetProjectAutoPath()
{
const QString projectName = m_projectName->lineEdit()->text();
return QDir::toNativeSeparators(GetDefaultProjectPath() + "/" + projectName);
}
ProjectManagerScreen NewProjectSettingsScreen::GetScreenEnum()
{
return ProjectManagerScreen::NewProjectSettings;
@@ -260,4 +271,22 @@ namespace O3DE::ProjectManager
m_projectTemplateButtonGroup->blockSignals(false);
}
}
void NewProjectSettingsScreen::OnProjectNameUpdated()
{
if (ValidateProjectName() && !m_userChangedProjectPath)
{
m_projectPath->setText(GetProjectAutoPath());
}
}
void NewProjectSettingsScreen::OnProjectPathUpdated()
{
const QString defaultPath = QDir::toNativeSeparators(GetDefaultProjectPath() + "/" + GetDefaultProjectName());
const QString autoPath = GetProjectAutoPath();
const QString path = m_projectPath->lineEdit()->text();
m_userChangedProjectPath = path != defaultPath && path != autoPath;
ValidateProjectPath();
}
} // namespace O3DE::ProjectManager
@@ -40,8 +40,14 @@ namespace O3DE::ProjectManager
signals:
void OnTemplateSelectionChanged(int oldIndex, int newIndex);
protected:
void OnProjectNameUpdated() override;
void OnProjectPathUpdated() override;
private:
QString GetDefaultProjectName();
QString GetDefaultProjectPath();
QString GetProjectAutoPath();
QFrame* CreateTemplateDetails(int margin);
void UpdateTemplateDetails(const ProjectTemplateInfo& templateInfo);
@@ -51,6 +57,7 @@ namespace O3DE::ProjectManager
TagContainerWidget* m_templateIncludedGems;
QVector<ProjectTemplateInfo> m_templates;
int m_selectedTemplateIndex = -1;
bool m_userChangedProjectPath = false;
inline constexpr static int s_spacerSize = 20;
inline constexpr static int s_templateDetailsContentMargin = 20;
@@ -40,12 +40,11 @@ namespace O3DE::ProjectManager
m_verticalLayout->setAlignment(Qt::AlignTop);
m_projectName = new FormLineEditWidget(tr("Project name"), "", this);
connect(m_projectName->lineEdit(), &QLineEdit::textChanged, this, &ProjectSettingsScreen::ValidateProjectName);
connect(m_projectName->lineEdit(), &QLineEdit::textChanged, this, &ProjectSettingsScreen::OnProjectNameUpdated);
m_verticalLayout->addWidget(m_projectName);
m_projectPath = new FormFolderBrowseEditWidget(tr("Project Location"), "", this);
m_projectPath->lineEdit()->setReadOnly(true);
connect(m_projectPath->lineEdit(), &QLineEdit::textChanged, this, &ProjectSettingsScreen::Validate);
connect(m_projectPath->lineEdit(), &QLineEdit::textChanged, this, &ProjectSettingsScreen::OnProjectPathUpdated);
m_verticalLayout->addWidget(m_projectPath);
projectSettingsFrame->setLayout(m_verticalLayout);
@@ -110,28 +109,36 @@ namespace O3DE::ProjectManager
m_projectName->setErrorLabelVisible(!projectNameIsValid);
return projectNameIsValid;
}
bool ProjectSettingsScreen::ValidateProjectPath()
{
bool projectPathIsValid = true;
if (m_projectPath->lineEdit()->text().isEmpty())
QDir path(m_projectPath->lineEdit()->text());
if (!path.isAbsolute())
{
projectPathIsValid = false;
m_projectPath->setErrorLabelText(tr("Please provide a valid location."));
m_projectPath->setErrorLabelText(tr("Please provide an absolute path for the project location."));
}
else
else if (path.exists() && !path.isEmpty())
{
QDir path(m_projectPath->lineEdit()->text());
if (path.exists() && !path.isEmpty())
{
projectPathIsValid = false;
m_projectPath->setErrorLabelText(tr("This folder exists and isn't empty. Please choose a different location."));
}
projectPathIsValid = false;
m_projectPath->setErrorLabelText(tr("This folder exists and isn't empty. Please choose a different location."));
}
m_projectPath->setErrorLabelVisible(!projectPathIsValid);
return projectPathIsValid;
}
void ProjectSettingsScreen::OnProjectNameUpdated()
{
ValidateProjectName();
}
void ProjectSettingsScreen::OnProjectPathUpdated()
{
Validate();
}
bool ProjectSettingsScreen::Validate()
{
return ValidateProjectName() && ValidateProjectPath();
@@ -33,10 +33,13 @@ namespace O3DE::ProjectManager
virtual bool Validate();
protected slots:
virtual bool ValidateProjectName();
virtual bool ValidateProjectPath();
virtual void OnProjectNameUpdated();
virtual void OnProjectPathUpdated();
protected:
bool ValidateProjectName();
virtual bool ValidateProjectPath();
QString GetDefaultProjectPath();
QHBoxLayout* m_horizontalLayout;
@@ -189,7 +189,7 @@ namespace O3DE::ProjectManager
const QString copiedFileSizeString = locale.formattedDataSize(outCopiedFileSize);
const QString totalFileSizeString = locale.formattedDataSize(totalSizeToCopy);
progressDialog->setLabelText(QString("Coping file %1 of %2 (%3 of %4) ...").arg(QString::number(outNumCopiedFiles),
progressDialog->setLabelText(QString("Copying file %1 of %2 (%3 of %4) ...").arg(QString::number(outNumCopiedFiles),
QString::number(filesToCopyCount),
copiedFileSizeString,
totalFileSizeString));
@@ -646,6 +646,7 @@ namespace O3DE::ProjectManager
{
GemInfo gemInfo;
gemInfo.m_path = Py_To_String(path);
gemInfo.m_directoryLink = gemInfo.m_path;
auto data = m_manifest.attr("get_gem_json_data")(pybind11::none(), path, pyProjectPath);
if (pybind11::isinstance<pybind11::dict>(data))
@@ -661,6 +662,7 @@ namespace O3DE::ProjectManager
gemInfo.m_version = "";
gemInfo.m_requirement = Py_To_String_Optional(data, "requirements", "");
gemInfo.m_creator = Py_To_String_Optional(data, "origin", "");
gemInfo.m_documentationLink = Py_To_String_Optional(data, "documentation_url", "");
if (gemInfo.m_creator.contains("Open 3D Engine"))
{
@@ -108,10 +108,11 @@ namespace O3DE::ProjectManager
bool UpdateProjectSettingsScreen::ValidateProjectPath()
{
bool projectPathIsValid = true;
if (m_projectPath->lineEdit()->text().isEmpty())
QDir path(m_projectPath->lineEdit()->text());
if (!path.isAbsolute())
{
projectPathIsValid = false;
m_projectPath->setErrorLabelText(tr("Please provide a valid location."));
m_projectPath->setErrorLabelText(tr("Please provide an absolute path for the project location."));
}
m_projectPath->setErrorLabelVisible(!projectPathIsValid);