Skip to content

Commit

Permalink
Fixed Animation Addition
Browse files Browse the repository at this point in the history
  • Loading branch information
jowin202 committed Feb 20, 2024
1 parent a3c4b5d commit e300730
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions animations/animationdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ void AnimationDialog::on_button_add_animation_clicked()
{
AnimationForm *item = new AnimationForm(opt, opt->data.value("animations").toArray().count());
this->ui->verticalLayout->addWidget(item);
this->save_data();
}

12 changes: 7 additions & 5 deletions animations/animationform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ AnimationForm::AnimationForm(options *opt, int animation_id) :

this->ui->spin_from->setValue(opt->data.value("animations").toArray().at(animation_id).toObject().value("from").toInt());
this->ui->spin_to->setValue(opt->data.value("animations").toArray().at(animation_id).toObject().value("to").toInt());
this->ui->spin_timer->setValue(opt->data.value("animations").toArray().at(animation_id).toObject().value("timer").toInt());

int delay = opt->data.value("animations").toArray().at(animation_id).toObject().value("timer").toInt();
this->ui->spin_timer->setValue( delay == 0 ? 16 : delay);

this->ui->check_overlay->setChecked(opt->data.value("animations").toArray().at(animation_id).toObject().value("overlay").toBool());
this->ui->check_pingpong->setChecked(opt->data.value("animations").toArray().at(animation_id).toObject().value("pingpong").toBool());
Expand Down Expand Up @@ -239,15 +241,15 @@ void AnimationForm::on_button_play_clicked()
void AnimationForm::on_spin_from_valueChanged(int arg1)
{
Q_UNUSED(arg1);
if (this->ui->spin_to->value() < this->ui->spin_from->value())
this->ui->spin_to->setValue(this->ui->spin_from->value());
if (this->ui->spin_to->value() <= this->ui->spin_from->value())
this->ui->spin_to->setValue(this->ui->spin_from->value()+1);
}


void AnimationForm::on_spin_to_valueChanged(int arg1)
{
Q_UNUSED(arg1);
if (this->ui->spin_to->value() < this->ui->spin_from->value())
this->ui->spin_from->setValue(this->ui->spin_to->value());
if (this->ui->spin_to->value() <= this->ui->spin_from->value())
this->ui->spin_from->setValue(this->ui->spin_to->value()-1);
}

1 change: 0 additions & 1 deletion animations/animationform.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ private slots:
void on_button_play_clicked();

void on_spin_from_valueChanged(int arg1);

void on_spin_to_valueChanged(int arg1);

private:
Expand Down
10 changes: 7 additions & 3 deletions animations/animationform.ui
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spin_to"/>
<widget class="QSpinBox" name="spin_to">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
Expand All @@ -45,8 +49,8 @@
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spin_timer">
<property name="value">
<number>16</number>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
Expand Down

0 comments on commit e300730

Please sign in to comment.