17 #include "onionskinwidget.h"
18 #include "ui_onionskin.h"
20 #include "preferencemanager.h"
24 OnionSkinWidget::OnionSkinWidget(
QWidget *parent) :
29 clearFocusOnFinished(ui->onionPrevFramesNumBox);
30 clearFocusOnFinished(ui->onionNextFramesNumBox);
31 clearFocusOnFinished(ui->onionMinOpacityBox);
32 clearFocusOnFinished(ui->onionMaxOpacityBox);
35 OnionSkinWidget::~OnionSkinWidget()
40 void OnionSkinWidget::initUI()
48 "QToolButton { border: 0px; } "
49 "QToolButton:pressed{ border: 1px solid #FFADAD; border-radius: 2px; background-color: #D5D5D5; }"
50 "QToolButton:checked{ border: 1px solid #ADADAD; border-radius: 2px; background-color: #D5D5D5; }";
55 void OnionSkinWidget::makeConnections()
58 connect(ui->onionMaxOpacityBox, spinBoxChanged,
this, &OnionSkinWidget::onionMaxOpacityChange);
59 connect(ui->onionMinOpacityBox, spinBoxChanged,
this, &OnionSkinWidget::onionMinOpacityChange);
60 connect(ui->onionPrevFramesNumBox, spinBoxChanged,
this, &OnionSkinWidget::onionPrevFramesNumChange);
61 connect(ui->onionNextFramesNumBox, spinBoxChanged,
this, &OnionSkinWidget::onionNextFramesNumChange);
72 connect(prefs, &PreferenceManager::optionChanged,
this, &OnionSkinWidget::updateUI);
76 void OnionSkinWidget::updateUI()
81 ui->onionPrevButton->setChecked(prefs->isOn(SETTING::PREV_ONION));
84 ui->onionNextButton->setChecked(prefs->isOn(SETTING::NEXT_ONION));
87 ui->onionBlueButton->setChecked(prefs->isOn(SETTING::ONION_BLUE));
89 ui->onionRedButton->setEnabled(ui->onionPrevButton->isChecked());
90 ui->onionBlueButton->setEnabled(ui->onionNextButton->isChecked());
93 ui->onionRedButton->setChecked(prefs->isOn(SETTING::ONION_RED));
95 ui->onionMaxOpacityBox->setValue(prefs->getInt(SETTING::ONION_MAX_OPACITY));
96 ui->onionMinOpacityBox->setValue(prefs->getInt(SETTING::ONION_MIN_OPACITY));
97 ui->onionPrevFramesNumBox->setValue(prefs->getInt(SETTING::ONION_PREV_FRAMES_NUM));
98 ui->onionNextFramesNumBox->setValue(prefs->getInt(SETTING::ONION_NEXT_FRAMES_NUM));
101 ui->onionSkinMode->setChecked(prefs->getString(SETTING::ONION_TYPE) ==
"absolute");
104 ui->onionWhilePlayback->setChecked(prefs->getInt(SETTING::ONION_WHILE_PLAYBACK));
108 void OnionSkinWidget::onionPrevButtonClicked(
bool isOn)
111 prefs->set(SETTING::PREV_ONION, isOn);
114 void OnionSkinWidget::onionNextButtonClicked(
bool isOn)
117 prefs->set(SETTING::NEXT_ONION, isOn);
120 void OnionSkinWidget::onionRedButtonClicked(
bool isOn)
123 prefs->set(SETTING::ONION_RED, isOn);
126 void OnionSkinWidget::onionBlueButtonClicked(
bool isOn)
129 prefs->set(SETTING::ONION_BLUE, isOn);
132 void OnionSkinWidget::onionMaxOpacityChange(
int value)
135 prefs->set(SETTING::ONION_MAX_OPACITY, value);
138 void OnionSkinWidget::onionMinOpacityChange(
int value)
141 prefs->set(SETTING::ONION_MIN_OPACITY, value);
144 void OnionSkinWidget::onionPrevFramesNumChange(
int value)
147 prefs->set(SETTING::ONION_PREV_FRAMES_NUM, value);
150 void OnionSkinWidget::onionNextFramesNumChange(
int value)
153 prefs->set(SETTING::ONION_NEXT_FRAMES_NUM, value);
156 void OnionSkinWidget::onionSkinModeChange(
int value)
161 prefs->set(SETTING::ONION_TYPE,
QString(
"absolute"));
165 prefs->set(SETTING::ONION_TYPE,
QString(
"relative"));
169 void OnionSkinWidget::playbackStateChanged(
int value)
172 prefs->set(SETTING::ONION_WHILE_PLAYBACK, value);
void stateChanged(int state)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)