ProjectManagerWindow.cpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 <ScreensCtrl.h>
  14. #include <AzQtComponents/Components/StyleManager.h>
  15. #include <AzCore/IO/Path/Path.h>
  16. #include <QDir>
  17. namespace O3DE::ProjectManager
  18. {
  19. ProjectManagerWindow::ProjectManagerWindow(QWidget* parent, const AZ::IO::PathView& engineRootPath)
  20. : QMainWindow(parent)
  21. {
  22. m_pythonBindings = AZStd::make_unique<PythonBindings>(engineRootPath);
  23. setWindowTitle(tr("O3DE Project Manager"));
  24. ScreensCtrl* screensCtrl = new ScreensCtrl();
  25. // currently the tab order on the home page is based on the order of this list
  26. QVector<ProjectManagerScreen> screenEnums =
  27. {
  28. ProjectManagerScreen::Projects,
  29. ProjectManagerScreen::EngineSettings,
  30. ProjectManagerScreen::CreateProject,
  31. ProjectManagerScreen::UpdateProject
  32. };
  33. screensCtrl->BuildScreens(screenEnums);
  34. setCentralWidget(screensCtrl);
  35. // setup stylesheets and hot reloading
  36. QDir rootDir = QString::fromUtf8(engineRootPath.Native().data(), aznumeric_cast<int>(engineRootPath.Native().size()));
  37. const auto pathOnDisk = rootDir.absoluteFilePath("Code/Tools/ProjectManager/Resources");
  38. const auto qrcPath = QStringLiteral(":/ProjectManager/style");
  39. AzQtComponents::StyleManager::addSearchPaths("style", pathOnDisk, qrcPath, engineRootPath);
  40. // set stylesheet after creating the screens or their styles won't get updated
  41. AzQtComponents::StyleManager::setStyleSheet(this, QStringLiteral("style:ProjectManager.qss"));
  42. screensCtrl->ForceChangeToScreen(ProjectManagerScreen::Projects, false);
  43. }
  44. ProjectManagerWindow::~ProjectManagerWindow()
  45. {
  46. m_pythonBindings.reset();
  47. }
  48. } // namespace O3DE::ProjectManager