1 #pragma once 2 3 #ifndef COMBOVIEWER_PANE_INCLUDED 4 #define COMBOVIEWER_PANE_INCLUDED 5 6 #include "sceneviewer.h" 7 #include "toonzqt/intfield.h" 8 #include "toonzqt/keyframenavigator.h" 9 10 #include "toonzqt/flipconsoleowner.h" 11 #include "saveloadqsettings.h" 12 13 #include <QFrame> 14 15 class QPoint; 16 class QToolBar; 17 class QLabel; 18 class QSlider; 19 class QActionGroup; 20 class QButtonGroup; 21 class QToolBar; 22 class Ruler; 23 24 class Toolbar; 25 class TPanel; 26 class Ruler; 27 class FlipConsole; 28 class TXshLevel; 29 class ToolOptions; 30 31 //============================================================================= 32 // ComboViewerPanel 33 //----------------------------------------------------------------------------- 34 enum CV_Parts { 35 CVPARTS_None = 0, 36 CVPARTS_TOOLBAR = 0x1, 37 CVPARTS_TOOLOPTIONS = 0x2, 38 CVPARTS_FLIPCONSOLE = 0x4, 39 CVPARTS_End = 0x8, 40 CVPARTS_ALL = CVPARTS_TOOLBAR | CVPARTS_TOOLOPTIONS | CVPARTS_FLIPCONSOLE 41 }; 42 43 //----------------------------------------------------------------------------- 44 45 class ComboViewerPanel final : public QFrame, 46 public FlipConsoleOwner, 47 public SaveLoadQSettings { 48 Q_OBJECT 49 50 SceneViewer *m_sceneViewer; 51 FlipConsole *m_flipConsole; 52 ViewerKeyframeNavigator *m_keyFrameButton; 53 TPanelTitleBarButtonSet *m_referenceModeBs; 54 55 Toolbar *m_toolbar; 56 ToolOptions *m_toolOptions; 57 Ruler *m_vRuler; 58 Ruler *m_hRuler; 59 UINT m_visiblePartsFlag; 60 bool m_onionSkinActive = false; 61 bool m_playSound = true; 62 bool m_hasSoundtrack = false; 63 bool m_playing = false; 64 double m_fps; 65 int m_viewerFps; 66 double m_samplesPerFrame; 67 bool m_first = true; 68 TSoundTrack *m_sound = NULL; 69 70 TPanelTitleBarButton *m_previewButton; 71 TPanelTitleBarButton *m_subcameraPreviewButton; 72 73 public: 74 #if QT_VERSION >= 0x050500 75 ComboViewerPanel(QWidget *parent = 0, Qt::WindowFlags flags = 0); 76 #else 77 ComboViewerPanel(QWidget *parent = 0, Qt::WFlags flags = 0); 78 #endif 79 ~ComboViewerPanel(); 80 getSceneViewer()81 SceneViewer *getSceneViewer() { return m_sceneViewer; } getToolOptions()82 ToolOptions *getToolOptions() { return m_toolOptions; } 83 84 // toggle show/hide of the widgets according to m_visiblePartsFlag 85 void setVisiblePartsFlag(UINT flag); 86 void updateShowHide(); 87 void addShowHideContextMenu(QMenu *); 88 89 void onDrawFrame(int frame, 90 const ImagePainter::VisualSettings &settings) override; 91 onEnterPanel()92 void onEnterPanel() { 93 m_sceneViewer->setFocus(Qt::OtherFocusReason); 94 // activate shortcut key for this flipconsole 95 m_flipConsole->makeCurrent(); 96 } onLeavePanel()97 void onLeavePanel() { m_sceneViewer->clearFocus(); } 98 99 // SaveLoadQSettings 100 virtual void save(QSettings &settings) const override; 101 virtual void load(QSettings &settings) override; 102 103 void initializeTitleBar(TPanelTitleBar *titleBar); 104 105 protected: 106 void showEvent(QShowEvent *) override; 107 void hideEvent(QHideEvent *) override; 108 void createFrameToolBar(); 109 void createPlayToolBar(); 110 void addColorMaskButton(QWidget *parent, const char *iconSVGName, int id); 111 void contextMenuEvent(QContextMenuEvent *event) override; 112 void playAudioFrame(int frame); 113 bool hasSoundtrack(); 114 115 public slots: 116 void onSceneChanged(); 117 void changeWindowTitle(); 118 void updateFrameRange(); 119 void onXshLevelSwitched(TXshLevel *); 120 void onPlayingStatusChanged(bool playing); 121 // for showing/hiding the parts 122 void onShowHideActionTriggered(QAction *); 123 void enableFlipConsoleForCamerastand(bool on); 124 void onButtonPressed(FlipConsole::EGadget button); 125 void setFlipHButtonChecked(bool checked); 126 void setFlipVButtonChecked(bool checked); 127 128 protected slots: 129 void onFrameChanged(); 130 131 // need to update the preview marker as well as the frame range in flipconsole 132 void onFrameTypeChanged(); 133 134 void onSceneSwitched(); 135 void enableFullPreview(bool enabled); 136 void enableSubCameraPreview(bool enabled); 137 }; 138 139 #endif 140