ProjectManagerWindow.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <ProjectManagerWindow.h>
  9. #include <PythonBindingsInterface.h>
  10. #include <ScreensCtrl.h>
  11. #include <DownloadController.h>
  12. namespace O3DE::ProjectManager
  13. {
  14. ProjectManagerWindow::ProjectManagerWindow(QWidget* parent, const AZ::IO::PathView& projectPath, ProjectManagerScreen startScreen)
  15. : QMainWindow(parent)
  16. {
  17. if (auto engineInfoOutcome = PythonBindingsInterface::Get()->GetEngineInfo(); engineInfoOutcome)
  18. {
  19. auto engineInfo = engineInfoOutcome.GetValue<EngineInfo>();
  20. auto versionToDisplay = engineInfo.m_displayVersion == "00.00" ?
  21. engineInfo.m_version : engineInfo.m_displayVersion;
  22. setWindowTitle(QString("%1 %2 %3").arg(engineInfo.m_name.toUpper(), versionToDisplay, tr("Project Manager")));
  23. }
  24. else
  25. {
  26. setWindowTitle(QString("O3DE %1").arg(tr("Project Manager")));
  27. }
  28. m_downloadController = new DownloadController(this);
  29. ScreensCtrl* screensCtrl = new ScreensCtrl(nullptr, m_downloadController);
  30. // currently the tab order on the home page is based on the order of this list
  31. QVector<ProjectManagerScreen> screenEnums =
  32. {
  33. ProjectManagerScreen::Projects,
  34. ProjectManagerScreen::CreateGem,
  35. ProjectManagerScreen::EditGem,
  36. ProjectManagerScreen::GemCatalog,
  37. ProjectManagerScreen::Engine,
  38. ProjectManagerScreen::CreateProject,
  39. ProjectManagerScreen::UpdateProject,
  40. ProjectManagerScreen::GemsGemRepos
  41. };
  42. screensCtrl->BuildScreens(screenEnums);
  43. setCentralWidget(screensCtrl);
  44. // always push the projects screen first so we have something to come back to
  45. if (startScreen != ProjectManagerScreen::Projects)
  46. {
  47. screensCtrl->ForceChangeToScreen(ProjectManagerScreen::Projects);
  48. }
  49. screensCtrl->ForceChangeToScreen(startScreen);
  50. if (!projectPath.empty())
  51. {
  52. const QString path = QString::fromUtf8(projectPath.Native().data(), aznumeric_cast<int>(projectPath.Native().size()));
  53. emit screensCtrl->NotifyCurrentProject(path);
  54. }
  55. }
  56. } // namespace O3DE::ProjectManager