1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-06 09:17:07 +02:00

Fix live reloading

Looks like we must add all files we want to track
into the watcher
This commit is contained in:
Elias Steurer 2023-02-24 16:55:35 +01:00
parent eccc67d0c0
commit 67557dd66d
3 changed files with 15 additions and 5 deletions

View File

@ -227,7 +227,12 @@ void BaseWindow::setupLiveReloading()
QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, timeoutLambda);
QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::fileChanged, this, timeoutLambda);
QObject::connect(&m_liveReloadLimiter, &QTimer::timeout, this, reloadQMLLambda);
m_fileSystemWatcher.addPaths({ QUrl::fromUserInput(projectPath()).toLocalFile() });
m_fileSystemWatcher.addPath(projectPath());
QDirIterator projectFilesIter(projectPath(), { "*.qml", "*.html", "*.css", "*.js" }, QDir::Files | QDir::NoSymLinks, QDirIterator::Subdirectories);
m_fileSystemWatcher.addPath({ projectPath() });
while (projectFilesIter.hasNext()) {
m_fileSystemWatcher.addPath(projectFilesIter.next());
}
}
ScreenPlay::VideoCodec::VideoCodec BaseWindow::videoCodec() const

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
#include "widgetwindow.h"
#include <QDirIterator>
#include <QGuiApplication>
#include <QSysInfo>
@ -111,8 +112,7 @@ WidgetWindow::WidgetWindow(
});
}
if (projectPath != "test")
setupLiveReloading();
setupLiveReloading();
}
void WidgetWindow::setSize(QSize size)
@ -217,7 +217,12 @@ void WidgetWindow::setupLiveReloading()
QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, timeoutLambda);
QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::fileChanged, this, timeoutLambda);
QObject::connect(&m_liveReloadLimiter, &QTimer::timeout, this, reloadQMLLambda);
m_fileSystemWatcher.addPaths({ projectPath() });
QDirIterator projectFilesIter(projectPath(), { "*.qml", "*.html", "*.css", "*.js" }, QDir::Files | QDir::NoSymLinks, QDirIterator::Subdirectories);
m_fileSystemWatcher.addPath({ projectPath() });
while (projectFilesIter.hasNext()) {
m_fileSystemWatcher.addPath(projectFilesIter.next());
}
}
#include "moc_widgetwindow.cpp"

View File

@ -34,8 +34,8 @@ namespace ScreenPlayWorkshop {
class InstalledListModel : public QAbstractListModel {
Q_OBJECT
QML_UNCREATABLE("")
QML_ELEMENT
Q_PROPERTY(QUrl absoluteStoragePath READ absoluteStoragePath WRITE setAbsoluteStoragePath NOTIFY absoluteStoragePathChanged)
public: