]> git.sesse.net Git - kdenlive/blobdiff - src/kdenlivesettingsdialog.cpp
Work on firewire capture: dv should work, you now get a captured file dialog when...
[kdenlive] / src / kdenlivesettingsdialog.cpp
index 431f9170fa9b5137c5c7e95ba6f84ddcbdf3f665..67de3edc7e1505df33d47087bd805c93f5fc6200 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <KStandardDirs>
 #include <KDebug>
+#include <kopenwithdialog.h>
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -52,11 +53,12 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent): KConfigDialog(
     m_configEnv.tmppathurl->lineEdit()->setObjectName("kcfg_currenttmpfolder");
     m_configEnv.capturefolderurl->setMode(KFile::Directory);
     m_configEnv.capturefolderurl->lineEdit()->setObjectName("kcfg_capturefolder");
-    page2 = addPage(p2, i18n("Environnement"), "terminal");
+    page2 = addPage(p2, i18n("Environment"), "terminal");
 
     QWidget *p4 = new QWidget;
     m_configCapture.setupUi(p4);
     page4 = addPage(p4, i18n("Capture"), "audio-card");
+    m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture());
 
     QWidget *p5 = new QWidget;
     m_configShuttle.setupUi(p5);
@@ -84,16 +86,76 @@ 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()));
 
+    connect(m_configEnv.kp_image, SIGNAL(clicked()), this, SLOT(slotEditImageApplication()));
+    connect(m_configEnv.kp_audio, SIGNAL(clicked()), this, SLOT(slotEditAudioApplication()));
+    connect(m_configEnv.kp_player, SIGNAL(clicked()), this, SLOT(slotEditVideoApplication()));
+
     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() {}
 
+void KdenliveSettingsDialog::showPage(int page, int option) {
+    switch (page) {
+    case 1:
+        setCurrentPage(page1);
+        break;
+    case 2:
+        setCurrentPage(page2);
+        break;
+    case 3:
+        setCurrentPage(page3);
+        break;
+    case 4:
+        setCurrentPage(page4);
+        m_configCapture.tabWidget->setCurrentIndex(option);
+        break;
+    case 5:
+        setCurrentPage(page5);
+        break;
+
+    }
+}
+
+void KdenliveSettingsDialog::slotEditVideoApplication() {
+    KService::Ptr service;
+    KOpenWithDialog dlg(KUrl::List(), i18n("Select default video player"), m_configEnv.kcfg_defaultplayerapp->text(), this);
+    if (dlg.exec() != QDialog::Accepted)
+        return;
+
+    service = dlg.service();
+    m_configEnv.kcfg_defaultplayerapp->setText(service->exec());
+}
+
+void KdenliveSettingsDialog::slotEditAudioApplication() {
+    KService::Ptr service;
+    KOpenWithDialog dlg(KUrl::List(), i18n("Select default audio editor"), m_configEnv.kcfg_defaultaudioapp->text(), this);
+    if (dlg.exec() != QDialog::Accepted)
+        return;
+
+    service = dlg.service();
+    m_configEnv.kcfg_defaultaudioapp->setText(service->exec());
+}
+
+void KdenliveSettingsDialog::slotEditImageApplication() {
+    KService::Ptr service;
+    KOpenWithDialog dlg(KUrl::List(), i18n("Select default image editor"), m_configEnv.kcfg_defaultimageapp->text(), this);
+    if (dlg.exec() != QDialog::Accepted)
+        return;
+
+    service = dlg.service();
+    m_configEnv.kcfg_defaultimageapp->setText(service->exec());
+}
 
 void KdenliveSettingsDialog::slotCheckShuttle(int state) {
     m_configShuttle.config_group->setEnabled(state);
@@ -135,13 +197,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 +218,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");
 }