18#include "timelinepage.h"
21#include "preferencemanager.h"
23#include "ui_timelinepage.h"
25TimelinePage::TimelinePage()
30 ui->timelineLength->setMaximum(MaxFramesBound);
35 connect(ui->timelineLength, spinBoxValueChange,
this, &TimelinePage::timelineLengthChanged);
37 connect(ui->radioButtonAddNewKey, &
QRadioButton::toggled,
this, &TimelinePage::drawEmptyKeyRadioButtonToggled);
38 connect(ui->radioButtonDuplicate, &
QRadioButton::toggled,
this, &TimelinePage::drawEmptyKeyRadioButtonToggled);
39 connect(ui->radioButtonDrawOnPrev, &
QRadioButton::toggled,
this, &TimelinePage::drawEmptyKeyRadioButtonToggled);
40 connect(ui->flipRollMsecsSlider, sliderChanged,
this, &TimelinePage::flipRollMsecSliderChanged);
41 connect(ui->flipRollMsecsSpinBox, spinBoxValueChange,
this, &TimelinePage::flipRollMsecSpinboxChanged);
42 connect(ui->flipRollNumDrawingsSlider, sliderChanged,
this, &TimelinePage::flipRollNumDrawingsSliderChanged);
43 connect(ui->flipRollNumDrawingsSpinBox, spinBoxValueChange,
this, &TimelinePage::flipRollNumDrawingsSpinboxChanged);
44 connect(ui->flipInBtwnMsecSlider, sliderChanged,
this, &TimelinePage::flipInbetweenMsecSliderChanged);
45 connect(ui->flipInBtwnMsecSpinBox, spinBoxValueChange,
this, &TimelinePage::flipInbetweenMsecSpinboxChanged);
46 connect(ui->soundScrubSlider, sliderChanged,
this, &TimelinePage::soundScrubMsecSliderChanged);
47 connect(ui->soundScrubSpinBox, spinBoxValueChange,
this, &TimelinePage::soundScrubMsecSpinboxChanged);
48 connect(ui->layerVisibilityComboBox, comboChanged,
this, &TimelinePage::layerVisibilityChanged);
49 connect(ui->visibilitySlider, &
QSlider::valueChanged,
this, &TimelinePage::layerVisibilityThresholdChanged);
50 connect(ui->visibilitySpinbox, spinBoxValueChange,
this, &TimelinePage::layerVisibilityThresholdChanged);
51 ui->visibilitySpinbox->setSuffix(
"%");
54TimelinePage::~TimelinePage()
59void TimelinePage::updateValues()
62 ui->scrubBox->setChecked(mManager->isOn(SETTING::SHORT_SCRUB));
65 ui->timelineLength->setValue(mManager->getInt(SETTING::TIMELINE_SIZE));
66 if (mManager->getString(SETTING::TIMELINE_SIZE).
toInt() <= 0)
67 ui->timelineLength->setValue(240);
72 int action = mManager->getInt(SETTING::DRAW_ON_EMPTY_FRAME_ACTION);
76 ui->radioButtonAddNewKey->setChecked(
true);
78 case DUPLICATE_PREVIOUS_KEY:
79 ui->radioButtonDuplicate->setChecked(
true);
81 case KEEP_DRAWING_ON_PREVIOUS_KEY:
82 ui->radioButtonDrawOnPrev->setChecked(
true);
89 int fps = mManager->getInt(SETTING::FPS);
90 int minMsec = 1000 / fps;
91 if (minMsec > 100) { minMsec = 100; }
92 ui->soundScrubSpinBox->setMinimum(minMsec);
93 ui->soundScrubSlider->setMinimum(minMsec);
95 ui->flipRollMsecsSlider->setValue(mManager->getInt(SETTING::FLIP_ROLL_MSEC));
96 ui->flipRollNumDrawingsSlider->setValue(mManager->getInt(SETTING::FLIP_ROLL_DRAWINGS));
97 ui->flipInBtwnMsecSlider->setValue(mManager->getInt(SETTING::FLIP_INBETWEEN_MSEC));
98 ui->flipRollMsecsSpinBox->setValue(mManager->getInt(SETTING::FLIP_ROLL_MSEC));
99 ui->flipRollNumDrawingsSpinBox->setValue(mManager->getInt(SETTING::FLIP_ROLL_DRAWINGS));
100 ui->flipInBtwnMsecSpinBox->setValue(mManager->getInt(SETTING::FLIP_INBETWEEN_MSEC));
101 ui->soundScrubSpinBox->setValue(mManager->getInt(SETTING::SOUND_SCRUB_MSEC));
102 ui->soundScrubSlider->setValue(mManager->getInt(SETTING::SOUND_SCRUB_MSEC));
104 int convertedVisibilityThreshold =
static_cast<int>(mManager->getFloat(SETTING::LAYER_VISIBILITY_THRESHOLD)*100);
106 ui->visibilitySlider->setValue(convertedVisibilityThreshold);
107 ui->visibilitySpinbox->setValue(convertedVisibilityThreshold);
109 int visibilityType = mManager->getInt(SETTING::LAYER_VISIBILITY);
110 ui->layerVisibilityComboBox->setCurrentIndex(visibilityType);
111 layerVisibilityChanged(visibilityType);
114void TimelinePage::timelineLengthChanged(
int value)
116 mManager->set(SETTING::TIMELINE_SIZE, value);
119void TimelinePage::fontSizeChanged(
int value)
121 mManager->set(SETTING::LABEL_FONT_SIZE, value);
124void TimelinePage::scrubChanged(
int value)
129void TimelinePage::layerVisibilityChanged(
int value)
131 mManager->set(SETTING::LAYER_VISIBILITY, value);
132 ui->visibilitySlider->setEnabled(value == 1);
133 ui->visibilitySpinbox->setEnabled(value == 1);
136void TimelinePage::layerVisibilityThresholdChanged(
int value)
138 float percentage =
static_cast<float>(value/100.0f);
139 mManager->set(SETTING::LAYER_VISIBILITY_THRESHOLD, percentage);
142 ui->visibilitySlider->setValue(value);
145 ui->visibilitySpinbox->setValue(value);
148void TimelinePage::drawEmptyKeyRadioButtonToggled(
bool)
150 if (ui->radioButtonAddNewKey->isChecked())
152 mManager->set(SETTING::DRAW_ON_EMPTY_FRAME_ACTION, CREATE_NEW_KEY);
154 else if (ui->radioButtonDuplicate->isChecked())
156 mManager->set(SETTING::DRAW_ON_EMPTY_FRAME_ACTION, DUPLICATE_PREVIOUS_KEY);
158 else if (ui->radioButtonDrawOnPrev->isChecked())
160 mManager->set(SETTING::DRAW_ON_EMPTY_FRAME_ACTION, KEEP_DRAWING_ON_PREVIOUS_KEY);
164void TimelinePage::flipRollMsecSliderChanged(
int value)
166 ui->flipRollMsecsSpinBox->setValue(value);
167 mManager->set(SETTING::FLIP_ROLL_MSEC, value);
170void TimelinePage::flipRollMsecSpinboxChanged(
int value)
172 ui->flipRollMsecsSlider->setValue(value);
173 mManager->set(SETTING::FLIP_ROLL_MSEC, value);
176void TimelinePage::flipRollNumDrawingsSliderChanged(
int value)
178 ui->flipRollNumDrawingsSpinBox->setValue(value);
179 mManager->set(SETTING::FLIP_ROLL_DRAWINGS, value);
182void TimelinePage::flipRollNumDrawingsSpinboxChanged(
int value)
184 ui->flipRollNumDrawingsSlider->setValue(value);
185 mManager->set(SETTING::FLIP_ROLL_DRAWINGS, value);
188void TimelinePage::flipInbetweenMsecSliderChanged(
int value)
190 ui->flipInBtwnMsecSpinBox->setValue(value);
191 mManager->set(SETTING::FLIP_INBETWEEN_MSEC, value);
194void TimelinePage::flipInbetweenMsecSpinboxChanged(
int value)
196 ui->flipInBtwnMsecSlider->setValue(value);
197 mManager->set(SETTING::FLIP_INBETWEEN_MSEC, value);
200void TimelinePage::soundScrubActiveChanged(
int i)
205 mManager->set(SETTING::SOUND_SCRUB_ACTIVE, b);
206 emit soundScrubChanged(b);
209void TimelinePage::soundScrubMsecSliderChanged(
int value)
211 ui->soundScrubSpinBox->setValue(value);
212 mManager->set(SETTING::SOUND_SCRUB_MSEC, value);
213 emit soundScrubMsecChanged(value);
216void TimelinePage::soundScrubMsecSpinboxChanged(
int value)
218 ui->soundScrubSlider->setValue(value);
219 mManager->set(SETTING::SOUND_SCRUB_MSEC, value);
220 emit soundScrubMsecChanged(value);
void valueChanged(int value)
void stateChanged(int state)
void currentIndexChanged(int index)
int toInt(bool *ok, int base) const const