1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Fix calling to load installed content twice

This commit is contained in:
Elias Steurer 2019-10-12 11:42:23 +02:00
parent bb5121264c
commit 08414a3d01
2 changed files with 9 additions and 14 deletions

View File

@ -293,7 +293,6 @@ Item {
textFieldTags.getTags())
savePopup.open()
ScreenPlay.installedListModel.reset()
ScreenPlay.installedListModel.loadInstalledContent()
}
}
}

View File

@ -17,7 +17,16 @@ InstalledListModel::InstalledListModel(
QObject::connect(this, &InstalledListModel::addInstalledItem,
this, &InstalledListModel::append, Qt::QueuedConnection);
}
void InstalledListModel::init()
{
if (!m_fileSystemWatcher.addPath(m_globalVariables->localStoragePath().toLocalFile())) {
qWarning() << "Could not setup file system watcher for changed files with path: " << m_globalVariables->localStoragePath().toLocalFile();
}
loadInstalledContent();
QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, &InstalledListModel::reset);
}
int InstalledListModel::rowCount(const QModelIndex& parent) const
{
if (parent.isValid())
@ -169,17 +178,4 @@ void InstalledListModel::reset()
loadInstalledContent();
}
void InstalledListModel::init()
{
if (!m_fileSystemWatcher.addPath(m_globalVariables->localStoragePath().toLocalFile())) {
qWarning() << "Could not setup file system watcher for changed files with path: " << m_globalVariables->localStoragePath().toLocalFile();
}
QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, [this](const QString& path) {
qDebug() << path;
reset();
loadInstalledContent();
});
loadInstalledContent();
}
}