diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index b7218376..5c3473e2 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -38,7 +38,7 @@ ApplicationWindow { } if (name === "Installed") { - stackView.replace("qrc:/ScreenPlay/qml/" + name + "/" + name + ".qml", { + stackView.replace("qrc:/ScreenPlay/qml/Installed/Installed.qml", { "sidebar": sidebar }) return @@ -71,7 +71,9 @@ ApplicationWindow { } Component.onCompleted: { setTheme(ScreenPlay.settings.theme); - switchPage("Installed"); + stackView.push("qrc:/ScreenPlay/qml/Installed/Installed.qml", { + "sidebar": sidebar + }) if (!ScreenPlay.settings.silentStart) root.show(); diff --git a/ScreenPlay/qml/Navigation/Navigation.qml b/ScreenPlay/qml/Navigation/Navigation.qml index af3c4310..1cc53e11 100644 --- a/ScreenPlay/qml/Navigation/Navigation.qml +++ b/ScreenPlay/qml/Navigation/Navigation.qml @@ -12,7 +12,7 @@ import "../Common" Rectangle { id: root - property string currentNavigationName: "" + property string currentNavigationName: "Installed" property var navArray: [navCreate, navWorkshop, navInstalled, navSettings, navCommunity] property bool navActive: true property ApplicationWindow window diff --git a/ScreenPlay/src/installedlistmodel.cpp b/ScreenPlay/src/installedlistmodel.cpp index f9da58a0..65ad38af 100644 --- a/ScreenPlay/src/installedlistmodel.cpp +++ b/ScreenPlay/src/installedlistmodel.cpp @@ -41,7 +41,6 @@ void InstalledListModel::init() QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, reloadLambda); QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::fileChanged, this, reloadLambda); - loadInstalledContent(); } /*! @@ -201,12 +200,12 @@ void InstalledListModel::append(const QJsonObject& obj, const QString& folderNam */ void InstalledListModel::loadInstalledContent() { - if (m_loadContentFuture.isRunning()) { + if (m_isLoading) { qInfo() << "loadInstalledContent is already running. Skip."; return; } - - m_loadContentFuture = QtConcurrent::run([this]() { + m_isLoading = true; + auto unused = QtConcurrent::run([this]() { QFileInfoList list = QDir(m_globalVariables->localStoragePath().toLocalFile()).entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs); int counter = 0; @@ -240,6 +239,7 @@ void InstalledListModel::loadInstalledContent() } setCount(counter); emit installedLoadingFinished(); + m_isLoading = false; }); } diff --git a/ScreenPlay/src/installedlistmodel.h b/ScreenPlay/src/installedlistmodel.h index c20b3476..c552675a 100644 --- a/ScreenPlay/src/installedlistmodel.h +++ b/ScreenPlay/src/installedlistmodel.h @@ -124,7 +124,7 @@ private: QFileSystemWatcher m_fileSystemWatcher; QVector m_screenPlayFiles; int m_count { 0 }; - QFuture m_loadContentFuture; + std::atomic_bool m_isLoading { false }; const std::shared_ptr& m_globalVariables; };