]> git.sesse.net Git - kdenlive/commitdiff
Save default profile
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 27 Mar 2008 00:54:39 +0000 (00:54 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 27 Mar 2008 00:54:39 +0000 (00:54 +0000)
svn path=/branches/KDE4/; revision=2127

src/kdenlivesettings.kcfg
src/kdenlivesettingsdialog.cpp
src/kdenlivesettingsdialog.h
src/profilesdialog.cpp
src/widgets/configmisc_ui.ui

index 83da9419c8d69eb182014f017e2592cf330435a5..4e94371e282e685bce9ffac5ca706d8c7d483358 100644 (file)
       <default>hdv_1080_50i</default>
     </entry>
 
+    <entry name="profiles_list" type="UInt">
+      <label>active project format.</label>
+      <default></default>
+    </entry>
+
     <entry name="showdescriptioncolumn" type="Bool">
       <label>Show descriptions in project tree view.</label>
       <default>true</default>
index 431f9170fa9b5137c5c7e95ba6f84ddcbdf3f665..85651bc08678942edb4768b3d9ea7475270e2d80 100644 (file)
@@ -84,12 +84,18 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent): KConfigDialog(
     connect(m_configCapture.kcfg_video4size, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
     connect(m_configCapture.kcfg_video4rate, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
 
+
     QStringList profilesNames = ProfilesDialog::getProfileNames();
-    m_configMisc.profiles_list->addItems(profilesNames);
-    m_defaulfProfile = ProfilesDialog::getSettingsFromFile(KdenliveSettings::default_profile()).value("description");
-    if (profilesNames.contains(m_defaulfProfile)) m_configMisc.profiles_list->setCurrentItem(m_defaulfProfile);
+    m_configMisc.kcfg_profiles_list->addItems(profilesNames);
+    m_defaultProfile = ProfilesDialog::getSettingsFromFile(KdenliveSettings::default_profile()).value("description");
+    if (profilesNames.contains(m_defaultProfile)) {
+        m_configMisc.kcfg_profiles_list->setCurrentItem(m_defaultProfile);
+        KdenliveSettings::setProfiles_list(profilesNames.indexOf(m_defaultProfile));
+    }
+
     slotUpdateDisplay();
-    connect(m_configMisc.profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
+
+    connect(m_configMisc.kcfg_profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
 }
 
 KdenliveSettingsDialog::~KdenliveSettingsDialog() {}
@@ -135,13 +141,20 @@ void KdenliveSettingsDialog::rebuildVideo4Commands() {
 }
 
 bool KdenliveSettingsDialog::hasChanged() {
-    kDebug() << "// // // KCONFIG hasChanged called";
-    if (m_configMisc.profiles_list->currentText() != m_defaulfProfile) return true;
+    kDebug() << "// // // KCONFIG hasChanged called: " << m_configMisc.kcfg_profiles_list->currentText() << ", " << m_defaultProfile;
+    if (m_configMisc.kcfg_profiles_list->currentText() != m_defaultProfile) return true;
     return KConfigDialog::hasChanged();
 }
 
+void KdenliveSettingsDialog::updateSettings() {
+    kDebug() << "// // // KCONFIG UPDATE called";
+    m_defaultProfile = m_configMisc.kcfg_profiles_list->currentText();
+    KdenliveSettings::setDefault_profile(m_defaultPath);
+    KConfigDialog::updateSettings();
+}
+
 void KdenliveSettingsDialog::slotUpdateDisplay() {
-    QString currentProfile = m_configMisc.profiles_list->currentText();
+    QString currentProfile = m_configMisc.kcfg_profiles_list->currentText();
     QMap< QString, QString > values = ProfilesDialog::getSettingsForProfile(currentProfile);
     m_configMisc.p_size->setText(values.value("width") + "x" + values.value("height"));
     m_configMisc.p_fps->setText(values.value("frame_rate_num") + "/" + values.value("frame_rate_den"));
@@ -149,6 +162,7 @@ void KdenliveSettingsDialog::slotUpdateDisplay() {
     m_configMisc.p_display->setText(values.value("display_aspect_num") + "/" + values.value("display_aspect_den"));
     if (values.value("progressive").toInt() == 0) m_configMisc.p_progressive->setText(i18n("Interlaced"));
     else m_configMisc.p_progressive->setText(i18n("Progressive"));
+    m_defaultPath = values.value("path");
 }
 
 
index c74e66c02c51d0881751f2f134cbc66b8064ca0a..486f952a45aabbb032d329a418ce44efd3487788 100644 (file)
@@ -40,6 +40,7 @@ public:
 
 protected:
     virtual bool hasChanged();
+    virtual void updateSettings();
 
 private slots:
     void slotUpdateDisplay();
@@ -61,7 +62,8 @@ private:
     QStringList m_mltProfilesList;
     QStringList m_customProfilesList;
     bool m_isCustomProfile;
-    QString m_defaulfProfile;
+    QString m_defaultProfile;
+    QString m_defaultPath;
 
 signals:
     void customChanged();
index e85b0e45c48fafb5dcda4fb9e667a3f90341e101..669899133eec304d177c8044a0946e37e8dc07ee 100644 (file)
@@ -192,7 +192,10 @@ QMap< QString, QString > ProfilesDialog::getSettingsForProfile(const QString pro
     for (int i = 0; i < profilesFiles.size(); ++i) {
         KConfig confFile(KdenliveSettings::mltpath() + "/" + profilesFiles.at(i));
         QMap< QString, QString > values = confFile.entryMap();
-        if (values.value("description") == profileName) return values;
+        if (values.value("description") == profileName) {
+            values.insert("path", profilesFiles.at(i));
+            return values;
+        }
     }
 
     // List custom profiles
@@ -202,7 +205,10 @@ QMap< QString, QString > ProfilesDialog::getSettingsForProfile(const QString pro
         for (int i = 0; i < profiles.size(); ++i) {
             KConfig confFile(customProfiles.at(i) + "/" + profiles.at(i));
             QMap< QString, QString > values = confFile.entryMap();
-            if (values.value("description") == profileName) return values;
+            if (values.value("description") == profileName) {
+                values.insert("path", customProfiles.at(i) + "/" + profiles.at(i));
+                return values;
+            }
         }
     }
     return QMap< QString, QString >();
index 6291c0930b38eab1dfbe58b19c0047a7ac9dce8b..da07e976075289d6c2ebfbc9a5a3c962386f354b 100644 (file)
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>369</width>
-    <height>241</height>
+    <height>245</height>
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout_4" >
@@ -64,7 +64,7 @@
        </widget>
       </item>
       <item row="0" column="1" >
-       <widget class="KComboBox" name="profiles_list" />
+       <widget class="KComboBox" name="kcfg_profiles_list" />
       </item>
       <item row="1" column="0" colspan="2" >
        <layout class="QGridLayout" name="gridLayout" >