ProjectManagerWindow.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. * its licensors.
  4. *
  5. * For complete copyright and license terms please see the LICENSE at the root of this
  6. * distribution (the "License"). All use of this software is governed by the License,
  7. * or, if provided, by the license below or the license accompanying this file. Do not
  8. * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. *
  11. */
  12. #include <ProjectManagerWindow.h>
  13. #include <ScreenFactory.h>
  14. #include <AzQtComponents/Components/StyleManager.h>
  15. #include <AzCore/IO/Path/Path.h>
  16. #include <QDir>
  17. #include <Source/ui_ProjectManagerWindow.h>
  18. namespace O3DE::ProjectManager
  19. {
  20. ProjectManagerWindow::ProjectManagerWindow(QWidget* parent, const AZ::IO::PathView& engineRootPath)
  21. : QMainWindow(parent)
  22. , m_ui(new Ui::ProjectManagerWindowClass())
  23. {
  24. m_ui->setupUi(this);
  25. m_pythonBindings = AZStd::make_unique<PythonBindings>(engineRootPath);
  26. m_screensCtrl = new ScreensCtrl();
  27. m_ui->verticalLayout->addWidget(m_screensCtrl);
  28. connect(m_ui->projectsMenu, &QMenu::aboutToShow, this, &ProjectManagerWindow::HandleProjectsMenu);
  29. connect(m_ui->engineMenu, &QMenu::aboutToShow, this, &ProjectManagerWindow::HandleEngineMenu);
  30. QDir rootDir = QString::fromUtf8(engineRootPath.Native().data(), aznumeric_cast<int>(engineRootPath.Native().size()));
  31. const auto pathOnDisk = rootDir.absoluteFilePath("Code/Tools/ProjectManager/Resources");
  32. const auto qrcPath = QStringLiteral(":/ProjectManagerWindow");
  33. AzQtComponents::StyleManager::addSearchPaths("projectmanagerwindow", pathOnDisk, qrcPath, engineRootPath);
  34. AzQtComponents::StyleManager::setStyleSheet(this, QStringLiteral("projectlauncherwindow:ProjectManagerWindow.qss"));
  35. QVector<ProjectManagerScreen> screenEnums =
  36. {
  37. ProjectManagerScreen::FirstTimeUse,
  38. ProjectManagerScreen::NewProjectSettingsCore,
  39. ProjectManagerScreen::ProjectsHome,
  40. ProjectManagerScreen::ProjectSettings,
  41. ProjectManagerScreen::EngineSettings
  42. };
  43. m_screensCtrl->BuildScreens(screenEnums);
  44. m_screensCtrl->ForceChangeToScreen(ProjectManagerScreen::FirstTimeUse, false);
  45. }
  46. ProjectManagerWindow::~ProjectManagerWindow()
  47. {
  48. m_pythonBindings.reset();
  49. }
  50. void ProjectManagerWindow::HandleProjectsMenu()
  51. {
  52. m_screensCtrl->ChangeToScreen(ProjectManagerScreen::ProjectsHome);
  53. }
  54. void ProjectManagerWindow::HandleEngineMenu()
  55. {
  56. m_screensCtrl->ChangeToScreen(ProjectManagerScreen::EngineSettings);
  57. }
  58. } // namespace O3DE::ProjectManager