ProjectManagerWindow.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. // Projects is the default first screen because it is first in the above order
  45. if (startScreen != ProjectManagerScreen::Projects)
  46. {
  47. // always push the projects screen first so we have something to come back to
  48. screensCtrl->ForceChangeToScreen(ProjectManagerScreen::Projects);
  49. screensCtrl->ForceChangeToScreen(startScreen);
  50. }
  51. if (!projectPath.empty())
  52. {
  53. const QString path = QString::fromUtf8(projectPath.Native().data(), aznumeric_cast<int>(projectPath.Native().size()));
  54. emit screensCtrl->NotifyCurrentProject(path);
  55. }
  56. }
  57. } // namespace O3DE::ProjectManager