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 updateSoundScrubIcon(bool soundScrubEnabled);
73 
74  void noTimecodeText();
75  void onlyFramesText();
76  void sffText();
77  void smpteText();
78 
79 private:
80  QPushButton* mPlayButton = nullptr;
81  QPushButton* mJumpToEndButton = nullptr;
82  QPushButton* mJumpToStartButton = nullptr;
83  QPushButton* mLoopButton = nullptr;
84  QPushButton* mSoundButton = nullptr;
85  QPushButton* mSoundScrubButton = nullptr;
86  QSpinBox* mFpsBox = nullptr;
87  QCheckBox* mPlaybackRangeCheckBox = nullptr;
88  QSpinBox* mLoopStartSpinBox = nullptr;
89  QSpinBox* mLoopEndSpinBox = nullptr;
90  QToolButton* mTimecodeSelect = nullptr;
91  QLabel* mTimecodeLabel = nullptr;
92  QAction* mNoTimecodeAction = nullptr;
93  QAction* mOnlyFramesAction = nullptr;
94  QAction* mSmpteAction = nullptr;
95  QAction* mSffAction = nullptr;
96  QAction* mTimecodeLabelAction = nullptr;
97 
98  QIcon mStartIcon;
99  QIcon mStopIcon;
100  QIcon mLoopIcon;
101  QIcon mSoundIcon;
102  QIcon mSoundScrubIcon;
103  QIcon mJumpToEndIcon;
104  QIcon mJumpToStartIcon;
105 
106  TimeLine* mTimeline = nullptr;
107  Editor* mEditor = nullptr;
108  int mFps = 12;
109  int mTimecodeLabelEnum;
110 };
111 
112 #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:55
QObject * parent() const const