All Classes Namespaces Functions Variables Enumerations Properties Pages
timecontrols.h
1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2020 Matthew Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 */
17 #ifndef TIMECONTROL_H
18 #define TIMECONTROL_H
19 
20 #include <QWidget>
21 #include <QToolBar>
22 #include <QPushButton>
23 #include <QToolButton>
24 #include <QSpinBox>
25 #include <QCheckBox>
26 #include <QLabel>
27 
28 class Editor;
29 class PreferenceManager;
30 class TimeLine;
31 
32 class TimeControls : public QToolBar
33 {
34  Q_OBJECT
35 
36 public:
37  TimeControls(TimeLine* parent = nullptr);
38  void initUI();
39  void updateUI();
40  void setEditor(Editor* editor);
41  void setFps(int value);
42  void setLoop(bool);
43  void setRangeState(bool);
44 
45  void updateLength(int frameLength);
46  void updatePlayState();
47 
48  int getRangeLower() { return mPlaybackRangeCheckBox->isChecked() ? mLoopStartSpinBox->value() : -1; }
49  int getRangeUpper() { return mPlaybackRangeCheckBox->isChecked() ? mLoopEndSpinBox->value() : -1; }
50 
51 signals:
52  void soundToggled(bool);
53  void soundScrubToggled(bool);
54  void fpsChanged(int);
55  void playButtonTriggered();
56 
57 public slots:
59  void onFpsEditingFinished();
60  void updateTimecodeLabel(int frame);
61 
62 private:
63  void makeConnections();
64 
65  void playButtonClicked();
66  void jumpToStartButtonClicked();
67  void jumpToEndButtonClicked();
68  void loopButtonClicked(bool bChecked);
69  void playbackRangeClicked(bool bChecked);
70  void loopStartValueChanged(int);
71  void loopEndValueChanged(int);
72  void updateSoundIcon(bool soundEnabled);
73  void updateSoundScrubIcon(bool soundScrubEnabled);
74 
75  void noTimecodeText();
76  void onlyFramesText();
77  void sffText();
78  void smpteText();
79 
80 private:
81  QPushButton* mPlayButton = nullptr;
82  QPushButton* mJumpToEndButton = nullptr;
83  QPushButton* mJumpToStartButton = nullptr;
84  QPushButton* mLoopButton = nullptr;
85  QPushButton* mSoundButton = nullptr;
86  QPushButton* mSoundScrubButton = nullptr;
87  QSpinBox* mFpsBox = nullptr;
88  QCheckBox* mPlaybackRangeCheckBox = nullptr;
89  QSpinBox* mLoopStartSpinBox = nullptr;
90  QSpinBox* mLoopEndSpinBox = nullptr;
91  QToolButton* mTimecodeSelect = nullptr;
92  QLabel* mTimecodeLabel = nullptr;
93  QAction* mNoTimecodeAction = nullptr;
94  QAction* mOnlyFramesAction = nullptr;
95  QAction* mSmpteAction = nullptr;
96  QAction* mSffAction = nullptr;
97  QAction* mTimecodeLabelAction = nullptr;
98 
99  QIcon mStartIcon;
100  QIcon mStopIcon;
101  QIcon mLoopIcon;
102  QIcon mSoundIcon;
103  QIcon mSoundScrubIcon;
104  QIcon mJumpToEndIcon;
105  QIcon mJumpToStartIcon;
106 
107  TimeLine* mTimeline = nullptr;
108  Editor* mEditor = nullptr;
109  int mFps = 12;
110  int mTimecodeLabelEnum;
111 };
112 
113 #endif
void onFpsEditingFinished()
Work-around in case the FPS spin-box "valueChanged" signal doesn't work.
Q_OBJECTQ_OBJECT
bool isChecked() const const
Definition: editor.h:51
QObject * parent() const const