Commit c1c39a93 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Remove local reference to current project

parent 43ba3e45
......@@ -744,7 +744,10 @@ MediaCapture *Core::getAudioDevice()
QString Core::getProjectFolderName()
{
return m_monitorManager->getProjectFolder();
if (currentDoc()) {
return currentDoc()->projectDataFolder() + QDir::separator();
}
return QString();
}
QString Core::getTimelineClipBinId(int cid)
......
......@@ -1989,7 +1989,6 @@ void MainWindow::connectDocument()
m_saveAction->setEnabled(project->isModified());
m_normalEditTool->setChecked(true);
connect(m_projectMonitor, &Monitor::durationChanged, this, &MainWindow::slotUpdateProjectDuration);
pCore->monitorManager()->setDocument(project);
connect(m_effectList2, &EffectListWidget::reloadFavorites, getMainTimeline(), &TimelineWidget::updateEffectFavorites);
connect(m_transitionList2, &TransitionListWidget::reloadFavorites, getMainTimeline(), &TimelineWidget::updateTransitionFavorites);
......
......@@ -1720,21 +1720,19 @@ QString Monitor::getMarkerThumb(GenTime pos)
return QString();
}
if (!m_controller->getClipHash().isEmpty()) {
QString url = m_monitorManager->getCacheFolder(CacheThumbs)
.absoluteFilePath(m_controller->getClipHash() + QLatin1Char('#') +
bool ok = false;
QDir dir = pCore->currentDoc()->getCacheDir(CacheThumbs, &ok);
if (ok) {
QString url = dir.absoluteFilePath(m_controller->getClipHash() + QLatin1Char('#') +
QString::number((int)pos.frames(m_monitorManager->timecode().fps())) + QStringLiteral(".png"));
if (QFile::exists(url)) {
return url;
if (QFile::exists(url)) {
return url;
}
}
}
return QString();
}
const QString Monitor::projectFolder() const
{
return m_monitorManager->getProjectFolder();
}
void Monitor::setPalette(const QPalette &p)
{
QWidget::setPalette(p);
......
......@@ -115,8 +115,6 @@ public:
Timecode timecode() const;
/** @brief Get url for the clip's thumbnail */
QString getMarkerThumb(GenTime pos);
/** @brief Get current project's folder */
const QString projectFolder() const;
int getZoneStart();
int getZoneEnd();
void setUpEffectGeometry(const QRect &r, const QVariantList &list = QVariantList(), const QVariantList &types = QVariantList());
......
......@@ -43,11 +43,6 @@ Timecode MonitorManager::timecode() const
return m_timecode;
}
void MonitorManager::setDocument(KdenliveDoc *doc)
{
m_document = doc;
}
QAction *MonitorManager::getAction(const QString &name)
{
return pCore->window()->action(name.toUtf8().constData());
......@@ -351,15 +346,6 @@ void MonitorManager::slotSwitchFullscreen()
}
}
QString MonitorManager::getProjectFolder() const
{
if (m_document == nullptr) {
// qCDebug(KDENLIVE_LOG)<<" + + +nullptr DOC!!";
return QString();
}
return m_document->projectDataFolder() + QDir::separator();
}
void MonitorManager::setupActions()
{
KDualAction *playAction = new KDualAction(i18n("Play"), i18n("Pause"), this);
......@@ -594,15 +580,6 @@ void MonitorManager::slotSetOutPoint()
}
}
QDir MonitorManager::getCacheFolder(CacheType type)
{
bool ok = false;
if (m_document) {
return m_document->getCacheDir(type, &ok);
}
return QDir();
}
void MonitorManager::slotExtractCurrentFrame()
{
if (m_activeMonitor) {
......
......@@ -54,10 +54,6 @@ public:
AbstractMonitor *monitor(Kdenlive::MonitorId monitorName);
void updateScopeSource();
void clearScopeSource();
/** @brief Returns current project's folder. */
QString getProjectFolder() const;
/** @brief Sets current document for later reference. */
void setDocument(KdenliveDoc *doc);
/** @brief Change an MLT consumer property for both monitors. */
void setConsumerProperty(const QString &name, const QString &value);
/** @brief Return a mainwindow action from its id name. */
......@@ -130,7 +126,6 @@ private:
QMutex m_switchMutex;
/** @brief Sets up all the actions and attaches them to the collection of MainWindow. */
void setupActions();
KdenliveDoc *m_document{nullptr};
Monitor *m_clipMonitor{nullptr};
Monitor *m_projectMonitor{nullptr};
Timecode m_timecode;
......
......@@ -198,7 +198,7 @@ void RecManager::slotRecord(bool record)
QString extension = KdenliveSettings::grab_extension();
QDir captureFolder;
if (KdenliveSettings::capturetoprojectfolder()) {
captureFolder = QDir(m_monitor->projectFolder());
captureFolder = QDir(pCore->getProjectFolderName());
} else {
captureFolder = QDir(KdenliveSettings::capturefolder());
}
......
......@@ -256,7 +256,6 @@ bool ProjectManager::closeCurrentDocument(bool saveChanges, bool quit)
delete m_project;
m_project = nullptr;
}
pCore->monitorManager()->setDocument(m_project);
}
/* // Make sure to reset locale to system's default
QString requestedLocale = QLocale::system().name();
......
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