aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2015-05-08 20:08:22 +0200
committerJean-Baptiste Mardelle <[email protected]>2015-05-08 20:08:22 +0200
commitde7f23e8d664703410695fe45c8535c37fd61e48 (patch)
tree4a9a523989048d7e2bb0c36e8db6dc9245984d07
parentce2fa3b7b04a48bbbb2e403f767a9fc8b139bea6 (diff)
Fix play/pause icon not updating, use KDualAction instead of old custom class
-rw-r--r--src/monitor/CMakeLists.txt1
-rw-r--r--src/monitor/glwidget.cpp7
-rw-r--r--src/monitor/glwidget.h1
-rw-r--r--src/monitor/monitor.cpp20
-rw-r--r--src/monitor/monitor.h5
-rw-r--r--src/timeline/customtrackview.h3
6 files changed, 25 insertions, 12 deletions
diff --git a/src/monitor/CMakeLists.txt b/src/monitor/CMakeLists.txt
index 12654d5..b838792 100644
--- a/src/monitor/CMakeLists.txt
+++ b/src/monitor/CMakeLists.txt
@@ -8,6 +8,5 @@ set(kdenlive_SRCS
monitor/monitorscene.cpp
monitor/recmonitor.cpp
monitor/smallruler.cpp
- monitor/twostateaction.cpp
monitor/sharedframe.cpp
PARENT_SCOPE)
diff --git a/src/monitor/glwidget.cpp b/src/monitor/glwidget.cpp
index 84194e6..f53d7dd 100644
--- a/src/monitor/glwidget.cpp
+++ b/src/monitor/glwidget.cpp
@@ -60,6 +60,7 @@ GLWidget::GLWidget()
, m_threadStopEvent(0)
, m_threadCreateEvent(0)
, m_threadJoinEvent(0)
+ , m_displayEvent(0)
, m_frameRenderer(0)
, m_zoom(1.0f)
, m_offset(QPoint(0, 0))
@@ -108,6 +109,7 @@ GLWidget::~GLWidget()
delete m_threadStopEvent;
delete m_threadCreateEvent;
delete m_threadJoinEvent;
+ delete m_displayEvent;
if (m_frameRenderer && m_frameRenderer->isRunning()) {
QMetaObject::invokeMethod(m_frameRenderer, "cleanup");
m_frameRenderer->quit();
@@ -693,12 +695,12 @@ int GLWidget::reconfigure(bool isMulti)
// Connect the producer to the consumer - tell it to "run" later
m_consumer->connect(*m_producer);
// Make an event handler for when a frame's image should be displayed
- m_consumer->listen("consumer-frame-show", this, (mlt_listener) on_frame_show);
+ delete m_displayEvent;
+ m_displayEvent = m_consumer->listen("consumer-frame-show", this, (mlt_listener) on_frame_show);
//m_consumer->set("real_time", MLT.realTime());
m_consumer->set("mlt_image_format", "yuv422");
//TODO:
//m_consumer->set("color_trc", Settings.playerGamma().toLatin1().constData());
-
if (isMulti) {
m_consumer->set("terminate_on_pause", 0);
m_consumer->set("0", serviceName.toLatin1().constData());
@@ -869,7 +871,6 @@ void GLWidget::on_frame_show(mlt_consumer, void* self, mlt_frame frame_ptr)
}
}
-
RenderThread::RenderThread(thread_function_t function, void *data, QOpenGLContext *context)
: QThread(0)
, m_function(function)
diff --git a/src/monitor/glwidget.h b/src/monitor/glwidget.h
index 2400df9..3228593 100644
--- a/src/monitor/glwidget.h
+++ b/src/monitor/glwidget.h
@@ -129,6 +129,7 @@ private:
Mlt::Event* m_threadStopEvent;
Mlt::Event* m_threadCreateEvent;
Mlt::Event* m_threadJoinEvent;
+ Mlt::Event* m_displayEvent;
FrameRenderer* m_frameRenderer;
int m_projectionLocation;
int m_modelViewLocation;
diff --git a/src/monitor/monitor.cpp b/src/monitor/monitor.cpp
index 48c267b..63c65ca 100644
--- a/src/monitor/monitor.cpp
+++ b/src/monitor/monitor.cpp
@@ -26,12 +26,12 @@
#include "mltcontroller/bincontroller.h"
#include "kdenlivesettings.h"
#include "timeline/abstractclipitem.h"
-#include "twostateaction.h"
#include "doc/kthumb.h"
#include "klocalizedstring.h"
#include <KRecentDirs>
#include <KMessageBox>
+#include <KDualAction>
#include <QDebug>
#include <QMouseEvent>
@@ -129,9 +129,11 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
QToolButton *playButton = new QToolButton(m_toolbar);
m_playMenu = new QMenu(i18n("Play..."), this);
- m_playAction = new TwostateAction(m_playIcon, i18n("Play"), m_pauseIcon, i18n("Pause"));
+ m_playAction = new KDualAction(i18n("Play"), i18n("Pause"), this);
+ m_playAction->setInactiveIcon(m_playIcon);
+ m_playAction->setActiveIcon(m_pauseIcon);
m_playMenu->addAction(m_playAction);
- connect(m_playAction, SIGNAL(triggered()), this, SLOT(slotPlay()));
+ connect(m_playAction, SIGNAL(activeChanged(bool)), this, SLOT(switchPlay(bool)));
playButton->setMenu(m_playMenu);
playButton->setPopupMode(QToolButton::MenuButtonPopup);
@@ -921,6 +923,12 @@ void Monitor::pause()
m_playAction->setActive(false);
}
+void Monitor::switchPlay(bool play)
+{
+ m_playAction->setActive(play);
+ render->switchPlay(play);
+}
+
void Monitor::slotPlay()
{
if (render == NULL) return;
@@ -1259,9 +1267,9 @@ void Monitor::onFrameDisplayed(const SharedFrame& frame)
m_rootItem->setProperty("framenum", QString::number(position));
}
seekCursor(position);
- if (position >= m_length)
- render->pause();
- //emit endOfStream();
+ if (position >= m_length) {
+ m_playAction->setActive(false);
+ }
}
AbstractRender *Monitor::abstractRender()
diff --git a/src/monitor/monitor.h b/src/monitor/monitor.h
index b33c552..78d6320 100644
--- a/src/monitor/monitor.h
+++ b/src/monitor/monitor.h
@@ -43,7 +43,7 @@ class ClipItem;
class Monitor;
class MonitorManager;
class QSlider;
-class TwostateAction;
+class KDualAction;
class QQuickItem;
class QScrollBar;
@@ -128,7 +128,7 @@ private:
QIcon m_pauseIcon;
/** @brief The widget showing current time position **/
TimecodeDisplay *m_timePos;
- TwostateAction *m_playAction;
+ KDualAction *m_playAction;
/** Has to be available so we can enable and disable it. */
QAction *m_loopClipAction;
QAction *m_effectCompare;
@@ -189,6 +189,7 @@ public slots:
void slotSeek(int pos);
void stop();
void start();
+ void switchPlay(bool play);
void slotPlay();
void slotPlayZone();
void slotLoopZone();
diff --git a/src/timeline/customtrackview.h b/src/timeline/customtrackview.h
index 9e420fa..a10ff28 100644
--- a/src/timeline/customtrackview.h
+++ b/src/timeline/customtrackview.h
@@ -115,6 +115,9 @@ public:
void clipStart();
void clipEnd();
void doChangeClipSpeed(ItemInfo info, const ItemInfo &speedIndependantInfo, const double speed, const double oldspeed, int strobe, const QString &id);
+ /** @brief Every command added to the undo stack automatically triggers a document change event.
+ * This function should only be called when changing a document setting or another function that
+ * is not integrated in the undo / redo system */
void setDocumentModified();
void setInPoint();
void setOutPoint();