Skip to content

Commit

Permalink
Merge pull request #316 from pgilfernandez/duration_conversion
Browse files Browse the repository at this point in the history
Duration value converts from frames to seconds and viceversa
  • Loading branch information
rodlie authored Nov 12, 2024
2 parents d833157 + 8e99259 commit 9a57e3f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/ui/dialogs/scenesettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ SceneSettingsDialog::SceneSettingsDialog(const QString &name,
connect(mCancelButton, &QPushButton::released,
this, &SceneSettingsDialog::reject);
connect(this, &QDialog::rejected, this, &QDialog::close);
connect(mTypeTime, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &SceneSettingsDialog::updateDuration);

validate();

Expand Down Expand Up @@ -308,3 +310,19 @@ void SceneSettingsDialog::sNewSceneDialog(Document& document,

dialog->show();
}

void SceneSettingsDialog::updateDuration(int index)
{
const qreal fps = mFPSSpinBox->value();
switch(index) {
case 0: // Convert seconds to frames
mMinFrameSpin->setValue(qRound(mMinFrameSpin->value() * fps));
mMaxFrameSpin->setValue(qRound(mMaxFrameSpin->value() * fps));
break;
case 1: // Convert frames to seconds
mMinFrameSpin->setValue(qRound(mMinFrameSpin->value() / fps));
mMaxFrameSpin->setValue(qRound(mMaxFrameSpin->value() / fps));
break;
default:;
}
}
1 change: 1 addition & 0 deletions src/ui/dialogs/scenesettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class UI_EXPORT SceneSettingsDialog : public QDialog

private:
bool validate();
void updateDuration(int index);

Canvas * mTargetCanvas = nullptr;

Expand Down

0 comments on commit 9a57e3f

Please sign in to comment.