From 7c5f778451bd87db882905afb0dd680aabc36400 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Fri, 7 Mar 2008 16:03:43 +0000 Subject: [PATCH] Fix crash on document switching svn path=/branches/KDE4/; revision=2007 --- src/mainwindow.cpp | 13 +++++-------- src/monitor.cpp | 2 -- src/monitormanager.cpp | 18 +----------------- src/monitormanager.h | 5 ----- 4 files changed, 6 insertions(+), 32 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d5087ffe..ef4e12af 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -160,10 +160,11 @@ MainWindow::MainWindow(QWidget *parent) connect(projectMonitorDock, SIGNAL(visibilityChanged(bool)), m_projectMonitor, SLOT(refreshMonitor(bool))); connect(clipMonitorDock, SIGNAL(visibilityChanged(bool)), m_clipMonitor, SLOT(refreshMonitor(bool))); - connect(m_monitorManager, SIGNAL(connectMonitors()), this, SLOT(slotConnectMonitors())); + //connect(m_monitorManager, SIGNAL(connectMonitors()), this, SLOT(slotConnectMonitors())); connect(m_monitorManager, SIGNAL(raiseClipMonitor(bool)), this, SLOT(slotRaiseMonitor(bool))); connect(m_effectList, SIGNAL(addEffect(QDomElement)), this, SLOT(slotAddEffect(QDomElement))); m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor); + slotConnectMonitors(); setAutoSaveSettings(); newFile(); @@ -206,17 +207,11 @@ void MainWindow::slotSetClipDuration(int id, int duration) { void MainWindow::slotConnectMonitors() { m_projectList->setRenderer(m_clipMonitor->render); - connect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &))); - connect(m_projectList, SIGNAL(receivedClipDuration(int, int)), this, SLOT(slotSetClipDuration(int, int))); - connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, int)), m_clipMonitor->render, SLOT(getFileProperties(const QDomElement &, int))); - connect(m_clipMonitor->render, SIGNAL(replyGetImage(int, int, const QPixmap &, int, int)), m_projectList, SLOT(slotReplyGetImage(int, int, const QPixmap &, int, int))); - connect(m_clipMonitor->render, SIGNAL(replyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &))); - } void MainWindow::setupActions() { @@ -478,10 +473,12 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha disconnect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*))); } m_activeDocument->setRenderer(NULL); + disconnect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &))); + m_clipMonitor->stop(); } m_monitorManager->resetProfiles(doc->profilePath()); m_projectList->setDocument(doc); - + connect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &))); connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor())); connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int))); connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int))); diff --git a/src/monitor.cpp b/src/monitor.cpp index 3d78f08b..ce4e928d 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -150,7 +150,6 @@ void Monitor::rendererStopped(int pos) { void Monitor::initMonitor() { kDebug() << "/////// INITING MONITOR, ID: " << ui.video_frame->winId(); - } // virtual @@ -206,7 +205,6 @@ void Monitor::slotSetXml(const QDomElement &e) { m_position = 0; } - void Monitor::slotOpenFile(const QString &file) { if (render == NULL) return; if (!m_isActive) m_monitorManager->activateMonitor(m_name); diff --git a/src/monitormanager.cpp b/src/monitormanager.cpp index 28e5825c..3cad95b4 100644 --- a/src/monitormanager.cpp +++ b/src/monitormanager.cpp @@ -41,24 +41,8 @@ Timecode MonitorManager::timecode() { void MonitorManager::initMonitors(Monitor *clipMonitor, Monitor *projectMonitor) { m_clipMonitor = clipMonitor; m_projectMonitor = projectMonitor; - //QTimer::singleShot(1750, this, SLOT(initClipMonitor())); - initClipMonitor(); - //initProjectMonitor(); } -void MonitorManager::initClipMonitor() { - m_clipMonitor->initMonitor(); - emit connectMonitors(); - //initProjectMonitor(); - //QTimer::singleShot(1500, this, SLOT(initProjectMonitor())); -} - -void MonitorManager::initProjectMonitor() { - //m_clipMonitor->stop(); - m_projectMonitor->initMonitor(); - // activateMonitor("project"); - emit connectMonitors(); -} void MonitorManager::activateMonitor(QString name) { if (m_activeMonitor == name) return; @@ -81,7 +65,7 @@ void MonitorManager::slotPlay() { } void MonitorManager::resetProfiles(QString prof) { - m_clipMonitor->resetProfile(prof); + //m_clipMonitor->resetProfile(prof); m_projectMonitor->resetProfile(prof); } diff --git a/src/monitormanager.h b/src/monitormanager.h index 6466002a..03eeaec6 100644 --- a/src/monitormanager.h +++ b/src/monitormanager.h @@ -46,12 +46,7 @@ private: QString m_activeMonitor; Timecode m_timecode; -private slots: - void initProjectMonitor(); - void initClipMonitor(); - signals: - void connectMonitors(); void raiseClipMonitor(bool); }; -- 2.39.2