X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fprofilesdialog.cpp;h=3a8d559a53867bc95706c5679be5bffa0b2abd66;hb=8394f0519919d546cc90d2626cbba423b09228f0;hp=d86ee605db75aad7ac27b99adf43608269d8cb20;hpb=4014b496a8d7d05e2c7e852a2c439500407fc5f5;p=kdenlive diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp index d86ee605..3a8d559a 100644 --- a/src/profilesdialog.cpp +++ b/src/profilesdialog.cpp @@ -228,6 +228,20 @@ MltVideoProfile ProfilesDialog::getVideoProfile(QString name) return result; } +// static +double ProfilesDialog::getStringEval(const MltVideoProfile &profile, QString eval) +{ + double result; + eval.replace("%width", QString::number(profile.width)); + eval.replace("%height", QString::number(profile.height)); + if (eval.contains('/')) result = (double) eval.section('/', 0, 0).toInt() / eval.section('/', 1, 1).toInt(); + else if (eval.contains('*')) result = (double) eval.section('*', 0, 0).toInt() * eval.section('*', 1, 1).toInt(); + else if (eval.contains('+')) result = (double) eval.section('+', 0, 0).toInt() + eval.section('+', 1, 1).toInt(); + else if (eval.contains('-')) result = (double) eval.section('-', 0, 0).toInt() - eval.section('-', 1, 1).toInt(); + else result = eval.toDouble(); + return result; +} + // static bool ProfilesDialog::existingProfileDescription(const QString &desc) @@ -447,6 +461,7 @@ void ProfilesDialog::slotUpdateDisplay() m_selectedProfileIndex = m_view.profiles_list->currentIndex(); QString currentProfile = m_view.profiles_list->itemData(m_view.profiles_list->currentIndex()).toString(); m_isCustomProfile = currentProfile.contains('/'); + m_view.button_create->setEnabled(true); m_view.button_delete->setEnabled(m_isCustomProfile); m_view.properties->setEnabled(m_isCustomProfile); m_view.button_save->setEnabled(m_isCustomProfile);