]> git.sesse.net Git - kdenlive/blobdiff - src/profilesdialog.cpp
- Add controls to zoom monitor scene
[kdenlive] / src / profilesdialog.cpp
index d86ee605db75aad7ac27b99adf43608269d8cb20..3a8d559a53867bc95706c5679be5bffa0b2abd66 100644 (file)
@@ -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);