mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-15 06:52:34 +02:00
Workaround for working wallpaper two times
This commit is contained in:
parent
1fe810befd
commit
2dcb49366b
@ -10,7 +10,6 @@ InstalledListModel::InstalledListModel(QObject* parent)
|
|||||||
QObject::connect(&m_loadScreenWatcher, &QFutureWatcher<void>::progressValueChanged, [](int progressValue) {
|
QObject::connect(&m_loadScreenWatcher, &QFutureWatcher<void>::progressValueChanged, [](int progressValue) {
|
||||||
qDebug() << progressValue;
|
qDebug() << progressValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int InstalledListModel::rowCount(const QModelIndex& parent) const
|
int InstalledListModel::rowCount(const QModelIndex& parent) const
|
||||||
@ -95,9 +94,17 @@ void InstalledListModel::loadInstalledContent()
|
|||||||
{
|
{
|
||||||
if (m_loadScreenWatcher.isRunning())
|
if (m_loadScreenWatcher.isRunning())
|
||||||
qDebug() << "allready running";
|
qDebug() << "allready running";
|
||||||
|
|
||||||
qDebug() << QThread::currentThreadId();
|
qDebug() << QThread::currentThreadId();
|
||||||
|
|
||||||
|
if (m_isLoadingContent) {
|
||||||
|
qDebug() << "Called loading installed files twice! Aborting";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_loadScreenFuture = QtConcurrent::run([this]() {
|
m_loadScreenFuture = QtConcurrent::run([this]() {
|
||||||
|
auto cleanup = qScopeGuard([this] { setIsLoadingContent(false); });
|
||||||
|
setIsLoadingContent(true);
|
||||||
qDebug() << QThread::currentThreadId();
|
qDebug() << QThread::currentThreadId();
|
||||||
QJsonDocument jsonProject;
|
QJsonDocument jsonProject;
|
||||||
QJsonParseError parseError;
|
QJsonParseError parseError;
|
||||||
@ -138,7 +145,7 @@ void InstalledListModel::loadInstalledContent()
|
|||||||
obj.insert("type", "video");
|
obj.insert("type", "video");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileEnding.endsWith(".webm") || (obj.value("type").toString() == "qmlScene" || fileEnding.endsWith(".html")))
|
if (fileEnding.endsWith(".webm") || (obj.value("type").toString() == "qmlScene" || fileEnding.endsWith(".html")))
|
||||||
emit addInstalledItem(obj, item.baseName());
|
emit addInstalledItem(obj, item.baseName());
|
||||||
|
|
||||||
if (obj.value("type") == "qmlWidget" || obj.value("type") == "standalonewidget")
|
if (obj.value("type") == "qmlWidget" || obj.value("type") == "standalonewidget")
|
||||||
|
@ -40,6 +40,7 @@ public:
|
|||||||
bool getProjectByAbsoluteStoragePath(QUrl* path, ProjectFile* spf);
|
bool getProjectByAbsoluteStoragePath(QUrl* path, ProjectFile* spf);
|
||||||
|
|
||||||
Q_PROPERTY(QUrl absoluteStoragePath READ absoluteStoragePath WRITE setabsoluteStoragePath NOTIFY absoluteStoragePathChanged)
|
Q_PROPERTY(QUrl absoluteStoragePath READ absoluteStoragePath WRITE setabsoluteStoragePath NOTIFY absoluteStoragePathChanged)
|
||||||
|
Q_PROPERTY(bool isLoadingContent READ isLoadingContent WRITE setIsLoadingContent NOTIFY isLoadingContentChanged)
|
||||||
|
|
||||||
enum InstalledRole {
|
enum InstalledRole {
|
||||||
TitleRole,
|
TitleRole,
|
||||||
@ -58,6 +59,11 @@ public:
|
|||||||
return m_absoluteStoragePath;
|
return m_absoluteStoragePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isLoadingContent() const
|
||||||
|
{
|
||||||
|
return m_isLoadingContent;
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadInstalledContent();
|
void loadInstalledContent();
|
||||||
QVariantMap get(QString folderId);
|
QVariantMap get(QString folderId);
|
||||||
@ -73,6 +79,15 @@ public slots:
|
|||||||
int getAmountItemLoaded();
|
int getAmountItemLoaded();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
void setIsLoadingContent(bool isLoadingContent)
|
||||||
|
{
|
||||||
|
if (m_isLoadingContent == isLoadingContent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_isLoadingContent = isLoadingContent;
|
||||||
|
emit isLoadingContentChanged(m_isLoadingContent);
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void setScreenVisible(bool visible);
|
void setScreenVisible(bool visible);
|
||||||
void setScreenToVideo(QString absolutePath);
|
void setScreenToVideo(QString absolutePath);
|
||||||
@ -80,9 +95,14 @@ signals:
|
|||||||
void addInstalledItem(const QJsonObject, const QString);
|
void addInstalledItem(const QJsonObject, const QString);
|
||||||
void installedLoadingFinished();
|
void installedLoadingFinished();
|
||||||
|
|
||||||
|
void isLoadingContentChanged(bool isLoadingContent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<ProjectFile> m_screenPlayFiles;
|
QVector<ProjectFile> m_screenPlayFiles;
|
||||||
QUrl m_absoluteStoragePath;
|
QUrl m_absoluteStoragePath;
|
||||||
QFuture<void> m_loadScreenFuture;
|
QFuture<void> m_loadScreenFuture;
|
||||||
QFutureWatcher<void> m_loadScreenWatcher;
|
QFutureWatcher<void> m_loadScreenWatcher;
|
||||||
|
|
||||||
|
|
||||||
|
bool m_isLoadingContent = false;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user