]> git.sesse.net Git - kdenlive/commitdiff
Allow to manually edit video4linux capture profile
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 11 Jun 2011 16:29:56 +0000 (16:29 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 11 Jun 2011 16:29:56 +0000 (16:29 +0000)
svn path=/trunk/kdenlive/; revision=5701

src/kdenlivesettingsdialog.cpp
src/kdenlivesettingsdialog.h
src/profilesdialog.cpp
src/profilesdialog.h
src/widgets/configcapture_ui.ui

index 950db589f7bd0b72491c7764b7026f91df7425e5..35a00e9508d89832122b24ffa5dc858afeeed83c 100644 (file)
@@ -111,6 +111,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map
     connect(m_configCapture.kcfg_detectedv4ldevices, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdatev4lDevice()));
     connect(m_configCapture.kcfg_v4l_format, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdatev4lCaptureProfile()));
     connect(m_configCapture.kcfg_v4l_captureaudio, SIGNAL(toggled(bool)), m_configCapture.kcfg_v4l_alsadevice, SLOT(setEnabled(bool)));
+    connect(m_configCapture.config_v4l, SIGNAL(clicked()), this, SLOT(slotEditVideo4LinuxProfile()));
 
     slotUpdatev4lDevice();
 #endif
@@ -828,7 +829,9 @@ void KdenliveSettingsDialog::slotUpdatev4lDevice()
     m_configCapture.kcfg_v4l_format->clear();
 
     QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
-    if (QFile::exists(vl4ProfilePath)) m_configCapture.kcfg_v4l_format->addItem(i18n("Current settings"));
+    if (QFile::exists(vl4ProfilePath)) {
+        m_configCapture.kcfg_v4l_format->addItem(i18n("Current settings"));
+    }
 
     QStringList pixelformats = info.split(">", QString::SkipEmptyParts);
     QString itemSize;
@@ -1013,6 +1016,17 @@ void KdenliveSettingsDialog::slotUpdateProxyProfile(int ix)
     //
 }
 
+void KdenliveSettingsDialog::slotEditVideo4LinuxProfile()
+{
+    QString vl4ProfilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
+    ProfilesDialog *w = new ProfilesDialog(vl4ProfilePath);
+    if (w->exec() == QDialog::Accepted) {
+        // save and update profile
+        loadCurrentV4lProfileInfo();
+    }
+    delete w;
+}
+
 #include "kdenlivesettingsdialog.moc"
 
 
index 7692fc07c90a0e4c0a824dfdf8b2db7776945029..6334af20fd71f46d9223a28955c26dc62815936a 100644 (file)
@@ -75,6 +75,7 @@ private slots:
     void slotUpdateDecklinkProfile(int ix = 0);
     void slotUpdateProxyProfile(int ix = 0);
     void slotUpdateV4lProfile(int ix = 0);
+    void slotEditVideo4LinuxProfile();
 
 private:
     KPageWidgetItem *m_page1;
index c9aa53c29f53d02588d7f7c357910ade2a2df235..c8c4a0dd80c5eb39da00a99446e560c98bc48f7d 100644 (file)
@@ -71,6 +71,47 @@ ProfilesDialog::ProfilesDialog(QWidget * parent) :
     connect(m_view.size_w, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
 }
 
+
+ProfilesDialog::ProfilesDialog(QString profilePath, QWidget * parent) :
+    QDialog(parent),
+    m_profileIsModified(false),
+    m_isCustomProfile(true),
+    m_customProfilePath(profilePath)
+{
+    m_view.setupUi(this);
+
+    // Fill colorspace list (see mlt_profile.h)
+    m_view.colorspace->addItem(getColorspaceDescription(601), 601);
+    m_view.colorspace->addItem(getColorspaceDescription(709), 709);
+    m_view.colorspace->addItem(getColorspaceDescription(240), 240);
+    m_view.colorspace->addItem(getColorspaceDescription(0), 0);
+
+    QStringList profilesFilter;
+    profilesFilter << "*";
+
+    m_view.button_save->setIcon(KIcon("document-save"));
+    m_view.button_save->setToolTip(i18n("Save profile"));
+    m_view.button_create->setHidden(true);
+    m_view.profiles_list->setHidden(true);
+    m_view.button_delete->setHidden(true);
+    m_view.button_default->setHidden(true);
+    m_view.description->setEnabled(false);
+
+    slotUpdateDisplay(profilePath);
+    connect(m_view.button_save, SIGNAL(clicked()), this, SLOT(slotSaveProfile()));
+
+    connect(m_view.description, SIGNAL(textChanged(const QString &)), this, SLOT(slotProfileEdited()));
+    connect(m_view.frame_num, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
+    connect(m_view.frame_den, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
+    connect(m_view.aspect_num, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
+    connect(m_view.aspect_den, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
+    connect(m_view.display_num, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
+    connect(m_view.display_den, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
+    connect(m_view.progressive, SIGNAL(stateChanged(int)), this, SLOT(slotProfileEdited()));
+    connect(m_view.size_h, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
+    connect(m_view.size_w, SIGNAL(valueChanged(int)), this, SLOT(slotProfileEdited()));
+}
+
 void ProfilesDialog::slotProfileEdited()
 {
     m_profileIsModified = true;
@@ -138,6 +179,10 @@ void ProfilesDialog::slotSetDefaultProfile()
 
 bool ProfilesDialog::slotSaveProfile()
 {
+    if (!m_customProfilePath.isEmpty()) {
+        saveProfile(m_customProfilePath);
+        return true;
+    }
     const QString profileDesc = m_view.description->text();
     int ix = m_view.profiles_list->findText(profileDesc);
     if (ix != -1) {
@@ -517,7 +562,7 @@ void ProfilesDialog::saveProfile(MltVideoProfile &profile, QString profilePath)
 }
 
 
-void ProfilesDialog::slotUpdateDisplay()
+void ProfilesDialog::slotUpdateDisplay(QString currentProfile)
 {
     if (askForSave() == false) {
         m_view.profiles_list->blockSignals(true);
@@ -527,7 +572,7 @@ void ProfilesDialog::slotUpdateDisplay()
     }
 
     m_selectedProfileIndex = m_view.profiles_list->currentIndex();
-    QString currentProfile = m_view.profiles_list->itemData(m_view.profiles_list->currentIndex()).toString();
+    if (currentProfile.isEmpty()) 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);
index ada0736a6fc0642d92ca16085f7b91a1b961bae1..c83cb4638b45619f313bb02df8c6c0960197368c 100644 (file)
@@ -31,6 +31,8 @@ class ProfilesDialog : public QDialog
 
 public:
     ProfilesDialog(QWidget * parent = 0);
+    /** @brief Using this constructor, the dialog only allows editing one profile. */
+    ProfilesDialog(QString profilePath, QWidget * parent = 0);
 
     void fillList(const QString selectedProfile = QString());
     static QMap< QString, QString > getSettingsForProfile(const QString profileName);
@@ -81,7 +83,7 @@ protected:
     virtual void closeEvent(QCloseEvent *event);
 
 private slots:
-    void slotUpdateDisplay();
+    void slotUpdateDisplay(QString currentProfile = QString());
     void slotCreateProfile();
     bool slotSaveProfile();
     void slotDeleteProfile();
@@ -94,6 +96,8 @@ private:
     int m_selectedProfileIndex;
     bool m_profileIsModified;
     bool m_isCustomProfile;
+    /** @brief If we are in single profile editing, should contain the path for this profile. */
+    QString m_customProfilePath;
     void saveProfile(const QString path);
     bool askForSave();
 };
index b8c838b6491fa03a18805486e35cd5586e2b4415..371a78d15cd57e3f6ef7d332e31cda0265ecbb0a 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>405</width>
-    <height>532</height>
+    <height>545</height>
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout_8">
         </spacer>
        </item>
        <item row="8" column="6" colspan="2">
-        <widget class="QPushButton" name="pushButton">
+        <widget class="QPushButton" name="config_v4l">
          <property name="text">
           <string>Edit</string>
          </property>