]> git.sesse.net Git - kdenlive/blobdiff - src/profilesdialog.cpp
Fix indentation mess from my previous commit. Improve detection of matching profile...
[kdenlive] / src / profilesdialog.cpp
index 70ecd1d7ed20b3b3fd216e52834c1e3936dc6c60..9710e12c857e7da5bce2fb1ef97a9a77bc10aaa8 100644 (file)
@@ -76,32 +76,32 @@ void ProfilesDialog::fillList(const QString selectedProfile)
     m_view.profiles_list->clear();
     QMap <QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
     QMapIterator<QString, QString> i(profilesInfo);
-    while(i.hasNext()) {
+    while (i.hasNext()) {
         i.next();
         m_view.profiles_list->addItem(i.key(), i.value());
     }
 
-    if(!KdenliveSettings::default_profile().isEmpty()) {
-        for(int i = 0; i < m_view.profiles_list->count(); i++) {
-            if(m_view.profiles_list->itemData(i).toString() == KdenliveSettings::default_profile()) {
+    if (!KdenliveSettings::default_profile().isEmpty()) {
+        for (int i = 0; i < m_view.profiles_list->count(); i++) {
+            if (m_view.profiles_list->itemData(i).toString() == KdenliveSettings::default_profile()) {
                 m_view.profiles_list->setCurrentIndex(i);
                 break;
             }
         }
     }
     int ix = m_view.profiles_list->findText(selectedProfile);
-    if(ix != -1) m_view.profiles_list->setCurrentIndex(ix);
+    if (ix != -1) m_view.profiles_list->setCurrentIndex(ix);
     m_selectedProfileIndex = m_view.profiles_list->currentIndex();
 }
 
 void ProfilesDialog::accept()
 {
-    if(askForSave()) QDialog::accept();
+    if (askForSave()) QDialog::accept();
 }
 
 void ProfilesDialog::closeEvent(QCloseEvent *event)
 {
-    if(askForSave()) {
+    if (askForSave()) {
         event->accept();
     } else {
         event->ignore();
@@ -110,8 +110,8 @@ void ProfilesDialog::closeEvent(QCloseEvent *event)
 
 bool ProfilesDialog::askForSave()
 {
-    if(!m_profileIsModified) return true;
-    if(KMessageBox::questionYesNo(this, i18n("The custom profile was modified, do you want to save it?")) != KMessageBox::Yes) return true;
+    if (!m_profileIsModified) return true;
+    if (KMessageBox::questionYesNo(this, i18n("The custom profile was modified, do you want to save it?")) != KMessageBox::Yes) return true;
     return slotSaveProfile();
 }
 
@@ -127,17 +127,17 @@ void ProfilesDialog::slotSetDefaultProfile()
 {
     int ix = m_view.profiles_list->currentIndex();
     QString path = m_view.profiles_list->itemData(ix).toString();
-    if(!path.isEmpty()) KdenliveSettings::setDefault_profile(path);
+    if (!path.isEmpty()) KdenliveSettings::setDefault_profile(path);
 }
 
 bool ProfilesDialog::slotSaveProfile()
 {
     const QString profileDesc = m_view.description->text();
     int ix = m_view.profiles_list->findText(profileDesc);
-    if(ix != -1) {
+    if (ix != -1) {
         // this profile name already exists
         const QString path = m_view.profiles_list->itemData(ix).toString();
-        if(!path.contains('/')) {
+        if (!path.contains('/')) {
             KMessageBox::sorry(this, i18n("A profile with same name already exists in MLT's default profiles, please choose another description for your custom profile."));
             return false;
         }
@@ -147,7 +147,7 @@ bool ProfilesDialog::slotSaveProfile()
         QString customName = "profiles/customprofile";
         QString profilePath = KStandardDirs::locateLocal("appdata", customName + QString::number(i));
         kDebug() << " TYING PROFILE FILE: " << profilePath;
-        while(KIO::NetAccess::exists(KUrl(profilePath), KIO::NetAccess::SourceSide, this)) {
+        while (KIO::NetAccess::exists(KUrl(profilePath), KIO::NetAccess::SourceSide, this)) {
             i++;
             profilePath = KStandardDirs::locateLocal("appdata", customName + QString::number(i));
         }
@@ -162,13 +162,13 @@ bool ProfilesDialog::slotSaveProfile()
 void ProfilesDialog::saveProfile(const QString path)
 {
     QFile file(path);
-    if(!file.open(QIODevice::WriteOnly)) {
+    if (!file.open(QIODevice::WriteOnly)) {
         KMessageBox::sorry(this, i18n("Cannot write to file %1", path));
         return;
     }
     QTextStream out(&file);
     out << "description=" << m_view.description->text() << "\n" << "frame_rate_num=" << m_view.frame_num->value() << "\n" << "frame_rate_den=" << m_view.frame_den->value() << "\n" << "width=" << m_view.size_w->value() << "\n" << "height=" << m_view.size_h->value() << "\n" << "progressive=" << m_view.progressive->isChecked() << "\n" << "sample_aspect_num=" << m_view.aspect_num->value() << "\n" << "sample_aspect_den=" << m_view.aspect_den->value() << "\n" << "display_aspect_num=" << m_view.display_num->value() << "\n" << "display_aspect_den=" << m_view.display_den->value() << "\n";
-    if(file.error() != QFile::NoError) {
+    if (file.error() != QFile::NoError) {
         KMessageBox::error(this, i18n("Cannot write to file %1", path));
     }
     file.close();
@@ -177,7 +177,7 @@ void ProfilesDialog::saveProfile(const QString path)
 void ProfilesDialog::slotDeleteProfile()
 {
     const QString path = m_view.profiles_list->itemData(m_view.profiles_list->currentIndex()).toString();
-    if(path.contains('/')) {
+    if (path.contains('/')) {
         KIO::NetAccess::del(KUrl(path), this);
         fillList();
     } else kDebug() << "//// Cannot delete profile " << path << ", does not seem to be custom one";
@@ -193,23 +193,23 @@ MltVideoProfile ProfilesDialog::getVideoProfile(QString name)
     profilesFilter << "*";
     QString path;
     bool isCustom = false;
-    if(name.contains('/')) isCustom = true;
+    if (name.contains('/')) isCustom = true;
 
-    if(!isCustom) {
+    if (!isCustom) {
         // List the Mlt profiles
         profilesFiles = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-        if(profilesFiles.contains(name)) path = KdenliveSettings::mltpath() + name;
+        if (profilesFiles.contains(name)) path = KdenliveSettings::mltpath() + name;
     }
-    if(isCustom || path.isEmpty()) {
+    if (isCustom || path.isEmpty()) {
         path = name;
     }
 
-    if(path.isEmpty() || !QFile::exists(path)) {
-        if(name == "dv_pal") {
+    if (path.isEmpty() || !QFile::exists(path)) {
+        if (name == "dv_pal") {
             kDebug() << "!!! WARNING, COULD NOT FIND DEFAULT MLT PROFILE";
             return result;
         }
-        if(name == KdenliveSettings::default_profile()) KdenliveSettings::setDefault_profile("dv_pal");
+        if (name == KdenliveSettings::default_profile()) KdenliveSettings::setDefault_profile("dv_pal");
         kDebug() << "// WARNING, COULD NOT FIND PROFILE " << name;
         return result;
     }
@@ -234,10 +234,10 @@ double ProfilesDialog::getStringEval(const MltVideoProfile &profile, QString eva
     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();
+    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;
 }
@@ -251,18 +251,18 @@ bool ProfilesDialog::existingProfileDescription(const QString &desc)
 
     // List the Mlt profiles
     QStringList profilesFiles = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-    for(int i = 0; i < profilesFiles.size(); ++i) {
+    for (int i = 0; i < profilesFiles.size(); ++i) {
         KConfig confFile(KdenliveSettings::mltpath() + profilesFiles.at(i), KConfig::SimpleConfig);
-        if(desc == confFile.entryMap().value("description")) return true;
+        if (desc == confFile.entryMap().value("description")) return true;
     }
 
     // List custom profiles
     QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
-    for(int i = 0; i < customProfiles.size(); ++i) {
+    for (int i = 0; i < customProfiles.size(); ++i) {
         profilesFiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
-        for(int j = 0; j < profilesFiles.size(); ++j) {
+        for (int j = 0; j < profilesFiles.size(); ++j) {
             KConfig confFile(customProfiles.at(i) + profilesFiles.at(j), KConfig::SimpleConfig);
-            if(desc == confFile.entryMap().value("description")) return true;
+            if (desc == confFile.entryMap().value("description")) return true;
         }
     }
     return false;
@@ -277,35 +277,35 @@ QString ProfilesDialog::existingProfile(MltVideoProfile profile)
 
     // Check the Mlt profiles
     QStringList profilesFiles = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-    for(int i = 0; i < profilesFiles.size(); ++i) {
+    for (int i = 0; i < profilesFiles.size(); ++i) {
         KConfig confFile(KdenliveSettings::mltpath() + profilesFiles.at(i), KConfig::SimpleConfig);
-        if(profile.display_aspect_den != confFile.entryMap().value("display_aspect_den").toInt()) continue;
-        if(profile.display_aspect_num != confFile.entryMap().value("display_aspect_num").toInt()) continue;
-        if(profile.sample_aspect_den != confFile.entryMap().value("sample_aspect_den").toInt()) continue;
-        if(profile.sample_aspect_num != confFile.entryMap().value("sample_aspect_num").toInt()) continue;
-        if(profile.width != confFile.entryMap().value("width").toInt()) continue;
-        if(profile.height != confFile.entryMap().value("height").toInt()) continue;
-        if(profile.frame_rate_den != confFile.entryMap().value("frame_rate_den").toInt()) continue;
-        if(profile.frame_rate_num != confFile.entryMap().value("frame_rate_num").toInt()) continue;
-        if(profile.progressive != confFile.entryMap().value("progressive").toInt()) continue;
+        if (profile.display_aspect_den != confFile.entryMap().value("display_aspect_den").toInt()) continue;
+        if (profile.display_aspect_num != confFile.entryMap().value("display_aspect_num").toInt()) continue;
+        if (profile.sample_aspect_den != confFile.entryMap().value("sample_aspect_den").toInt()) continue;
+        if (profile.sample_aspect_num != confFile.entryMap().value("sample_aspect_num").toInt()) continue;
+        if (profile.width != confFile.entryMap().value("width").toInt()) continue;
+        if (profile.height != confFile.entryMap().value("height").toInt()) continue;
+        if (profile.frame_rate_den != confFile.entryMap().value("frame_rate_den").toInt()) continue;
+        if (profile.frame_rate_num != confFile.entryMap().value("frame_rate_num").toInt()) continue;
+        if (profile.progressive != confFile.entryMap().value("progressive").toInt()) continue;
         return profilesFiles.at(i);
     }
 
     // Check custom profiles
     QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
-    for(int i = 0; i < customProfiles.size(); ++i) {
+    for (int i = 0; i < customProfiles.size(); ++i) {
         profilesFiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
-        for(int j = 0; j < profilesFiles.size(); ++j) {
+        for (int j = 0; j < profilesFiles.size(); ++j) {
             KConfig confFile(customProfiles.at(i) + profilesFiles.at(j), KConfig::SimpleConfig);
-            if(profile.display_aspect_den != confFile.entryMap().value("display_aspect_den").toInt()) continue;
-            if(profile.display_aspect_num != confFile.entryMap().value("display_aspect_num").toInt()) continue;
-            if(profile.sample_aspect_den != confFile.entryMap().value("sample_aspect_den").toInt()) continue;
-            if(profile.sample_aspect_num != confFile.entryMap().value("sample_aspect_num").toInt()) continue;
-            if(profile.width != confFile.entryMap().value("width").toInt()) continue;
-            if(profile.height != confFile.entryMap().value("height").toInt()) continue;
-            if(profile.frame_rate_den != confFile.entryMap().value("frame_rate_den").toInt()) continue;
-            if(profile.frame_rate_num != confFile.entryMap().value("frame_rate_num").toInt()) continue;
-            if(profile.progressive != confFile.entryMap().value("progressive").toInt()) continue;
+            if (profile.display_aspect_den != confFile.entryMap().value("display_aspect_den").toInt()) continue;
+            if (profile.display_aspect_num != confFile.entryMap().value("display_aspect_num").toInt()) continue;
+            if (profile.sample_aspect_den != confFile.entryMap().value("sample_aspect_den").toInt()) continue;
+            if (profile.sample_aspect_num != confFile.entryMap().value("sample_aspect_num").toInt()) continue;
+            if (profile.width != confFile.entryMap().value("width").toInt()) continue;
+            if (profile.height != confFile.entryMap().value("height").toInt()) continue;
+            if (profile.frame_rate_den != confFile.entryMap().value("frame_rate_den").toInt()) continue;
+            if (profile.frame_rate_num != confFile.entryMap().value("frame_rate_num").toInt()) continue;
+            if (profile.progressive != confFile.entryMap().value("progressive").toInt()) continue;
             return customProfiles.at(i) + profilesFiles.at(j);
         }
     }
@@ -321,20 +321,20 @@ QMap <QString, QString> ProfilesDialog::getProfilesInfo()
 
     // List the Mlt profiles
     QStringList profilesFiles = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-    for(int i = 0; i < profilesFiles.size(); ++i) {
+    for (int i = 0; i < profilesFiles.size(); ++i) {
         KConfig confFile(KdenliveSettings::mltpath() + profilesFiles.at(i), KConfig::SimpleConfig);
         QString desc = confFile.entryMap().value("description");
-        if(!desc.isEmpty()) result.insert(desc, profilesFiles.at(i));
+        if (!desc.isEmpty()) result.insert(desc, profilesFiles.at(i));
     }
 
     // List custom profiles
     QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
-    for(int i = 0; i < customProfiles.size(); ++i) {
+    for (int i = 0; i < customProfiles.size(); ++i) {
         profilesFiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
-        for(int j = 0; j < profilesFiles.size(); ++j) {
+        for (int j = 0; j < profilesFiles.size(); ++j) {
             KConfig confFile(customProfiles.at(i) + profilesFiles.at(j), KConfig::SimpleConfig);
             QString desc = confFile.entryMap().value("description");
-            if(!desc.isEmpty()) result.insert(desc, customProfiles.at(i) + profilesFiles.at(j));
+            if (!desc.isEmpty()) result.insert(desc, customProfiles.at(i) + profilesFiles.at(j));
         }
     }
     return result;
@@ -348,7 +348,7 @@ QMap< QString, QString > ProfilesDialog::getSettingsFromFile(const QString path)
     QStringList profilesFilter;
     profilesFilter << "*";
 
-    if(!path.contains('/')) {
+    if (!path.contains('/')) {
         // This is an MLT profile
         KConfig confFile(KdenliveSettings::mltpath() + path, KConfig::SimpleConfig);
         return confFile.entryMap();
@@ -369,10 +369,10 @@ QMap< QString, QString > ProfilesDialog::getSettingsForProfile(const QString pro
 
     // List the Mlt profiles
     profilesFiles = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-    for(int i = 0; i < profilesFiles.size(); ++i) {
+    for (int i = 0; i < profilesFiles.size(); ++i) {
         KConfig confFile(KdenliveSettings::mltpath() + profilesFiles.at(i), KConfig::SimpleConfig);
         QMap< QString, QString > values = confFile.entryMap();
-        if(values.value("description") == profileName) {
+        if (values.value("description") == profileName) {
             values.insert("path", profilesFiles.at(i));
             return values;
         }
@@ -380,12 +380,12 @@ QMap< QString, QString > ProfilesDialog::getSettingsForProfile(const QString pro
 
     // List custom profiles
     QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
-    for(int i = 0; i < customProfiles.size(); ++i) {
+    for (int i = 0; i < customProfiles.size(); ++i) {
         QStringList profiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
-        for(int j = 0; j < profiles.size(); ++j) {
+        for (int j = 0; j < profiles.size(); ++j) {
             KConfig confFile(customProfiles.at(i) + profiles.at(j), KConfig::SimpleConfig);
             QMap< QString, QString > values = confFile.entryMap();
-            if(values.value("description") == profileName) {
+            if (values.value("description") == profileName) {
                 values.insert("path", customProfiles.at(i) + profiles.at(j));
                 return values;
             }
@@ -395,7 +395,7 @@ QMap< QString, QString > ProfilesDialog::getSettingsForProfile(const QString pro
 }
 
 // static
-QString ProfilesDialog::getPathFromProperties(int width, int height, double fps, double par, double dar)
+QString ProfilesDialog::getPathFromProperties(int width, int height, double fps, bool useDisplayWidth)
 {
     QStringList profilesNames;
     QStringList profilesFiles;
@@ -403,26 +403,32 @@ QString ProfilesDialog::getPathFromProperties(int width, int height, double fps,
     profilesFilter << "*";
     // List the Mlt profiles
     profilesFiles = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-    for(int i = 0; i < profilesFiles.size(); ++i) {
+    for (int i = 0; i < profilesFiles.size(); ++i) {
         KConfig confFile(KdenliveSettings::mltpath() + profilesFiles.at(i), KConfig::SimpleConfig);
         QMap< QString, QString > values = confFile.entryMap();
-        if(values.value("width").toInt() == width && values.value("height").toInt() == height) {
+        int profileWidth;
+        if (useDisplayWidth) profileWidth = values.value("height").toInt() * values.value("display_aspect_num").toInt() / values.value("display_aspect_den").toInt() + 0.5;
+        else profileWidth = values.value("width").toInt();
+        if (profileWidth == width && values.value("height").toInt() == height) {
             double profile_fps = values.value("frame_rate_num").toDouble() / values.value("frame_rate_den").toDouble();
-            if(qAbs(profile_fps - fps) < 0.5)
+            if (fps <= 0 || qAbs(profile_fps - fps) < 0.5)
                 return profilesFiles.at(i);
         }
     }
 
     // List custom profiles
     QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
-    for(int i = 0; i < customProfiles.size(); ++i) {
+    for (int i = 0; i < customProfiles.size(); ++i) {
         QStringList profiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
-        for(int j = 0; j < profiles.size(); j++) {
+        for (int j = 0; j < profiles.size(); j++) {
             KConfig confFile(customProfiles.at(i) + profiles.at(j), KConfig::SimpleConfig);
             QMap< QString, QString > values = confFile.entryMap();
-            if(values.value("width").toInt() == width && values.value("height").toInt() == height) {
+            int profileWidth;
+            if (useDisplayWidth) profileWidth = values.value("height").toInt() * values.value("display_aspect_num").toInt() / values.value("display_aspect_den").toInt() + 0.5;
+            else profileWidth = values.value("width").toInt();
+            if (profileWidth == width && values.value("height").toInt() == height) {
                 double profile_fps = values.value("frame_rate_num").toDouble() / values.value("frame_rate_den").toDouble();
-                if(qAbs(profile_fps - fps) < 0.5)
+                if (fps <= 0 || qAbs(profile_fps - fps) < 0.5)
                     return customProfiles.at(i) + profiles.at(j);
             }
         }
@@ -440,20 +446,20 @@ QString ProfilesDialog::getPathFromDescription(const QString profileDesc)
 
     // List the Mlt profiles
     profilesFiles = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-    for(int i = 0; i < profilesFiles.size(); ++i) {
+    for (int i = 0; i < profilesFiles.size(); ++i) {
         KConfig confFile(KdenliveSettings::mltpath() + profilesFiles.at(i), KConfig::SimpleConfig);
         QMap< QString, QString > values = confFile.entryMap();
-        if(values.value("description") == profileDesc) return profilesFiles.at(i);
+        if (values.value("description") == profileDesc) return profilesFiles.at(i);
     }
 
     // List custom profiles
     QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
-    for(int i = 0; i < customProfiles.size(); ++i) {
+    for (int i = 0; i < customProfiles.size(); ++i) {
         QStringList profiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
-        for(int j = 0; j < profiles.size(); ++j) {
+        for (int j = 0; j < profiles.size(); ++j) {
             KConfig confFile(customProfiles.at(i) + profiles.at(j), KConfig::SimpleConfig);
             QMap< QString, QString > values = confFile.entryMap();
-            if(values.value("description") == profileDesc) return customProfiles.at(i) + profiles.at(j);
+            if (values.value("description") == profileDesc) return customProfiles.at(i) + profiles.at(j);
         }
     }
     return QString();
@@ -466,18 +472,18 @@ void ProfilesDialog::saveProfile(MltVideoProfile &profile)
     QString customName = "profiles/customprofile";
     QString profilePath = KStandardDirs::locateLocal("appdata", customName + QString::number(i));
     kDebug() << " TYING PROFILE FILE: " << profilePath;
-    while(KIO::NetAccess::exists(KUrl(profilePath), KIO::NetAccess::SourceSide, 0)) {
+    while (KIO::NetAccess::exists(KUrl(profilePath), KIO::NetAccess::SourceSide, 0)) {
         i++;
         profilePath = KStandardDirs::locateLocal("appdata", customName + QString::number(i));
     }
     QFile file(profilePath);
-    if(!file.open(QIODevice::WriteOnly)) {
+    if (!file.open(QIODevice::WriteOnly)) {
         KMessageBox::sorry(0, i18n("Cannot write to file %1", profilePath));
         return;
     }
     QTextStream out(&file);
     out << "description=" << profile.description << "\n" << "frame_rate_num=" << profile.frame_rate_num << "\n" << "frame_rate_den=" << profile.frame_rate_den << "\n" << "width=" << profile.width << "\n" << "height=" << profile.height << "\n" << "progressive=" << profile.progressive << "\n" << "sample_aspect_num=" << profile.sample_aspect_num << "\n" << "sample_aspect_den=" << profile.sample_aspect_den << "\n" << "display_aspect_num=" << profile.display_aspect_num << "\n" << "display_aspect_den=" << profile.display_aspect_den << "\n";
-    if(file.error() != QFile::NoError) {
+    if (file.error() != QFile::NoError) {
         KMessageBox::error(0, i18n("Cannot write to file %1", profilePath));
     }
     file.close();
@@ -487,7 +493,7 @@ void ProfilesDialog::saveProfile(MltVideoProfile &profile)
 
 void ProfilesDialog::slotUpdateDisplay()
 {
-    if(askForSave() == false) {
+    if (askForSave() == false) {
         m_view.profiles_list->blockSignals(true);
         m_view.profiles_list->setCurrentIndex(m_selectedProfileIndex);
         m_view.profiles_list->blockSignals(false);
@@ -512,10 +518,10 @@ void ProfilesDialog::slotUpdateDisplay()
     m_view.frame_num->setValue(values.value("frame_rate_num").toInt());
     m_view.frame_den->setValue(values.value("frame_rate_den").toInt());
     m_view.progressive->setChecked(values.value("progressive").toInt());
-    if(values.value("progressive").toInt()) {
-        m_view.fields->setText(QString::number((double)values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2));
+    if (values.value("progressive").toInt()) {
+        m_view.fields->setText(QString::number((double) values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2));
     } else {
-        m_view.fields->setText(QString::number((double)2 * values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2));
+        m_view.fields->setText(QString::number((double) 2 * values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2));
     }
     m_profileIsModified = false;
 }