Merge branch 'upstream/development' into LYN-8514_AutomatedReviewServerLogChecks

This commit is contained in:
Gene Walters
2021-11-30 14:34:42 -08:00
595 changed files with 16165 additions and 11658 deletions
@@ -2610,15 +2610,8 @@ namespace AssetProcessor
{
ScopedTransaction transaction(m_databaseConnection);
const char* statementName = INSERT_NEW_LEGACYSUBID;
bool creatingNew = entry.m_subIDsEntryID == InvalidEntryId;
if (!creatingNew)
{
statementName = OVERWRITE_EXISTING_LEGACYSUBID;
}
if (creatingNew)
{
if (!s_InsertNewLegacysubidQuery.BindAndStep(*m_databaseConnection, entry.m_productPK, entry.m_subID))
@@ -274,11 +274,9 @@ namespace AssetProcessor
}
//look for the job in flight first
bool found = false;
auto foundElement = m_jobRunKeyToJobInfoMap.find(request.m_jobRunKey);
if (foundElement != m_jobRunKeyToJobInfoMap.end())
{
found = true;
jobInfo = foundElement->second;
}
else
@@ -296,7 +294,6 @@ namespace AssetProcessor
AZ_Assert(jobInfos.size() == 1, "Should only have found one jobInfo!!!");
jobInfo = AZStd::move(jobInfos[0]);
found = true;
}
if (jobInfo.m_status == JobStatus::Failed_InvalidSourceNameExceedsMaxLimit)
@@ -177,11 +177,9 @@ namespace AssetProcessor
AZ_TracePrintf(AssetProcessor::DebugChannel, "JobTrace AddNewJob(%i %s,%s,%s)\n", rcJob, rcJob->GetInputFileAbsolutePath().toUtf8().constData(), rcJob->GetPlatformInfo().m_identifier.c_str(), rcJob->GetJobKey().toUtf8().constData());
#endif
bool isPending = false;
if (rcJob->GetState() == RCJob::pending)
{
m_jobsInQueueLookup.insert(rcJob->GetElementID(), rcJob);
isPending = true;
}
endInsertRows();
}
@@ -152,7 +152,6 @@ void RCcontrollerUnitTests::RunRCControllerTests()
}
QModelIndex rcJobIndex;
int rcJobJobIndex;
QString rcJobCommand;
QString rcJobState;
@@ -172,7 +171,6 @@ void RCcontrollerUnitTests::RunRCControllerTests()
return;
}
rcJobJobIndex = rcJobListModel->data(rcJobIndex, RCJobListModel::jobIndexRole).toInt();
rcJobCommand = rcJobListModel->data(rcJobIndex, RCJobListModel::displayNameRole).toString();
rcJobState = rcJobListModel->data(rcJobIndex, RCJobListModel::stateRole).toString();
}
@@ -1,6 +1,6 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
@@ -10,6 +10,8 @@
#include <QProcessEnvironment>
#include <QDir>
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/Utils/Utils.h>
namespace O3DE::ProjectManager
@@ -68,7 +70,7 @@ namespace O3DE::ProjectManager
QProcess process;
// if the project build path is relative, it should be relative to the project path
// if the project build path is relative, it should be relative to the project path
process.setWorkingDirectory(projectPath);
process.setProgram("cmake-gui");
@@ -80,7 +82,7 @@ namespace O3DE::ProjectManager
return AZ::Success();
}
AZ::Outcome<QString, QString> RunGetPythonScript(const QString& engineRoot)
{
return ExecuteCommandResultModalDialog(
@@ -89,9 +91,53 @@ namespace O3DE::ProjectManager
QObject::tr("Running get_python script..."));
}
AZ::IO::FixedMaxPath GetEditorDirectory()
AZ::IO::FixedMaxPath GetEditorExecutablePath(const AZ::IO::PathView& projectPath)
{
return AZ::Utils::GetExecutableDirectory();
AZ::IO::FixedMaxPath editorPath;
AZ::IO::FixedMaxPath fixedProjectPath{ projectPath };
// First attempt to launch the Editor.exe within the project build directory if it exists
AZ::IO::FixedMaxPath buildPathSetregPath = fixedProjectPath
/ AZ::SettingsRegistryInterface::DevUserRegistryFolder
/ "Platform" / AZ_TRAIT_OS_PLATFORM_CODENAME / "build_path.setreg";
if (AZ::IO::SystemFile::Exists(buildPathSetregPath.c_str()))
{
AZ::SettingsRegistryImpl settingsRegistry;
// Merge the build_path.setreg into the local SettingsRegistry instance
if (AZ::IO::FixedMaxPath projectBuildPath;
settingsRegistry.MergeSettingsFile(buildPathSetregPath.Native(),
AZ::SettingsRegistryInterface::Format::JsonMergePatch)
&& settingsRegistry.Get(projectBuildPath.Native(), AZ::SettingsRegistryMergeUtils::ProjectBuildPath))
{
// local Settings Registry will be used to merge the build_path.setreg for the supplied projectPath
AZ::IO::FixedMaxPath buildConfigurationPath = (fixedProjectPath / projectBuildPath).LexicallyNormal();
// First try <project-build-path>/bin/$<CONFIG> and if that path doesn't exist
// try <project-build-path>/bin/$<PLATFORM>/$<CONFIG>
buildConfigurationPath /= "bin";
if (editorPath = (buildConfigurationPath / AZ_BUILD_CONFIGURATION_TYPE / "Editor").
ReplaceExtension(AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
AZ::IO::SystemFile::Exists(editorPath.c_str()))
{
return editorPath;
}
else if (editorPath = (buildConfigurationPath / AZ_TRAIT_OS_PLATFORM_CODENAME
/ AZ_BUILD_CONFIGURATION_TYPE / "Editor").
ReplaceExtension(AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
AZ::IO::SystemFile::Exists(editorPath.c_str()))
{
return editorPath;
}
}
}
// Fall back to checking if an Editor exists in O3DE executable directory
editorPath = AZ::IO::FixedMaxPath(AZ::Utils::GetExecutableDirectory()) / "Editor";
editorPath.ReplaceExtension(AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
if (AZ::IO::SystemFile::Exists(editorPath.c_str()))
{
return editorPath;
}
return {};
}
AZ::Outcome<QString, QString> CreateDesktopShortcut([[maybe_unused]] const QString& filename, [[maybe_unused]] const QString& targetPath, [[maybe_unused]] const QStringList& arguments)
@@ -1,6 +1,6 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
@@ -11,8 +11,9 @@
#include <QStandardPaths>
#include <QDir>
#include <AzCore/Utils/Utils.h>
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/Utils/Utils.h>
namespace O3DE::ProjectManager
{
@@ -21,7 +22,7 @@ namespace O3DE::ProjectManager
AZ::Outcome<void, QString> SetupCommandLineProcessEnvironment()
{
// For CMake on Mac, if its installed through home-brew, then it will be installed
// under /usr/local/bin, which may not be in the system PATH environment.
// under /usr/local/bin, which may not be in the system PATH environment.
// Add that path for the command line process so that it will be able to locate
// a home-brew installed version of CMake
QString pathEnv = qEnvironmentVariable("PATH");
@@ -73,11 +74,11 @@ namespace O3DE::ProjectManager
return AZ::Success(xcodeBuilderVersionNumber);
}
}
AZ::Outcome<void, QString> OpenCMakeGUI(const QString& projectPath)
{
const QString cmakeHelp = QObject::tr("Please verify you've installed CMake.app from "
const QString cmakeHelp = QObject::tr("Please verify you've installed CMake.app from "
"<a href=\"https://cmake.org\">cmake.org</a> or, if using HomeBrew, "
"have installed it with <pre>brew install --cask cmake</pre>");
QString cmakeAppPath = QStandardPaths::locate(QStandardPaths::ApplicationsLocation, "CMake.app", QStandardPaths::LocateDirectory);
@@ -95,7 +96,7 @@ namespace O3DE::ProjectManager
QProcess process;
// if the project build path is relative, it should be relative to the project path
// if the project build path is relative, it should be relative to the project path
process.setWorkingDirectory(projectPath);
process.setProgram("open");
process.setArguments({"-a", "CMake", "--args", "-S", projectPath, "-B", projectBuildPath});
@@ -106,7 +107,7 @@ namespace O3DE::ProjectManager
return AZ::Success();
}
AZ::Outcome<QString, QString> RunGetPythonScript(const QString& engineRoot)
{
return ExecuteCommandResultModalDialog(
@@ -115,30 +116,74 @@ namespace O3DE::ProjectManager
QObject::tr("Running get_python script..."));
}
AZ::IO::FixedMaxPath GetEditorDirectory()
AZ::IO::FixedMaxPath GetEditorExecutablePath(const AZ::IO::PathView& projectPath)
{
AZ::IO::FixedMaxPath executableDirectory = AZ::Utils::GetExecutableDirectory();
AZ::IO::FixedMaxPath editorPath{ executableDirectory };
editorPath /= "../../../Editor.app/Contents/MacOS";
editorPath = editorPath.LexicallyNormal();
if (!AZ::IO::SystemFile::IsDirectory(editorPath.c_str()))
AZ::IO::FixedMaxPath editorPath;
AZ::IO::FixedMaxPath fixedProjectPath{ projectPath };
// First attempt to launch the Editor.exe within the project build directory if it exists
AZ::IO::FixedMaxPath buildPathSetregPath = fixedProjectPath
/ AZ::SettingsRegistryInterface::DevUserRegistryFolder
/ "Platform" / AZ_TRAIT_OS_PLATFORM_CODENAME / "build_path.setreg";
if (AZ::IO::SystemFile::Exists(buildPathSetregPath.c_str()))
{
AZ::SettingsRegistryImpl localRegistry;
// Merge the build_path.setreg into the local SettingsRegistry instance
if (AZ::IO::FixedMaxPath projectBuildPath;
localRegistry.MergeSettingsFile(buildPathSetregPath.Native(),
AZ::SettingsRegistryInterface::Format::JsonMergePatch)
&& localRegistry.Get(projectBuildPath.Native(), AZ::SettingsRegistryMergeUtils::ProjectBuildPath))
{
// local Settings Registry will be used to merge the build_path.setreg for the supplied projectPath
AZ::IO::FixedMaxPath buildConfigurationPath = (fixedProjectPath / projectBuildPath).LexicallyNormal();
// First try "<project-build-path>/bin/$<CONFIG>/Editor.app/Contents/MacOS"
// Followed by "<project-build-path>/bin/$<PLATFORM>/$<CONFIG>/Editor.app/Contents/MacOS"
// Directory existence is checked in this case
buildConfigurationPath /= "bin";
if (editorPath = (buildConfigurationPath
/ AZ_BUILD_CONFIGURATION_TYPE / "Editor.app/Contents/MacOS/Editor");
AZ::IO::SystemFile::Exists(editorPath.c_str()))
{
return editorPath;
}
else if (editorPath = (buildConfigurationPath / AZ_TRAIT_OS_PLATFORM_CODENAME
/ AZ_BUILD_CONFIGURATION_TYPE / "Editor.app/Contents/MacOS/Editor");
AZ::IO::SystemFile::Exists(editorPath.c_str()))
{
return editorPath;
}
}
}
// Fall back to locating the Editor.app bundle which should exists
// outside of the current O3DE.app bundle
editorPath = (AZ::IO::FixedMaxPath(AZ::Utils::GetExecutableDirectory()) /
"../../../Editor.app/Contents/MacOS/Editor").LexicallyNormal();
if (!AZ::IO::SystemFile::Exists(editorPath.c_str()))
{
// Attempt to search the O3DE.app global settings registry for an InstalledBinaryFolder
// key which indicates the relative path to an SDK binary directory on MacOS
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
{
if (AZ::IO::FixedMaxPath installedBinariesPath;
settingsRegistry->Get(installedBinariesPath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_InstalledBinaryFolder))
settingsRegistry->Get(installedBinariesPath.Native(),
AZ::SettingsRegistryMergeUtils::FilePathKey_InstalledBinaryFolder))
{
if (AZ::IO::FixedMaxPath engineRootFolder;
settingsRegistry->Get(engineRootFolder.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder))
settingsRegistry->Get(engineRootFolder.Native(),
AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder))
{
editorPath = engineRootFolder / installedBinariesPath / "Editor.app/Contents/MacOS";
editorPath = engineRootFolder / installedBinariesPath / "Editor.app/Contents/MacOS/Editor";
}
}
}
if (!AZ::IO::SystemFile::IsDirectory(editorPath.c_str()))
if (!AZ::IO::SystemFile::Exists(editorPath.c_str()))
{
AZ_Error("ProjectManager", false, "Unable to find the Editor app bundle!");
return {};
}
}
@@ -9,7 +9,7 @@
namespace O3DE::ProjectManager
{
const QString ProjectBuildPathPostfix = ProjectBuildDirectoryName + "/windows_vs2019";
const QString ProjectBuildPathPostfix = ProjectBuildDirectoryName + "/windows";
const QString GetPythonScriptPath = "python/get_python.bat";
} // namespace O3DE::ProjectManager
@@ -1,6 +1,6 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
@@ -15,6 +15,8 @@
#include <QProcessEnvironment>
#include <QStandardPaths>
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/Utils/Utils.h>
namespace O3DE::ProjectManager
@@ -27,7 +29,7 @@ namespace O3DE::ProjectManager
auto engineInfoResult = PythonBindingsInterface::Get()->GetEngineInfo();
if (!engineInfoResult.IsSuccess())
{
return AZ::Failure(QObject::tr("Failed to get engine info"));
return AZ::Failure(QObject::tr("Failed to get engine info"));
}
auto engineInfo = engineInfoResult.GetValue();
@@ -52,7 +54,7 @@ namespace O3DE::ProjectManager
AZ::Outcome<QString, QString> FindSupportedCompilerForPlatform()
{
// Validate that cmake is installed
// Validate that cmake is installed
auto cmakeProcessEnvResult = SetupCommandLineProcessEnvironment();
if (!cmakeProcessEnvResult.IsSuccess())
{
@@ -109,7 +111,7 @@ namespace O3DE::ProjectManager
" or update to a newer version before proceeding to the next step."
" While installing configure Visual Studio with these <a href='https://o3de.org/docs/welcome-guide/setup/requirements/#visual-studio-configuration'>workloads</a>."));
}
AZ::Outcome<void, QString> OpenCMakeGUI(const QString& projectPath)
{
AZ::Outcome processEnvResult = SetupCommandLineProcessEnvironment();
@@ -127,7 +129,7 @@ namespace O3DE::ProjectManager
QProcess process;
// if the project build path is relative, it should be relative to the project path
// if the project build path is relative, it should be relative to the project path
process.setWorkingDirectory(projectPath);
process.setProgram("cmake-gui");
@@ -149,9 +151,53 @@ namespace O3DE::ProjectManager
QObject::tr("Running get_python script..."));
}
AZ::IO::FixedMaxPath GetEditorDirectory()
AZ::IO::FixedMaxPath GetEditorExecutablePath(const AZ::IO::PathView& projectPath)
{
return AZ::Utils::GetExecutableDirectory();
AZ::IO::FixedMaxPath editorPath;
AZ::IO::FixedMaxPath fixedProjectPath{ projectPath };
// First attempt to launch the Editor.exe within the project build directory if it exists
AZ::IO::FixedMaxPath buildPathSetregPath = fixedProjectPath
/ AZ::SettingsRegistryInterface::DevUserRegistryFolder
/ "Platform" / AZ_TRAIT_OS_PLATFORM_CODENAME / "build_path.setreg";
if (AZ::IO::SystemFile::Exists(buildPathSetregPath.c_str()))
{
AZ::SettingsRegistryImpl settingsRegistry;
// Merge the build_path.setreg into the local SettingsRegistry instance
if (AZ::IO::FixedMaxPath projectBuildPath;
settingsRegistry.MergeSettingsFile(buildPathSetregPath.Native(),
AZ::SettingsRegistryInterface::Format::JsonMergePatch)
&& settingsRegistry.Get(projectBuildPath.Native(), AZ::SettingsRegistryMergeUtils::ProjectBuildPath))
{
// local Settings Registry will be used to merge the build_path.setreg for the supplied projectPath
AZ::IO::FixedMaxPath buildConfigurationPath = (fixedProjectPath / projectBuildPath).LexicallyNormal();
// First try <project-build-path>/bin/$<CONFIG> and if that path doesn't exist
// try <project-build-path>/bin/$<PLATFORM>/$<CONFIG>
buildConfigurationPath /= "bin";
if (editorPath = (buildConfigurationPath / AZ_BUILD_CONFIGURATION_TYPE / "Editor").
ReplaceExtension(AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
AZ::IO::SystemFile::Exists(editorPath.c_str()))
{
return editorPath;
}
else if (editorPath = (buildConfigurationPath / AZ_TRAIT_OS_PLATFORM_CODENAME
/ AZ_BUILD_CONFIGURATION_TYPE / "Editor").
ReplaceExtension(AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
AZ::IO::SystemFile::Exists(editorPath.c_str()))
{
return editorPath;
}
}
}
// Fall back to checking if an Editor exists in O3DE executable directory
editorPath = AZ::IO::FixedMaxPath(AZ::Utils::GetExecutableDirectory()) / "Editor";
editorPath.ReplaceExtension(AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
if (AZ::IO::SystemFile::Exists(editorPath.c_str()))
{
return editorPath;
}
return {};
}
AZ::Outcome<QString, QString> CreateDesktopShortcut(const QString& filename, const QString& targetPath, const QStringList& arguments)
@@ -232,6 +232,11 @@ QTabBar::tab:focus {
stop: 0 #555555, stop: 1.0 #777777);
}
#dialogSubTitle {
font-size:14px;
font-weight:600;
}
#horizontalSeparatingLine {
color: #666666;
}
@@ -604,11 +609,6 @@ QProgressBar::chunk {
stop: 0 #951D1F, stop: 1.0 #C92724);
}
#gemCatalogDialogSubTitle {
font-size:14px;
font-weight:600;
}
/************** Filter Tag widget **************/
#FilterTagWidgetTextLabel {
@@ -0,0 +1,98 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <ExternalLinkDialog.h>
#include <LinkWidget.h>
#include <ProjectManagerSettings.h>
#include <AzCore/Settings/SettingsRegistry.h>
#include <QDialogButtonBox>
#include <QLabel>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QVariant>
#include <QIcon>
#include <QCheckBox>
namespace O3DE::ProjectManager
{
ExternalLinkDialog::ExternalLinkDialog(const QUrl& url, QWidget* parent)
: QDialog(parent)
{
setWindowTitle(tr("Leaving O3DE"));
setObjectName("ExternalLinkDialog");
setAttribute(Qt::WA_DeleteOnClose);
setModal(true);
QHBoxLayout* hLayout = new QHBoxLayout();
hLayout->setMargin(30);
hLayout->setAlignment(Qt::AlignTop);
setLayout(hLayout);
QVBoxLayout* warningLayout = new QVBoxLayout();
warningLayout->setMargin(0);
warningLayout->setAlignment(Qt::AlignTop);
hLayout->addLayout(warningLayout);
QLabel* warningIcon = new QLabel(this);
warningIcon->setPixmap(QIcon(":/Warning.svg").pixmap(32, 32));
warningLayout->addWidget(warningIcon);
warningLayout->addStretch();
QVBoxLayout* layout = new QVBoxLayout();
layout->setMargin(0);
layout->setAlignment(Qt::AlignTop);
hLayout->addLayout(layout);
// Body
QLabel* subTitleLabel = new QLabel(tr("You are about to leave O3DE Project Manager to visit an external link."));
subTitleLabel->setObjectName("dialogSubTitle");
layout->addWidget(subTitleLabel);
layout->addSpacing(10);
QLabel* bodyLabel = new QLabel(tr("If you trust this source, you can proceed to this link, or click \"Cancel\" to return."));
layout->addWidget(bodyLabel);
// Don't actually set linkUrl we are just using LinkLabel superficially here
LinkLabel* linkLabel = new LinkLabel(url.toString(), {}, 12);
layout->addWidget(linkLabel);
layout->addSpacing(40);
QCheckBox* skipDialogCheckbox = new QCheckBox(tr("Do not show this again"));
layout->addWidget(skipDialogCheckbox);
connect(skipDialogCheckbox, &QCheckBox::stateChanged, this, &ExternalLinkDialog::SetSkipDialogSetting);
// Buttons
QDialogButtonBox* dialogButtons = new QDialogButtonBox();
dialogButtons->setObjectName("footer");
layout->addWidget(dialogButtons);
QPushButton* cancelButton = dialogButtons->addButton(tr("Cancel"), QDialogButtonBox::RejectRole);
cancelButton->setProperty("secondary", true);
QPushButton* acceptButton = dialogButtons->addButton(tr("Proceed"), QDialogButtonBox::ApplyRole);
connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
connect(acceptButton, &QPushButton::clicked, this, &QDialog::accept);
}
void ExternalLinkDialog::SetSkipDialogSetting(bool state)
{
auto settingsRegistry = AZ::SettingsRegistry::Get();
if (settingsRegistry)
{
QString settingsKey = GetExternalLinkWarningKey();
settingsRegistry->Set(settingsKey.toStdString().c_str(), state);
SaveProjectManagerSettings();
}
}
} // namespace O3DE::ProjectManager
@@ -0,0 +1,28 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <QDialog>
#endif
namespace O3DE::ProjectManager
{
class ExternalLinkDialog
: public QDialog
{
Q_OBJECT // AUTOMOC
public:
explicit ExternalLinkDialog(const QUrl& url, QWidget* parent = nullptr);
~ExternalLinkDialog() = default;
private slots:
void SetSkipDialogSetting(bool state);
};
} // namespace O3DE::ProjectManager
@@ -31,7 +31,7 @@ namespace O3DE::ProjectManager
// Body
QLabel* subTitleLabel = new QLabel(tr("Are you sure you want to uninstall %1?").arg(gemName));
subTitleLabel->setObjectName("gemCatalogDialogSubTitle");
subTitleLabel->setObjectName("dialogSubTitle");
layout->addWidget(subTitleLabel);
layout->addSpacing(10);
@@ -32,7 +32,7 @@ namespace O3DE::ProjectManager
// Body
QLabel* subTitleLabel = new QLabel(tr("%1 to the latest version of %2?").arg(
updateAvaliable ? tr("Update") : tr("Force update"), gemName));
subTitleLabel->setObjectName("gemCatalogDialogSubTitle");
subTitleLabel->setObjectName("dialogSubTitle");
layout->addWidget(subTitleLabel);
layout->addSpacing(10);
@@ -7,6 +7,11 @@
*/
#include <LinkWidget.h>
#include <ExternalLinkDialog.h>
#include <ProjectManagerSettings.h>
#include <AzCore/Settings/SettingsRegistry.h>
#include <QDesktopServices>
#include <QEvent>
#include <QMouseEvent>
@@ -26,7 +31,29 @@ namespace O3DE::ProjectManager
{
if (m_url.isValid())
{
QDesktopServices::openUrl(m_url);
// Check if user request not to be shown external link warning dialog
bool skipDialog = false;
auto settingsRegistry = AZ::SettingsRegistry::Get();
if (settingsRegistry)
{
QString settingsKey = GetExternalLinkWarningKey();
settingsRegistry->Get(skipDialog, settingsKey.toStdString().c_str());
}
if (!skipDialog)
{
// Style does not apply if LinkLabel is parent so use parentWidget as parent instead
ExternalLinkDialog* linkDialog = new ExternalLinkDialog(m_url.toString(), parentWidget());
if (linkDialog->exec() == QDialog::Accepted)
{
QDesktopServices::openUrl(m_url);
}
}
else
{
QDesktopServices::openUrl(m_url);
}
}
emit clicked();
@@ -215,9 +215,7 @@ namespace O3DE::ProjectManager
#if AZ_TRAIT_PROJECT_MANAGER_CREATE_DESKTOP_SHORTCUT
menu->addAction(tr("Create Editor desktop shortcut..."), this, [this]()
{
AZ::IO::FixedMaxPath executableDirectory = ProjectUtils::GetEditorDirectory();
AZStd::string executableFilename = "Editor";
AZ::IO::FixedMaxPath editorExecutablePath = executableDirectory / (executableFilename + AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
AZ::IO::FixedMaxPath editorExecutablePath = ProjectUtils::GetEditorExecutablePath(m_projectInfo.m_path.toUtf8().constData());
const QString shortcutName = QString("%1 Editor").arg(m_projectInfo.m_displayName);
const QString arg = QString("--regset=\"/Amazon/AzCore/Bootstrap/project_path=%1\"").arg(m_projectInfo.m_path);
@@ -6,7 +6,7 @@
*
*/
#include "ProjectManagerSettings.h"
#include <ProjectManagerSettings.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/IO/ByteContainerStream.h>
@@ -51,4 +51,9 @@ namespace O3DE::ProjectManager
{
return QString("%1/Projects/%2/BuiltSuccessfully").arg(ProjectManagerKeyPrefix).arg(projectName);
}
QString GetExternalLinkWarningKey()
{
return QString("%1/SkipExternalLinkWarning").arg(ProjectManagerKeyPrefix);
}
}
@@ -18,4 +18,5 @@ namespace O3DE::ProjectManager
void SaveProjectManagerSettings();
QString GetProjectBuiltSuccessfullyKey(const QString& projectName);
QString GetExternalLinkWarningKey();
}
@@ -76,7 +76,27 @@ namespace O3DE::ProjectManager
*/
AZ::Outcome<QString, QString> CreateDesktopShortcut(const QString& filename, const QString& targetPath, const QStringList& arguments);
AZ::IO::FixedMaxPath GetEditorDirectory();
/**
* Lookup the location of an Editor executable executable that can be used with the
* supplied project path
* First the method attempts to locate a build directory with the project path
* via querying the <project-path>/user/Registry/Platform/<platform>/build_path.setreg
* Once that is done a path is formed to locate the Editor executable within the that build
* directory.
* Two paths will checked for the existence of an Editor
* - "<project-build-directory>/bin/$<CONFIG>/Editor"
* - "<project-build-directory>/bin/<platform>/$<CONFIG>/Editor"
* Where <platform> is the current platform the O3DE executable is running on and $<CONFIG> is the
* current build configuration the O3DE executable
*
* If neiether of the above paths contain an Editor application, then a path to the Editor
* is formed by combinding the O3DE executable directory with the filename of Editor
* - "<executable-directory>/Editor"
*
* @param projectPath Path to the root of the project
* @return path of the Editor Executable if found or an empty path if not
*/
AZ::IO::FixedMaxPath GetEditorExecutablePath(const AZ::IO::PathView& projectPath);
} // namespace ProjectUtils
} // namespace O3DE::ProjectManager
@@ -23,7 +23,6 @@
#include <AzFramework/Process/ProcessCommon.h>
#include <AzFramework/Process/ProcessWatcher.h>
#include <AzCore/Utils/Utils.h>
#include <AzCore/Settings/SettingsRegistry.h>
#include <QVBoxLayout>
#include <QHBoxLayout>
@@ -408,18 +407,26 @@ namespace O3DE::ProjectManager
emit ChangeScreenRequest(ProjectManagerScreen::Projects);
}
}
void ProjectsScreen::HandleOpenProject(const QString& projectPath)
{
if (!projectPath.isEmpty())
{
if (!WarnIfInBuildQueue(projectPath))
{
AZ::IO::FixedMaxPath executableDirectory = ProjectUtils::GetEditorDirectory();
AZStd::string executableFilename = "Editor";
AZ::IO::FixedMaxPath editorExecutablePath = executableDirectory / (executableFilename + AZ_TRAIT_OS_EXECUTABLE_EXTENSION);
AZ::IO::FixedMaxPath fixedProjectPath = projectPath.toUtf8().constData();
AZ::IO::FixedMaxPath editorExecutablePath = ProjectUtils::GetEditorExecutablePath(fixedProjectPath);
if (editorExecutablePath.empty())
{
AZ_Error("ProjectManager", false, "Failed to locate editor");
QMessageBox::critical(
this, tr("Error"), tr("Failed to locate the Editor, please verify that it is built."));
return;
}
auto cmdPath = AZ::IO::FixedMaxPathString::format(
"%s --regset=\"/Amazon/AzCore/Bootstrap/project_path=%s\"", editorExecutablePath.c_str(),
projectPath.toStdString().c_str());
fixedProjectPath.c_str());
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
processLaunchInfo.m_commandlineParameters = cmdPath;
@@ -78,6 +78,8 @@ set(FILES
Source/TagWidget.cpp
Source/TemplateButtonWidget.h
Source/TemplateButtonWidget.cpp
Source/ExternalLinkDialog.h
Source/ExternalLinkDialog.cpp
Source/GemCatalog/GemCatalogHeaderWidget.h
Source/GemCatalog/GemCatalogHeaderWidget.cpp
Source/GemCatalog/GemCatalogScreen.h