From 1ab17ea6d4c962f1d633b55146c7d2dbc87bf380 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Fri, 4 May 2018 14:45:45 +0200 Subject: [PATCH] Delete unused clipmanager --- src/bin/bin.cpp | 1 - src/doc/kdenlivedoc.cpp | 10 -- src/doc/kdenlivedoc.h | 3 - src/mainwindow.cpp | 1 - src/project/CMakeLists.txt | 1 - src/project/clipmanager.cpp | 218 ------------------------------------ src/project/clipmanager.h | 121 -------------------- 7 files changed, 355 deletions(-) delete mode 100644 src/project/clipmanager.cpp delete mode 100644 src/project/clipmanager.h diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp index 347daec91..0dbc59e23 100644 --- a/src/bin/bin.cpp +++ b/src/bin/bin.cpp @@ -38,7 +38,6 @@ along with this program. If not, see . #include "mltcontroller/clipcontroller.h" #include "mltcontroller/clippropertiescontroller.h" #include "monitor/monitor.h" -#include "project/clipmanager.h" #include "project/dialogs/slideshowclip.h" #include "project/invaliddialog.h" #include "project/projectcommands.h" diff --git a/src/doc/kdenlivedoc.cpp b/src/doc/kdenlivedoc.cpp index ea702333a..8b08b1497 100644 --- a/src/doc/kdenlivedoc.cpp +++ b/src/doc/kdenlivedoc.cpp @@ -37,7 +37,6 @@ #include "mltcontroller/effectscontroller.h" #include "profiles/profilemodel.hpp" #include "profiles/profilerepository.hpp" -#include "project/clipmanager.h" #include "project/projectcommands.h" #include "renderer.h" #include "titler/titlewidget.h" @@ -86,9 +85,6 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, const QString &projectFolder, QUndoGro m_commandStack = std::make_shared(undoGroup); m_guideModel.reset(new MarkerListModel(m_commandStack, this)); connect(m_guideModel.get(), &MarkerListModel::modelChanged, this, &KdenliveDoc::guidesChanged); - - m_clipManager = new ClipManager(this); - connect(m_clipManager, SIGNAL(displayMessage(QString, int)), parent, SLOT(slotGotProgressInfo(QString, int))); connect(this, SIGNAL(updateCompositionMode(int)), parent, SLOT(slotUpdateCompositeAction(int))); bool success = false; connect(m_commandStack.get(), &QUndoStack::indexChanged, this, &KdenliveDoc::slotModified); @@ -287,7 +283,6 @@ KdenliveDoc::~KdenliveDoc() // qCDebug(KDENLIVE_LOG) << "// DEL CLP MAN"; // Clean up guide model m_guideModel.reset(); - delete m_clipManager; // qCDebug(KDENLIVE_LOG) << "// DEL CLP MAN done"; if (m_autosave) { if (!m_autosave->fileName().isEmpty()) { @@ -596,11 +591,6 @@ bool KdenliveDoc::saveSceneList(const QString &path, const QString &scene) return true; } -ClipManager *KdenliveDoc::clipManager() -{ - return m_clipManager; -} - QString KdenliveDoc::projectTempFolder() const { if (m_projectFolder.isEmpty()) { diff --git a/src/doc/kdenlivedoc.h b/src/doc/kdenlivedoc.h index b8c0c6774..46d39a6ee 100644 --- a/src/doc/kdenlivedoc.h +++ b/src/doc/kdenlivedoc.h @@ -39,7 +39,6 @@ #include "mltcontroller/effectscontroller.h" #include "timecode.h" -class ClipManager; class MainWindow; class TrackInfo; class ProjectClip; @@ -76,7 +75,6 @@ public: Timecode timecode() const; QDomDocument toXml(); std::shared_ptr commandStack(); - ClipManager *clipManager(); int getFramePos(const QString &duration); /** @brief Get a bin's clip from its id. */ @@ -165,7 +163,6 @@ private: QString m_documentRoot; Timecode m_timecode; std::shared_ptr m_commandStack; - ClipManager *m_clipManager; QString m_searchFolder; /** @brief Tells whether the current document has been changed after being saved. */ diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b29a4de79..efff83c62 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -52,7 +52,6 @@ #include "monitor/monitormanager.h" #include "monitor/scopes/audiographspectrum.h" #include "profiles/profilemodel.hpp" -#include "project/clipmanager.h" #include "project/cliptranscode.h" #include "project/dialogs/archivewidget.h" #include "project/dialogs/projectsettings.h" diff --git a/src/project/CMakeLists.txt b/src/project/CMakeLists.txt index ea4693d22..75d45a94a 100644 --- a/src/project/CMakeLists.txt +++ b/src/project/CMakeLists.txt @@ -1,7 +1,6 @@ add_subdirectory(dialogs) set(kdenlive_SRCS ${kdenlive_SRCS} - project/clipmanager.cpp project/clipstabilize.cpp project/cliptranscode.cpp project/invaliddialog.cpp diff --git a/src/project/clipmanager.cpp b/src/project/clipmanager.cpp deleted file mode 100644 index 9183c3b6b..000000000 --- a/src/project/clipmanager.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "clipmanager.h" -#include "bin/bin.h" -#include "bin/bincommands.h" -#include "core.h" -#include "dialogs/slideshowclip.h" -#include "doc/docundostack.hpp" -#include "doc/kdenlivedoc.h" -#include "doc/kthumb.h" -#include "kdenlivesettings.h" -#include "mltcontroller/bincontroller.h" -#include "mltcontroller/clipcontroller.h" -#include "project/projectmanager.h" -#include "renderer.h" -#include "titler/titledocument.h" - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -ClipManager::ClipManager(KdenliveDoc *doc) - : QObject() - , m_audioThumbsQueue() - , m_doc(doc) - , m_abortThumb(false) - , m_closing(false) - , m_abortAudioThumb(false) -{ -} - -ClipManager::~ClipManager() -{ - m_closing = true; - m_abortThumb = true; - m_abortAudioThumb = true; - m_thumbsThread.waitForFinished(); - m_audioThumbsThread.waitForFinished(); - m_thumbsMutex.lock(); - m_requestedThumbs.clear(); - m_audioThumbsQueue.clear(); - m_thumbsMutex.unlock(); -} - -void ClipManager::clear() -{ - m_abortThumb = true; - m_abortAudioThumb = true; - m_thumbsThread.waitForFinished(); - m_audioThumbsThread.waitForFinished(); - m_thumbsMutex.lock(); - m_requestedThumbs.clear(); - m_audioThumbsQueue.clear(); - m_thumbsMutex.unlock(); - m_abortThumb = false; - m_abortAudioThumb = false; - m_folderList.clear(); - m_modifiedClips.clear(); -} - -void ClipManager::slotRequestThumbs(const QString &id, const QList &frames) -{ - m_thumbsMutex.lock(); - for (int frame : frames) { - m_requestedThumbs.insertMulti(id, frame); - } - m_thumbsMutex.unlock(); - if (!m_thumbsThread.isRunning() && !m_abortThumb) { - m_thumbsThread = QtConcurrent::run(this, &ClipManager::slotGetThumbs); - } -} - -void ClipManager::stopThumbs(const QString &id) -{ - if (m_closing || (m_requestedThumbs.isEmpty() && m_processingThumbId != id && m_audioThumbsQueue.isEmpty() && m_processingAudioThumbId != id)) { - return; - } - // Abort video thumbs for this clip - m_abortThumb = true; - m_thumbsThread.waitForFinished(); - m_thumbsMutex.lock(); - m_requestedThumbs.remove(id); - m_audioThumbsQueue.removeAll(id); - m_thumbsMutex.unlock(); - m_abortThumb = false; - - // Abort audio thumbs for this clip - if (m_processingAudioThumbId == id) { - m_abortAudioThumb = true; - m_audioThumbsThread.waitForFinished(); - m_abortAudioThumb = false; - } - - if (!m_thumbsThread.isRunning() && !m_requestedThumbs.isEmpty()) { - m_thumbsThread = QtConcurrent::run(this, &ClipManager::slotGetThumbs); - } -} - -void ClipManager::slotGetThumbs() -{ - QMap::const_iterator i; - - while (!m_requestedThumbs.isEmpty() && !m_abortThumb) { - m_thumbsMutex.lock(); - i = m_requestedThumbs.constBegin(); - m_processingThumbId = i.key(); - QList values = m_requestedThumbs.values(m_processingThumbId); - m_requestedThumbs.remove(m_processingThumbId); - // TODO int thumbType = 0; // 0 = timeline thumb, 1 = project clip zone thumb, 2 = clip properties thumb - if (m_processingThumbId.startsWith(QLatin1String("?"))) { - // if id starts with ?, it means the request comes from a clip property widget - // TODO thumbType = 2; - m_processingThumbId.remove(0, 1); - } - if (m_processingThumbId.startsWith(QLatin1String("#"))) { - // if id starts with #, it means the request comes from project tree - // TODO thumbType = 1; - m_processingThumbId.remove(0, 1); - } - m_thumbsMutex.unlock(); - qSort(values); - // TODO - /* - DocClipBase *clip = getClipById(m_processingThumbId); - if (!clip) continue; - max = m_requestedThumbs.size() + values.count(); - // keep in sync with declaration un projectitem.cpp and subprojectitem.cpp - int minHeight = qMax(38, QFontMetrics(QApplication::font()).lineSpacing() * 2); - while (!values.isEmpty() && clip->thumbProducer() && !m_abortThumb) { - int pos = values.takeFirst(); - switch (thumbType) { - case 1: - clip->thumbProducer()->getGenericThumb(pos, minHeight, thumbType); - break; - case 2: - clip->thumbProducer()->getGenericThumb(pos, 180, thumbType); - break; - default: - clip->thumbProducer()->getThumb(pos); - } - done++; - if (max > 3) emit displayMessage(i18n("Loading thumbnails"), 100 * done / max); - } - */ - } - m_processingThumbId.clear(); - emit displayMessage(QString(), -1); -} - -void ClipManager::slotAddCopiedClip(KIO::Job *, const QUrl &, const QUrl &dst) -{ - pCore->bin()->droppedUrls(QList() << dst); -} - -int ClipManager::lastClipId() const -{ - return pCore->bin()->lastClipId(); -} - -/* -void ClipManager::slotClipMissing(const QString &path) -{ - qCDebug(KDENLIVE_LOG) << "// CLIP: " << path << " WAS MISSING"; - //TODO - const QList list = getClipByResource(path); - for (int i = 0; i < list.count(); ++i) { - DocClipBase *clip = list.at(i); - if (clip != nullptr) emit missingClip(clip->getId()); - } -} - -void ClipManager::slotClipAvailable(const QString &path) -{ - qCDebug(KDENLIVE_LOG) << "// CLIP: " << path << " WAS ADDED"; - //TODO - const QList list = getClipByResource(path); - for (int i = 0; i < list.count(); ++i) { - DocClipBase *clip = list.at(i); - if (clip != nullptr) emit availableClip(clip->getId()); - } -} -*/ - -void ClipManager::projectTreeThumbReady(const QString &id, int frame, const QImage &img, int type) -{ - switch (type) { - case 2: - emit gotClipPropertyThumbnail(id, img); - break; - default: - emit thumbReady(id, frame, img); - } -} diff --git a/src/project/clipmanager.h b/src/project/clipmanager.h deleted file mode 100644 index 19d7ef719..000000000 --- a/src/project/clipmanager.h +++ /dev/null @@ -1,121 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef CLIPMANAGER_H -#define CLIPMANAGER_H - -#include -#include -#include -#include - -#include -#include - -#include "definitions.h" -#include "gentime.h" - -class KdenliveDoc; -class AbstractGroupItem; -class QUndoCommand; - -class SolidVolumeInfo -{ - -public: - QString path; // mount path of volume, with trailing slash - QString uuid; // UUID as from Solid - QString label; // volume label (think of CDs) - bool isRemovable; // may be removed - bool isMounted; - - bool isNull() const { return path.isNull(); } -}; - -namespace Mlt { -} - -/** - * @class ClipManager - * @brief Takes care of clip operations that might affect timeline and bin - */ - -class ClipManager : public QObject -{ - Q_OBJECT public : - - explicit ClipManager(KdenliveDoc *doc); - virtual ~ClipManager(); - - int lastClipId() const; - /** @brief Prepare deletion of clips and folders from the Bin. */ - void clear(); - /** @brief remove a clip id from the queue list. */ - void stopThumbs(const QString &id); - void projectTreeThumbReady(const QString &id, int frame, const QImage &img, int type); - -public slots: - /** @brief Request creation of a clip thumbnail for specified frames. */ - void slotRequestThumbs(const QString &id, const QList &frames); - -private slots: - void slotGetThumbs(); - /** @brief Clip has been copied, add it now. */ - void slotAddCopiedClip(KIO::Job *, const QUrl &, const QUrl &dst); - -private: // Private attributes - /** @brief the list of groups in the document */ - QList m_groupsList; - QMap m_folderList; - QList m_audioThumbsQueue; - /** the document undo stack*/ - KdenliveDoc *m_doc; - /** List of the clip IDs that need to be reloaded after being externally modified */ - QMap m_modifiedClips; - /** Struct containing the list of clip thumbnails to request (clip id and frames) */ - QMap m_requestedThumbs; - QMutex m_thumbsMutex; - QFuture m_thumbsThread; - /** @brief The id of currently processed clip for thumbs creation. */ - QString m_processingThumbId; - /** @brief If true, abort processing of clip thumbs before removing a clip. */ - bool m_abortThumb; - /** @brief We are about to delete the clip producer, stop processing thumbs. */ - bool m_closing; - QFuture m_audioThumbsThread; - /** @brief If true, abort processing of audio thumbs. */ - bool m_abortAudioThumb; - /** @brief The id of currently processed clip for audio thumbs creation. */ - QString m_processingAudioThumbId; - QMutex m_groupsMutex; - - QPoint m_projectTreeThumbSize; - -signals: - void reloadClip(const QString &); - void modifiedClip(const QString &); - void missingClip(const QString &); - void availableClip(const QString &); - void checkAllClips(bool displayRatioChanged, bool fpsChanged, const QStringList &brokenClips); - void displayMessage(const QString &, int); - void thumbReady(const QString &id, int, const QImage &); - void gotClipPropertyThumbnail(const QString &id, const QImage &); -}; - -#endif -- GitLab