diff --git a/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.cpp b/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.cpp index 4c306fc715..f1f56993ca 100644 --- a/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.cpp +++ b/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.cpp @@ -43,11 +43,9 @@ namespace O3DE::ProjectManager { const QString defaultName = GetDefaultProjectName(); const QString defaultPath = QDir::toNativeSeparators(GetDefaultProjectPath() + "/" + defaultName); - const QString randomUuid = GenerateNewProjectId(); m_projectName->lineEdit()->setText(defaultName); m_projectPath->lineEdit()->setText(defaultPath); - m_projectId->lineEdit()->setText(randomUuid); // if we don't use a QFrame we cannot "contain" the widgets inside and move them around // as a group @@ -177,14 +175,6 @@ namespace O3DE::ProjectManager return QDir::toNativeSeparators(GetDefaultProjectPath() + "/" + projectName); } - QString NewProjectSettingsScreen::GenerateNewProjectId() - { - AZStd::string uuid; - AZ::Uuid::CreateRandom().ToString(uuid); - - return QString(uuid.c_str()); - } - ProjectManagerScreen NewProjectSettingsScreen::GetScreenEnum() { return ProjectManagerScreen::NewProjectSettings; diff --git a/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.h b/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.h index cfb215ba0c..42c47cb1ff 100644 --- a/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.h +++ b/Code/Tools/ProjectManager/Source/NewProjectSettingsScreen.h @@ -47,7 +47,6 @@ namespace O3DE::ProjectManager private: QString GetDefaultProjectName(); QString GetDefaultProjectPath(); - QString GenerateNewProjectId(); QString GetProjectAutoPath(); QFrame* CreateTemplateDetails(int margin); void UpdateTemplateDetails(const ProjectTemplateInfo& templateInfo); diff --git a/Code/Tools/ProjectManager/Source/ProjectSettingsScreen.cpp b/Code/Tools/ProjectManager/Source/ProjectSettingsScreen.cpp index cf15cb5bbc..45023d7f80 100644 --- a/Code/Tools/ProjectManager/Source/ProjectSettingsScreen.cpp +++ b/Code/Tools/ProjectManager/Source/ProjectSettingsScreen.cpp @@ -60,10 +60,6 @@ namespace O3DE::ProjectManager connect(m_projectPath->lineEdit(), &QLineEdit::textChanged, this, &ProjectSettingsScreen::OnProjectPathUpdated); m_verticalLayout->addWidget(m_projectPath); - m_projectId = new FormLineEditWidget(tr("Project ID"), "", this); - connect(m_projectId->lineEdit(), &QLineEdit::textChanged, this, &ProjectSettingsScreen::OnProjectIdUpdated); - m_verticalLayout->addWidget(m_projectId); - projectSettingsFrame->setLayout(m_verticalLayout); m_horizontalLayout->addWidget(projectSettingsFrame); @@ -98,7 +94,6 @@ namespace O3DE::ProjectManager // currently we don't have separate fields for changing the project name and display name projectInfo.m_displayName = projectInfo.m_projectName; projectInfo.m_path = m_projectPath->lineEdit()->text(); - projectInfo.m_id = m_projectId->lineEdit()->text(); return projectInfo; } @@ -147,19 +142,6 @@ namespace O3DE::ProjectManager return projectPathIsValid; } - bool ProjectSettingsScreen::ValidateProjectId() - { - bool projectIdIsValid = true; - if (m_projectId->lineEdit()->text().isEmpty()) - { - projectIdIsValid = false; - m_projectId->setErrorLabelText(tr("Project ID cannot be empty.")); - } - - m_projectId->setErrorLabelVisible(!projectIdIsValid); - return projectIdIsValid; - } - void ProjectSettingsScreen::OnProjectNameUpdated() { ValidateProjectName(); @@ -170,13 +152,8 @@ namespace O3DE::ProjectManager ValidateProjectName() && ValidateProjectPath(); } - void ProjectSettingsScreen::OnProjectIdUpdated() - { - ValidateProjectId(); - } - bool ProjectSettingsScreen::Validate() { - return ValidateProjectName() && ValidateProjectPath() && ValidateProjectId(); + return ValidateProjectName() && ValidateProjectPath(); } } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/ProjectSettingsScreen.h b/Code/Tools/ProjectManager/Source/ProjectSettingsScreen.h index 928cde833e..752e286ce1 100644 --- a/Code/Tools/ProjectManager/Source/ProjectSettingsScreen.h +++ b/Code/Tools/ProjectManager/Source/ProjectSettingsScreen.h @@ -35,12 +35,10 @@ namespace O3DE::ProjectManager protected slots: virtual void OnProjectNameUpdated(); virtual void OnProjectPathUpdated(); - virtual void OnProjectIdUpdated(); protected: bool ValidateProjectName(); virtual bool ValidateProjectPath(); - bool ValidateProjectId(); QString GetDefaultProjectPath(); @@ -48,7 +46,6 @@ namespace O3DE::ProjectManager QVBoxLayout* m_verticalLayout; FormLineEditWidget* m_projectName; FormBrowseEditWidget* m_projectPath; - FormLineEditWidget* m_projectId; }; } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index 8d11028af6..2ae0e3450c 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -688,24 +688,8 @@ namespace O3DE::ProjectManager auto createProjectResult = m_engineTemplate.attr("create_project")( projectPath, QString_To_Py_String(projectInfo.m_projectName), // project_path - QString_To_Py_Path(projectTemplatePath), // template_path - pybind11::none(), // template_name - pybind11::none(), // project_restricted_path - pybind11::none(), // project_restricted_name - pybind11::none(), // template_restricted_path - pybind11::none(), // template_restricted_name - pybind11::none(), // project_restricted_platform_relative_path - pybind11::none(), // template_restricted_platform_relative_path - pybind11::none(), // keep_restricted_in_project - pybind11::none(), // keep_license_text - pybind11::none(), // replace - pybind11::none(), // force - pybind11::none(), // no_register - pybind11::none(), // system_component_class_id - pybind11::none(), // editor_system_component_class_id - pybind11::none(), // module_id - QString_To_Py_String(projectInfo.m_id) // project_id - ); + QString_To_Py_Path(projectTemplatePath) // template_path + ); if (createProjectResult.cast() == 0) { createdProjectInfo = ProjectInfoFromPath(projectPath); diff --git a/Code/Tools/ProjectManager/Source/SettingsInterface.h b/Code/Tools/ProjectManager/Source/SettingsInterface.h index a106dedefd..e345886b9f 100644 --- a/Code/Tools/ProjectManager/Source/SettingsInterface.h +++ b/Code/Tools/ProjectManager/Source/SettingsInterface.h @@ -35,21 +35,71 @@ namespace O3DE::ProjectManager virtual bool IsInitialized() = 0; /** - * Get info about a Gem. - * @param path The absolute path to the Gem - * @param projectPath (Optional) The absolute path to the Gem project - * @return an outcome with GemInfo on success + * Get the value for a string settings key + * @param result Store string result in this variable + * @param settingsKey The key to get the value in + * @return true if all calls to settings registry were successful */ virtual bool Get(QString& result, const QString& settingsKey) = 0; + /** + * Get the value for a bool settings key + * @param result Store bool result in this variable + * @param settingsKey The key to get the value in + * @return true if all calls to settings registry were successful + */ virtual bool Get(bool& result, const QString& settingsKey) = 0; + + /** + * Set the value for a string settings key + * @param settingsKey The key to set the value in + * @param settingsValue String value to set key to + * @return true if all calls to settings registry were successful + */ virtual bool Set(const QString& settingsKey, const QString& settingsValue) = 0; + /** + * Set the value for a bool settings key + * @param settingsKey The key to set the value in + * @param settingsValue Bool value to set key to + * @return true if all calls to settings registry were successful + */ virtual bool Set(const QString& settingsKey, bool settingsValue) = 0; + + /** + * Remove settings key + * @param settingsKey The key to remove + * @return true if all calls to settings registry were successful + */ virtual bool Remove(const QString& settingsKey) = 0; + + /** + * Copy the string settings value from one key to another + * @param settingsKeyOrig The original key to copy from + * @param settingsKeyDest The destination key to copy to + * @param removeOrig(Optional) Delete the original key if true + * @return true if all calls to settings registry were successful + */ virtual bool Copy(const QString& settingsKeyOrig, const QString& settingsKeyDest, bool removeOrig = false) = 0; + /** + * Generate prefix for project settings key + * @param projectInfo Project for settings key + * @return QString Prefix for project specific settings key + */ virtual QString GetProjectKey(const ProjectInfo& projectInfo) = 0; + /** + * Get the build status for a project + * @param result Store bool build status in this variable + * @param projectInfo Project to check built status for + * @return true if all calls to settings registry were successful + */ virtual bool GetProjectBuiltSuccessfully(bool& result, const ProjectInfo& projectInfo) = 0; + /** + * Set the build status for a project + * @param projectInfo Project to set built status for + * @param successfullyBuilt Bool value to set build status to + * @return true if all calls to settings registry were successful + */ virtual bool SetProjectBuiltSuccessfully(const ProjectInfo& projectInfo, bool successfullyBuilt) = 0; }; diff --git a/Code/Tools/ProjectManager/Source/UpdateProjectSettingsScreen.cpp b/Code/Tools/ProjectManager/Source/UpdateProjectSettingsScreen.cpp index 7c8f981f59..8ebda6a823 100644 --- a/Code/Tools/ProjectManager/Source/UpdateProjectSettingsScreen.cpp +++ b/Code/Tools/ProjectManager/Source/UpdateProjectSettingsScreen.cpp @@ -45,6 +45,10 @@ namespace O3DE::ProjectManager previewExtrasLayout->addWidget(m_projectPreviewImage); m_verticalLayout->addLayout(previewExtrasLayout); + + m_projectId = new FormLineEditWidget(tr("Project ID"), "", this); + connect(m_projectId->lineEdit(), &QLineEdit::textChanged, this, &UpdateProjectSettingsScreen::OnProjectIdUpdated); + m_verticalLayout->addWidget(m_projectId); } ProjectManagerScreen UpdateProjectSettingsScreen::GetScreenEnum() @@ -90,7 +94,7 @@ namespace O3DE::ProjectManager bool UpdateProjectSettingsScreen::Validate() { - return ProjectSettingsScreen::Validate() && ValidateProjectPreview(); + return ProjectSettingsScreen::Validate() && ValidateProjectPreview() && ValidateProjectId(); } void UpdateProjectSettingsScreen::ResetProjectPreviewPath() @@ -108,6 +112,11 @@ namespace O3DE::ProjectManager QPixmap(m_projectPreview->lineEdit()->text()).scaled(m_projectPreviewImage->size(), Qt::KeepAspectRatioByExpanding)); } + void UpdateProjectSettingsScreen::OnProjectIdUpdated() + { + ValidateProjectId(); + } + bool UpdateProjectSettingsScreen::ValidateProjectPath() { bool projectPathIsValid = true; @@ -157,4 +166,17 @@ namespace O3DE::ProjectManager return projectPreviewIsValid; } + bool UpdateProjectSettingsScreen::ValidateProjectId() + { + bool projectIdIsValid = true; + if (m_projectId->lineEdit()->text().isEmpty()) + { + projectIdIsValid = false; + m_projectId->setErrorLabelText(tr("Project ID cannot be empty.")); + } + + m_projectId->setErrorLabelVisible(!projectIdIsValid); + return projectIdIsValid; + } + } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/UpdateProjectSettingsScreen.h b/Code/Tools/ProjectManager/Source/UpdateProjectSettingsScreen.h index 22d7794de4..ba1a0a5794 100644 --- a/Code/Tools/ProjectManager/Source/UpdateProjectSettingsScreen.h +++ b/Code/Tools/ProjectManager/Source/UpdateProjectSettingsScreen.h @@ -33,13 +33,16 @@ namespace O3DE::ProjectManager public slots: void UpdateProjectPreviewPath(); void PreviewPathChanged(); + void OnProjectIdUpdated(); protected: bool ValidateProjectPath() override; virtual bool ValidateProjectPreview(); + bool ValidateProjectId(); FormBrowseEditWidget* m_projectPreview; QLabel* m_projectPreviewImage; + FormLineEditWidget* m_projectId; ProjectInfo m_projectInfo; bool m_userChangedPreview; //! Did the user change the project preview path