Skip to content

Commit

Permalink
more simplification and more robust code
Browse files Browse the repository at this point in the history
  • Loading branch information
pgilfernandez committed Nov 12, 2024
1 parent c29542f commit 8e99259
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
21 changes: 7 additions & 14 deletions src/ui/dialogs/scenesettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,25 +311,18 @@ void SceneSettingsDialog::sNewSceneDialog(Document& document,
dialog->show();
}

void SceneSettingsDialog::updateDuration() {
const QString typetime = mTypeTime->currentData().toString();
void SceneSettingsDialog::updateDuration(int index)
{
const qreal fps = mFPSSpinBox->value();
int index = mTypeTime->currentIndex();

if (mMinFrameSpin->value() >= mMaxFrameSpin->value()) {
return;
}

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

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

Canvas * mTargetCanvas = nullptr;

Expand Down

0 comments on commit 8e99259

Please sign in to comment.