X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitor.h;h=ff6b88fbe907bc0d538d054753c2ae0644ec9a56;hb=92e7620dd463e4188da378cee497d2135987f242;hp=647478d23bdef05c017b634ace1f985f7236ce1c;hpb=86930a8503d9ea42a4df2f58cf687d6f1d922bf6;p=kdenlive diff --git a/src/monitor.h b/src/monitor.h index 647478d2..ff6b88fb 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -21,73 +21,175 @@ #ifndef MONITOR_H #define MONITOR_H -#include +#include + #include #include #include +#include +#include "gentime.h" #include "ui_monitor_ui.h" -#include "renderer.h" -#include "monitormanager.h" -#include "smallruler.h" +#include "timecodedisplay.h" +#ifdef Q_WS_MAC +#include "videoglwidget.h" +#endif class MonitorManager; +class Render; +class SmallRuler; +class DocClipBase; +class MonitorScene; +class QGraphicsView; +class QGraphicsPixmapItem; + +class MonitorRefresh : public QWidget +{ + Q_OBJECT +public: + MonitorRefresh(QWidget *parent = 0); + virtual void paintEvent(QPaintEvent *event); + void setRenderer(Render* render); + +private: + Render *m_renderer; +}; + +class Overlay : public QLabel +{ + Q_OBJECT +public: + Overlay(QWidget* parent); + void setOverlayText(const QString &, bool isZone = true); + +private: + bool m_isZone; +}; -class Monitor : public QWidget { +class Monitor : public QWidget +{ Q_OBJECT public: - Monitor(QString name, MonitorManager *manager, QWidget *parent = 0); + Monitor(QString name, MonitorManager *manager, QString profile = QString(), QWidget *parent = 0); + virtual ~Monitor(); Render *render; - void resetProfile(QString prof); + void resetProfile(const QString profile); QString name() const; - + void resetSize(); + bool isActive() const; + void pause(); + void setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMenu *markerMenu = NULL); + const QString sceneList(); + DocClipBase *activeClip(); + GenTime position(); + void checkOverlay(); + void updateTimecodeFormat(); + void updateMarkers(DocClipBase *source); + MonitorScene *getEffectScene(); protected: virtual void mousePressEvent(QMouseEvent * event); + virtual void mouseReleaseEvent(QMouseEvent * event); + + /** @brief Move to another position on mouse wheel event. + * + * Moves towards the end of the clip/timeline on mouse wheel down/back, the + * opposite on mouse wheel up/forward. + * Ctrl + wheel moves by a second, without Ctrl it moves by a single frame. */ virtual void wheelEvent(QWheelEvent * event); - virtual void resizeEvent(QResizeEvent * event); -// virtual void paintEvent(QPaintEvent * event); + virtual void mouseMoveEvent(QMouseEvent *event); + virtual QStringList mimeTypes() const; + /*virtual void dragMoveEvent(QDragMoveEvent * event); + virtual Qt::DropActions supportedDropActions() const;*/ + + //virtual void resizeEvent(QResizeEvent * event); + //virtual void paintEvent(QPaintEvent * event); private: - Ui::Monitor_UI ui; - MonitorManager *m_monitorManager; + Ui::Monitor_UI m_ui; QString m_name; + MonitorManager *m_monitorManager; + DocClipBase *m_currentClip; + SmallRuler *m_ruler; + Overlay *m_overlay; + bool m_isActive; double m_scale; int m_length; - int m_position; - SmallRuler *m_ruler; + bool m_dragStarted; + MonitorRefresh *m_monitorRefresh; KIcon m_playIcon; KIcon m_pauseIcon; - bool m_isActive; - QToolBar *m_toolbar; - KRestrictedLine *m_timePos; + TimecodeDisplay *m_timePos; QAction *m_playAction; + QMenu *m_contextMenu; + QMenu *m_configMenu; + QMenu *m_playMenu; + QMenu *m_markerMenu; + QPoint m_DragStartPosition; + MonitorScene *m_effectScene; + QGraphicsView *m_effectView; +#ifdef Q_WS_MAC + VideoGLWidget *m_glWidget; +#endif + GenTime getSnapForPos(bool previous); private slots: - void adjustRulerSize(int length); void seekCursor(int pos); void rendererStopped(int pos); - void slotRewindOneFrame(); - void slotForwardOneFrame(); - void slotForward(); - void slotRewind(); + void slotExtractCurrentFrame(); + void slotSetThumbFrame(); + void slotSetSizeOneToOne(); + void slotSetSizeOneToTwo(); + void slotSaveZone(); + void slotSeek(); + void setClipZone(QPoint pos); + void slotSwitchMonitorInfo(bool show); + void slotSwitchDropFrames(bool show); + void slotGoToMarker(QAction *action); public slots: void slotOpenFile(const QString &); - void slotSetXml(const QDomElement &e); + void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1); void initMonitor(); - void refreshMonitor(bool visible); + void refreshMonitor(bool visible = true); void slotSeek(int pos); void stop(); void start(); void activateMonitor(); void slotPlay(); - void saveSceneList(QString path, QDomElement e = QDomElement()); + void slotPlayZone(); + void slotLoopZone(); + void slotForward(double speed = 0); + void slotRewind(double speed = 0); + void slotRewindOneFrame(int diff = 1); + void slotForwardOneFrame(int diff = 1); + void saveSceneList(QString path, QDomElement info = QDomElement()); + void slotStart(); + void slotEnd(); + void slotSetZoneStart(); + void slotSetZoneEnd(); + void slotZoneStart(); + void slotZoneEnd(); + void slotZoneMoved(int start, int end); + void slotSeekToNextSnap(); + void slotSeekToPreviousSnap(); + void adjustRulerSize(int length); + void setTimePos(const QString &pos); + QStringList getZoneInfo() const; + void slotEffectScene(bool show = true); + bool effectSceneDisplayed(); signals: void renderPosition(int); void durationChanged(int); + void refreshClipThumbnail(const QString &); + void adjustMonitorSize(); + void zoneUpdated(QPoint); + void saveZone(Render *, QPoint); + /** @brief Editing transitions / effects over the monitor requires thr renderer to send frames as QImage. + * This causes a major slowdown, so we only enable it if required */ + void requestFrameForAnalysis(bool); }; #endif