Cleanup creation of timeline widget, use a tab widget to display project timeline

parent 61b60d45
......@@ -18,7 +18,6 @@ the Free Software Foundation, either version 3 of the License, or
#include "library/librarywidget.h"
#include <QCoreApplication>
#include "kdenlive_debug.h"
#include "timeline2/view/timelinewidget.h"
#include "doc/kdenlivedoc.h"
#include "doc/docundostack.hpp"
......@@ -80,13 +79,22 @@ void Core::initialize()
connect(m_producerQueue, SIGNAL(addClip(QString, QMap<QString, QString>)), m_binWidget, SLOT(slotAddUrl(QString, QMap<QString, QString>)));
connect(m_binController, SIGNAL(createThumb(QDomElement, QString, int)), m_producerQueue, SLOT(getFileProperties(QDomElement, QString, int)));
connect(m_binWidget, &Bin::producerReady, m_producerQueue, &ProducerQueue::slotProcessingDone, Qt::DirectConnection);
m_timelineTab = new QTabWidget();
//TODO
/*connect(m_producerQueue, SIGNAL(removeInvalidProxy(QString,bool)), m_binWidget, SLOT(slotRemoveInvalidProxy(QString,bool)));*/
m_timelineWidget = new TimelineWidget(m_projectManager->commandStack(), m_mainWindow);
emit coreIsReady();
}
QWidget *Core::timelineTabs()
{
return m_timelineTab;
}
void Core::addTimeline(QWidget *timeline, const QString &name)
{
m_timelineTab->addTab(timeline, name);
}
Core *Core::self()
{
return m_self;
......@@ -127,11 +135,6 @@ LibraryWidget *Core::library()
return m_library;
}
TimelineWidget *Core::timeline()
{
return m_timelineWidget;
}
void Core::initLocale()
{
QLocale systemLocale = QLocale();
......
......@@ -11,6 +11,7 @@ the Free Software Foundation, either version 3 of the License, or
#ifndef CORE_H
#define CORE_H
#include <QTabWidget>
#include <QObject>
#include "kdenlivecore_export.h"
......@@ -21,7 +22,6 @@ class BinController;
class Bin;
class LibraryWidget;
class ProducerQueue;
class TimelineWidget;
#define pCore Core::self()
......@@ -68,7 +68,9 @@ public:
/** @brief Returns a pointer to the library. */
LibraryWidget *library();
/** @brief Returns a pointer to the timeline. */
TimelineWidget *timeline();
QWidget *timelineTabs();
/** @brief Add a new timeline tab. */
void addTimeline(QWidget *timeline, const QString &name);
private:
explicit Core(MainWindow *mainWindow);
......@@ -84,7 +86,7 @@ private:
ProducerQueue *m_producerQueue;
Bin *m_binWidget;
LibraryWidget *m_library;
TimelineWidget *m_timelineWidget;
QTabWidget *m_timelineTab;
signals:
void coreIsReady();
......
......@@ -276,7 +276,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &c
setupActions();
QDockWidget *libraryDock = addDock(i18n("Library"), QStringLiteral("library"), pCore->library());
QDockWidget *timelineDock = addDock(i18n("Timeline2"), QStringLiteral("timeline2"), pCore->timeline());
QDockWidget *timelineDock = addDock(i18n("Timeline2"), QStringLiteral("timeline2"), pCore->timelineTabs());
m_clipMonitor = new Monitor(Kdenlive::ClipMonitor, pCore->monitorManager(), this);
pCore->bin()->setMonitor(m_clipMonitor);
......
......@@ -26,6 +26,7 @@ the Free Software Foundation, either version 3 of the License, or
#include "project/dialogs/backupwidget.h"
#include "project/notesplugin.h"
#include "utils/KoIconUtils.h"
#include "timeline2/view/timelinewidget.h"
#include <KActionCollection>
#include <KRecentDirs>
......@@ -105,6 +106,8 @@ void ProjectManager::slotLoadOnOpen()
pCore->bin()->droppedUrls(urls);
}
m_loadClipsOnOpen.clear();
TimelineWidget *timelineWidget = new TimelineWidget(m_project->commandStack(), pCore->window());
pCore->addTimeline(timelineWidget, m_project->url().fileName());
}
void ProjectManager::init(const QUrl &projectUrl, const QString &clipList)
......@@ -230,15 +233,6 @@ void ProjectManager::newFile(bool showProjectSettings, bool force)
m_lastSave.start();
}
std::shared_ptr<DocUndoStack> ProjectManager::commandStack()
{
if (m_project) {
return m_project->commandStack();
}
//TODO: temporary hack to avoid startup crash. No KdenliveDoc exists on startup
return std::make_shared<DocUndoStack>(pCore->window()->m_commandStack);
}
bool ProjectManager::closeCurrentDocument(bool saveChanges, bool quit)
{
if (m_project && m_project->isModified() && saveChanges) {
......
......@@ -70,8 +70,6 @@ public:
void saveZone(const QStringList &info, const QDir &dir);
/** @brief Move project data files to new url */
void moveProjectData(const QString &src, const QString &dest);
/** @brief Returns current project's undo stack or new one if no project exists */
std::shared_ptr<DocUndoStack> commandStack();
public slots:
void newFile(bool showProjectSettings = true, bool force = false);
......
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