|
@@ -44,6 +44,7 @@
|
|
|
#include <QQueue>
|
|
|
#include <QDir>
|
|
|
#include <QGuiApplication>
|
|
|
+#include <QFileSystemWatcher>
|
|
|
|
|
|
namespace O3DE::ProjectManager
|
|
|
{
|
|
@@ -55,6 +56,10 @@ namespace O3DE::ProjectManager
|
|
|
vLayout->setContentsMargins(s_contentMargins, 0, s_contentMargins, 0);
|
|
|
setLayout(vLayout);
|
|
|
|
|
|
+ m_fileSystemWatcher = new QFileSystemWatcher(this);
|
|
|
+ connect(m_fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, &ProjectsScreen::HandleProjectDirectoryChanged);
|
|
|
+
|
|
|
+
|
|
|
m_stack = new QStackedWidget(this);
|
|
|
|
|
|
m_firstTimeContent = CreateFirstTimeContent();
|
|
@@ -276,6 +281,7 @@ namespace O3DE::ProjectManager
|
|
|
{
|
|
|
currentButton = CreateProjectButton(project);
|
|
|
m_projectButtons.insert(QDir::toNativeSeparators(project.m_path), currentButton);
|
|
|
+ m_fileSystemWatcher->addPath(QDir::toNativeSeparators(project.m_path + '/'));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -346,6 +352,12 @@ namespace O3DE::ProjectManager
|
|
|
m_projectsFlowLayout->update();
|
|
|
}
|
|
|
|
|
|
+ void ProjectsScreen::HandleProjectDirectoryChanged(const QString& /*path*/)
|
|
|
+ {
|
|
|
+ // QFileWatcher automatically stops watching the path if it was removed so we will just refresh our view
|
|
|
+ ResetProjectsContent();
|
|
|
+ }
|
|
|
+
|
|
|
ProjectManagerScreen ProjectsScreen::GetScreenEnum()
|
|
|
{
|
|
|
return ProjectManagerScreen::Projects;
|