Don't delete all thumbnails when changing project resolution but keeping same dar

parent 9a2ad8a3
......@@ -3732,7 +3732,7 @@ bool Bin::isEmpty() const
return !m_itemModel->getRootFolder()->hasChildClips();
}
void Bin::reloadAllProducers()
void Bin::reloadAllProducers(bool reloadThumbs)
{
if (m_itemModel->getRootFolder() == nullptr || m_itemModel->getRootFolder()->childCount() == 0 || !isEnabled()) {
return;
......@@ -3757,7 +3757,9 @@ void Bin::reloadAllProducers()
clip->discardAudioThumb();
// We need to set a temporary id before all outdated producers are replaced;
int jobId = pCore->jobManager()->startJob<LoadJob>({clip->clipId()}, -1, QString(), xml);
ThumbnailCache::get()->invalidateThumbsForClip(clip->clipId(), true);
if (reloadThumbs) {
ThumbnailCache::get()->invalidateThumbsForClip(clip->clipId(), true);
}
pCore->jobManager()->startJob<ThumbJob>({clip->clipId()}, jobId, QString(), -1, true, true);
pCore->jobManager()->startJob<AudioThumbJob>({clip->clipId()}, jobId, QString());
}
......
......@@ -255,7 +255,7 @@ public:
/** @brief Returns true if there is no clip. */
bool isEmpty() const;
/** @brief Trigger reload of all clips. */
void reloadAllProducers();
void reloadAllProducers(bool reloadThumbs = true);
/** @brief Ensure all audio thumbs have been created */
void checkAudioThumbs();
/** @brief Get usage stats for project bin. */
......
......@@ -849,7 +849,6 @@ void KdenliveSettingsDialog::updateSettings()
}
KdenliveSettings::setDefault_profile(m_pw->selectedProfile());
bool resetProfile = false;
bool resetConsumer = false;
bool fullReset = false;
bool updateCapturePath = false;
......@@ -994,7 +993,6 @@ void KdenliveSettingsDialog::updateSettings()
if (m_configSdl.kcfg_window_background->color() != KdenliveSettings::window_background()) {
KdenliveSettings::setWindow_background(m_configSdl.kcfg_window_background->color());
emit updateMonitorBg();
resetProfile = true;
}
if (m_configSdl.kcfg_volume->value() != KdenliveSettings::volume()) {
......@@ -1066,9 +1064,6 @@ void KdenliveSettingsDialog::updateSettings()
if (resetConsumer) {
emit doResetConsumer(fullReset);
}
if (resetProfile) {
emit doResetProfile();
}
if (restart) {
emit restartKdenlive();
}
......
......@@ -126,7 +126,6 @@ private:
bool initAudioRecDevice();
signals:
void customChanged();
void doResetProfile();
void doResetConsumer(bool fullReset);
void updateCaptureFolder();
void updateLibraryFolder();
......
......@@ -1347,7 +1347,7 @@ void KdenliveDoc::loadDocumentProperties()
updateProjectProfile(false);
}
void KdenliveDoc::updateProjectProfile(bool reloadProducers)
void KdenliveDoc::updateProjectProfile(bool reloadProducers, bool reloadThumbs)
{
pCore->jobManager()->slotCancelJobs();
double fps = pCore->getCurrentFps();
......@@ -1357,21 +1357,21 @@ void KdenliveDoc::updateProjectProfile(bool reloadProducers)
return;
}
emit updateFps(fpsChanged);
pCore->bin()->reloadAllProducers();
pCore->bin()->reloadAllProducers(reloadThumbs);
}
void KdenliveDoc::resetProfile()
void KdenliveDoc::resetProfile(bool reloadThumbs)
{
updateProjectProfile(true);
updateProjectProfile(true, reloadThumbs);
emit docModified(true);
}
void KdenliveDoc::slotSwitchProfile(const QString &profile_path)
void KdenliveDoc::slotSwitchProfile(const QString &profile_path, bool reloadThumbs)
{
// Discard all current jobs
pCore->jobManager()->slotCancelJobs();
pCore->setCurrentProfile(profile_path);
updateProjectProfile(true);
updateProjectProfile(true, reloadThumbs);
emit docModified(true);
}
......@@ -1453,7 +1453,7 @@ void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QS
QList<QAction *> list;
const QString profilePath = profile->path();
QAction *ac = new QAction(QIcon::fromTheme(QStringLiteral("dialog-ok")), i18n("Switch"), this);
connect(ac, &QAction::triggered, [this, profilePath]() { this->slotSwitchProfile(profilePath); });
connect(ac, &QAction::triggered, [this, profilePath]() { this->slotSwitchProfile(profilePath, true); });
QAction *ac2 = new QAction(QIcon::fromTheme(QStringLiteral("dialog-cancel")), i18n("Cancel"), this);
list << ac << ac2;
pCore->displayBinMessage(i18n("Switch to clip profile %1?", profile->descriptiveString()), KMessageWidget::Information, list);
......
......@@ -121,7 +121,7 @@ public:
bool autoGenerateImageProxy(int width) const;
/** @brief Saves effects embedded in project file. */
void saveCustomEffects(const QDomNodeList &customeffects);
void resetProfile();
void resetProfile(bool reloadThumbs);
/** @brief Returns true if the profile file has changed. */
bool profileChanged(const QString &profile) const;
/** @brief Get an action from main actioncollection. */
......@@ -201,7 +201,7 @@ private:
/** @brief Load document properties from the xml file */
void loadDocumentProperties();
/** @brief update document properties to reflect a change in the current profile */
void updateProjectProfile(bool reloadProducers = false);
void updateProjectProfile(bool reloadProducers = false, bool reloadThumbs = false);
/** @brief initialize proxy settings based on hw status */
void initProxySettings();
......@@ -224,7 +224,7 @@ public slots:
private slots:
void slotModified();
void switchProfile(std::unique_ptr<ProfileParam> &profile, const QString &id, const QDomElement &xml);
void slotSwitchProfile(const QString &profile_path);
void slotSwitchProfile(const QString &profile_path, bool reloadThumbs);
/** @brief Check if we did a new action invalidating more recent undo items. */
void checkPreviewStack();
/** @brief Guides were changed, save to MLT. */
......
......@@ -1947,8 +1947,9 @@ void MainWindow::slotEditProjectSettings()
}
pCore->projectManager()->saveWithUpdatedProfile(profile);
} else {
bool darChanged = !qFuzzyCompare(pCore->getCurrentProfile()->dar(), ProfileRepository::get()->getProfile(profile)->dar());
pCore->setCurrentProfile(profile);
pCore->projectManager()->slotResetProfiles();
pCore->projectManager()->slotResetProfiles(darChanged);
slotUpdateDocumentState(true);
}
} else if (modified) {
......@@ -2320,7 +2321,6 @@ void MainWindow::slotPreferences(int page, int option)
auto *dialog = new KdenliveSettingsDialog(actions, m_gpuAllowed, this);
connect(dialog, &KConfigDialog::settingsChanged, this, &MainWindow::updateConfiguration);
connect(dialog, &KConfigDialog::settingsChanged, this, &MainWindow::configurationChanged);
connect(dialog, &KdenliveSettingsDialog::doResetProfile, pCore->projectManager(), &ProjectManager::slotResetProfiles);
connect(dialog, &KdenliveSettingsDialog::doResetConsumer, [this] (bool fullReset) {
m_scaleGroup->setEnabled(!KdenliveSettings::external_display());
pCore->projectManager()->slotResetConsumers(fullReset);
......
......@@ -708,9 +708,9 @@ void ProjectManager::prepareSave()
pCore->projectItemModel()->saveProperty(QStringLiteral("kdenlive:docproperties.groups"), m_mainTimelineModel->groupsData());
}
void ProjectManager::slotResetProfiles()
void ProjectManager::slotResetProfiles(bool reloadThumbs)
{
m_project->resetProfile();
m_project->resetProfile(reloadThumbs);
pCore->monitorManager()->updateScopeSource();
}
......
......@@ -125,7 +125,7 @@ public slots:
void slotStartAutoSave();
/** @brief Update project and monitors profiles */
void slotResetProfiles();
void slotResetProfiles(bool reloadThumbs);
/** @brief Rebuild consumers after a property change */
void slotResetConsumers(bool fullReset);
......
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