Display project loading status on splash screen if opening a project at start.

Related to !89
parent a7651105
Pipeline #21924 passed with stage
in 13 minutes and 47 seconds
......@@ -973,7 +973,10 @@ void ProjectItemModel::loadBinPlaylist(Mlt::Tractor *documentTractor, Mlt::Tract
Mlt::Playlist playlist((mlt_playlist)retainList.get_data(BinPlaylist::binPlaylistId.toUtf8().constData()));
if (playlist.is_valid() && playlist.type() == playlist_type) {
qDebug() << "playlist is valid";
if (progressDialog == nullptr && playlist.count() > 0) {
// Display message on splash screen
pCore->loadingMessageUpdated(i18n("Loading project clips..."));
}
// Load bin clips
qDebug() << "init bin";
// Load folders
......
......@@ -201,12 +201,16 @@ void Core::initGUI(const QUrl &Url, const QString &clipsToLoad)
connect(m_producerQueue, SIGNAL(removeInvalidProxy(QString,bool)), m_binWidget, SLOT(slotRemoveInvalidProxy(QString,bool)));*/
m_mainWindow->init();
if (!Url.isEmpty()) {
emit loadingMessageUpdated(i18n("Loading project..."));
}
projectManager()->init(Url, clipsToLoad);
if (qApp->isSessionRestored()) {
// NOTE: we are restoring only one window, because Kdenlive only uses one MainWindow
m_mainWindow->restore(1, false);
}
QMetaObject::invokeMethod(pCore->projectManager(), "slotLoadOnOpen", Qt::QueuedConnection);
pCore->projectManager()->slotLoadOnOpen();
//QMetaObject::invokeMethod(pCore->projectManager(), "slotLoadOnOpen", Qt::QueuedConnection);
m_mainWindow->show();
QThreadPool::globalInstance()->setMaxThreadCount(qMin(4, QThreadPool::globalInstance()->maxThreadCount()));
}
......
......@@ -16,6 +16,7 @@ the Free Software Foundation, either version 3 of the License, or
#include "undohelper.hpp"
#include <QMutex>
#include <QObject>
#include <QColor>
#include <QUrl>
#include <memory>
#include <QPoint>
......@@ -270,6 +271,8 @@ signals:
void showConfigDialog(int, int);
void finalizeRecording(const QString &captureFile);
void autoScrollChanged();
/** @brief Send a message to splash screen if still displayed */
void loadingMessageUpdated(const QString &, int align = Qt::AlignRight | Qt::AlignBottom, const QColor col = QColor(Qt::white));
};
#endif
......@@ -252,6 +252,7 @@ int main(int argc, char *argv[])
}
qApp->processEvents(QEventLoop::AllEvents);
Core::build(!parser.value(QStringLiteral("config")).isEmpty(), parser.value(QStringLiteral("mlt-path")));
QObject::connect(pCore.get(), &Core::loadingMessageUpdated, &splash, &QSplashScreen::showMessage);
pCore->initGUI(url, clipsToLoad);
splash.finish(pCore->window());
int result = app.exec();
......
......@@ -522,15 +522,18 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
m_fileRevert->setEnabled(true);
delete m_progressDialog;
m_progressDialog == nullptr;
ThumbnailCache::get()->clearCache();
pCore->monitorManager()->resetDisplay();
pCore->monitorManager()->activateMonitor(Kdenlive::ProjectMonitor);
m_progressDialog = new QProgressDialog(pCore->window());
m_progressDialog->setWindowTitle(i18n("Loading project"));
m_progressDialog->setCancelButton(nullptr);
m_progressDialog->setLabelText(i18n("Loading project"));
m_progressDialog->setMaximum(0);
m_progressDialog->show();
if (pCore->window()->isVisible()) {
m_progressDialog = new QProgressDialog(pCore->window());
m_progressDialog->setWindowTitle(i18n("Loading project"));
m_progressDialog->setCancelButton(nullptr);
m_progressDialog->setLabelText(i18n("Loading project"));
m_progressDialog->setMaximum(0);
m_progressDialog->show();
}
bool openBackup;
m_notesPlugin->clear();
int audioChannels = 2;
......@@ -563,8 +566,10 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
doc->setModified(!loadingFailed);
stale->setParent(doc);
}
m_progressDialog->setLabelText(i18n("Loading clips"));
m_progressDialog->setMaximum(doc->clipsCount());
if (m_progressDialog) {
m_progressDialog->setLabelText(i18n("Loading clips"));
m_progressDialog->setMaximum(doc->clipsCount());
}
// TODO refac delete this
pCore->bin()->setDocument(doc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment