You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Code/Tools/ProjectManager/Source/ProjectsScreen.h

83 lines
2.7 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <ScreenWidget.h>
#include <ProjectInfo.h>
#include <QQueue>
#endif
QT_FORWARD_DECLARE_CLASS(QPaintEvent)
QT_FORWARD_DECLARE_CLASS(QFrame)
QT_FORWARD_DECLARE_CLASS(QStackedWidget)
QT_FORWARD_DECLARE_CLASS(QLayout)
namespace O3DE::ProjectManager
{
QT_FORWARD_DECLARE_CLASS(ProjectBuilderController);
QT_FORWARD_DECLARE_CLASS(ProjectButton);
class ProjectsScreen
: public ScreenWidget
{
public:
explicit ProjectsScreen(QWidget* parent = nullptr);
~ProjectsScreen();
ProjectManagerScreen GetScreenEnum() override;
QString GetTabText() override;
bool IsTab() override;
protected:
void NotifyCurrentScreen() override;
void ProjectBuildDone();
protected slots:
void HandleNewProjectButton();
void HandleAddProjectButton();
void HandleOpenProject(const QString& projectPath);
void HandleEditProject(const QString& projectPath);
void HandleCopyProject(const QString& projectPath);
void HandleRemoveProject(const QString& projectPath);
void HandleDeleteProject(const QString& projectPath);
void SuggestBuildProject(const ProjectInfo& projectInfo);
void QueueBuildProject(const ProjectInfo& projectInfo);
void paintEvent(QPaintEvent* event) override;
private:
QFrame* CreateFirstTimeContent();
QFrame* CreateProjectsContent(QString buildProjectPath = "", ProjectButton** projectButton = nullptr);
ProjectButton* CreateProjectButton(ProjectInfo& project, QLayout* flowLayout, bool processing = false);
void ResetProjectsContent();
bool ShouldDisplayFirstTimeContent();
void StartProjectBuild(const ProjectInfo& projectInfo);
QList<ProjectInfo>::iterator RequiresBuildProjectIterator(const QString& projectPath);
bool BuildQueueContainsProject(const QString& projectPath);
bool WarnIfInBuildQueue(const QString& projectPath);
QAction* m_createNewProjectAction = nullptr;
QAction* m_addExistingProjectAction = nullptr;
QPixmap m_background;
QFrame* m_firstTimeContent = nullptr;
QFrame* m_projectsContent = nullptr;
QStackedWidget* m_stack = nullptr;
QList<ProjectInfo> m_requiresBuild;
QQueue<ProjectInfo> m_buildQueue;
ProjectBuilderController* m_currentBuilder = nullptr;
inline constexpr static int s_contentMargins = 80;
inline constexpr static int s_spacerSize = 20;
};
} // namespace O3DE::ProjectManager