mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-06 19:12:30 +01:00
Fix installed loading being empty and loading twice
This commit is contained in:
parent
c3da8e1b95
commit
d370a78913
@ -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();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ private:
|
||||
QFileSystemWatcher m_fileSystemWatcher;
|
||||
QVector<ProjectFile> m_screenPlayFiles;
|
||||
int m_count { 0 };
|
||||
QFuture<void> m_loadContentFuture;
|
||||
std::atomic_bool m_isLoading { false };
|
||||
|
||||
const std::shared_ptr<GlobalVariables>& m_globalVariables;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user