]> git.sesse.net Git - kdenlive/commitdiff
some work on settings dialog (mlt path) and start of profiles management dialog
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 19 Feb 2008 20:29:26 +0000 (20:29 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 19 Feb 2008 20:29:26 +0000 (20:29 +0000)
svn path=/branches/KDE4/; revision=1876

src/CMakeLists.txt
src/effectslistview.cpp
src/kdenlivesettings.kcfg
src/kdenliveui.rc
src/mainwindow.cpp
src/mainwindow.h
src/widgets/configenv_ui.ui [new file with mode: 0644]
src/widgets/profiledialog_ui.ui [new file with mode: 0644]

index aca7020b97eaa24ebf965544d6792e545d25df08..7674f6d0749d9481033e7aec837eef186a228ae7 100644 (file)
@@ -24,8 +24,10 @@ kde4_add_ui_files(kdenlive_UI
   widgets/monitor_ui.ui
   widgets/colorclip_ui.ui
   widgets/configmisc_ui.ui
+  widgets/configenv_ui.ui
   widgets/effectlist_ui.ui
   widgets/effectstack_ui.ui
+  widgets/profiledialog_ui.ui
 )
  
 set(kdenlive_SRCS 
index 683aeac4f76670a4824e6edda0cba7202e0d5756..d8c7984c3529808e6b6656cd57de8e7192e0f559 100644 (file)
@@ -28,6 +28,7 @@ EffectsListView::EffectsListView(EffectsList *audioEffectList, EffectsList *vide
 {
   ui.setupUi(this);
   initList(0);
+  ui.search_effect->setListWidget(ui.effectlist);
   connect(ui.type_combo, SIGNAL(currentIndexChanged(int)), this, SLOT(initList(int)));
   connect(ui.button_info, SIGNAL(stateChanged(int)), this, SLOT(showInfoPanel(int)));
   connect(ui.effectlist, SIGNAL(itemSelectionChanged()), this, SLOT(slotUpdateInfo()));
index a11ea149baa353cee4d9920a7899d6c717d82a7b..9b19ae4f2e109c3e3f725c28ed38dc6ee0737ed3 100644 (file)
     </entry>
   </group>
 
+  <group name="env">
+    <entry name="mltpath" type="Path">
+      <label>Mlt framework install path.</label>
+      <default></default>
+    </entry>
+
+    <entry name="rendererpath" type="Path">
+      <label>Mlt inigo renderer install path.</label>
+      <default></default>
+    </entry>
+  </group>
+
   <group name="unmanaged">
     <entry name="project_display_ratio" type="Double">
       <label>Current project display ratio.</label>
index 4021c4388bc51a70b8edfe6887f2d7b6ef48c238..0d54dddb76a4228880504cec61b683b4a7c5038e 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<gui name="kdenlive" version="5">
+<gui name="kdenlive" version="7">
   <ToolBar name="extraToolBar" >
     <text>Extra Toolbar</text>
     <Action name="clear" />
     <Menu name="file" >
       <Action name="clear" />
     </Menu>
+
+    <Menu name="project" ><text>Project</text>
+      <Action name="clear" />
+    </Menu>
+
+    <Menu name="settings" >
+      <Action name="manage_profiles" />
+    </Menu>
   </MenuBar>
 </gui>
\ No newline at end of file
index 1e12c54a55338e5360cd16c3e23a7a0f5a10460e..4449df7f08395471e1197ce4e6061d209fd4f27b 100644 (file)
 #include <KConfigDialog>
 #include <KXMLGUIFactory>
 #include <KStatusBar>
+#include <kstandarddirs.h>
+#include <KUrlRequesterDialog>
 
 #include <mlt++/Mlt.h>
 
 #include "mainwindow.h"
 #include "kdenlivesettings.h"
 #include "ui_configmisc_ui.h"
+#include "ui_configenv_ui.h"
 #include "initeffects.h"
+#include "ui_profiledialog_ui.h"
 
 #define ID_STATUS_MSG 1
 #define ID_EDITMODE_MSG 2
@@ -57,6 +61,7 @@ MainWindow::MainWindow(QWidget *parent)
     : KXmlGuiWindow(parent),
       fileName(QString()), m_activeDocument(NULL), m_commandStack(NULL)
 {
+  parseProfiles();
   m_timelineArea = new KTabWidget(this);
   m_timelineArea->setHoverCloseButton(true);
   m_timelineArea->setTabReorderingEnabled(true);
@@ -214,6 +219,12 @@ void MainWindow::setupActions()
   actionCollection()->addAction("clear", clearAction);
   /*connect(clearAction, SIGNAL(triggered(bool)),
           textArea, SLOT(clear()));*/
+
+  KAction* profilesAction = new KAction(this);
+  profilesAction->setText(i18n("Manage Profiles"));
+  profilesAction->setIcon(KIcon("document-new"));
+  actionCollection()->addAction("manage_profiles", profilesAction);
+  connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
  
   KStandardAction::quit(kapp, SLOT(quit()),
                         actionCollection());
@@ -325,6 +336,85 @@ void MainWindow::openFile(const KUrl &url) //new
   //connectDocument(trackView, doc);
 }
 
+
+void MainWindow::parseProfiles()
+{
+       //kdDebug()<<" + + YOUR MLT INSTALL WAS FOUND IN: "<< MLT_PREFIX <<endl;
+       if (KdenliveSettings::mltpath().isEmpty()) {
+           KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
+       }
+       if (KdenliveSettings::rendererpath().isEmpty())
+       {
+           KdenliveSettings::setRendererpath(KStandardDirs::findExe("inigo"));
+       }
+       QStringList profilesFilter;
+       profilesFilter<<"*";
+       QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
+
+       if (profilesList.isEmpty()) {
+           // Cannot find MLT path, try finding inigo
+           QString profilePath = KdenliveSettings::rendererpath();
+           if (!profilePath.isEmpty()) {
+               profilePath = profilePath.section('/', 0, -3);
+               KdenliveSettings::setMltpath(profilePath + "/share/mlt/profiles/");
+               QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
+           }
+
+           if (profilesList.isEmpty()) {
+               // Cannot find the MLT profiles, ask for location
+               KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your Mlt profiles, please give the path"), this);
+               getUrl->fileDialog()->setMode(KFile::Directory);
+               getUrl->exec();
+               KUrl mltPath = getUrl->selectedUrl ();
+               delete getUrl;
+               if (mltPath.isEmpty()) exit(1);
+               KdenliveSettings::setMltpath(mltPath.path());
+               QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
+           }
+       }
+
+       if (KdenliveSettings::rendererpath().isEmpty()) {
+               // Cannot find the MLT inigo renderer, ask for location
+               KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find the inigo program required for rendering (part of Mlt)"), this);
+               getUrl->exec();
+               KUrl rendererPath = getUrl->selectedUrl();
+               delete getUrl;
+               if (rendererPath.isEmpty()) exit(1);
+               KdenliveSettings::setRendererpath(rendererPath.path());
+       }
+
+       kDebug()<<"RESULTING MLT PATH: "<<KdenliveSettings::mltpath();
+
+       // Parse MLT profiles to build a list of available video formats
+       if (profilesList.isEmpty()) parseProfiles();
+/*
+       uint i = 0;
+       for (; i < profilesList.count(); i++) { 
+           KConfig confFile(profilePath + *profilesList.at(i), true);
+           QString name = confFile.readEntry("description");
+           int width = confFile.readNumEntry("width");
+           int height = confFile.readNumEntry("height");
+           int aspect_num = confFile.readNumEntry("sample_aspect_num");
+           int aspect_den = confFile.readNumEntry("sample_aspect_den");
+           int display_num = confFile.readNumEntry("display_aspect_num");
+           int display_den = confFile.readNumEntry("display_aspect_den");
+           int fps_num = confFile.readNumEntry("frame_rate_num");
+           int fps_den = confFile.readNumEntry("frame_rate_den");
+           int progressive = confFile.readNumEntry("progressive");
+           if (!name.isEmpty()) m_projectTemplates[name] = formatTemplate(width, height, fps_num, fps_den, aspect_num, aspect_den, display_num, display_den, progressive, *profilesList.at(i));
+       }*/
+    }
+
+
+void MainWindow::slotEditProfiles()
+{
+  QDialog *w = new QDialog;
+  Ui::ProfilesDialog_UI profilesDialog;
+  profilesDialog.setupUi(w);
+  w->exec();
+}
+
+
 void MainWindow::slotUpdateMousePosition(int pos)
 {
   if (m_activeDocument)
@@ -398,9 +488,17 @@ void MainWindow::slotPreferences()
   QWidget *page1 = new QWidget;
   Ui::ConfigMisc_UI* confWdg = new Ui::ConfigMisc_UI( );
   confWdg->setupUi(page1);
-
   dialog->addPage( page1, i18n("Misc"), "misc" );
 
+  QWidget *page2 = new QWidget;
+  Ui::ConfigEnv_UI* confWdg2 = new Ui::ConfigEnv_UI( );
+  confWdg2->setupUi(page2);
+  confWdg2->kcfg_mltpath->setMode(KFile::Directory);
+
+  //WARNING: the 2 lines below should not be necessary, but does not work without it...
+  confWdg2->kcfg_mltpath->setPath(KdenliveSettings::mltpath());
+  confWdg2->kcfg_rendererpath->setPath(KdenliveSettings::rendererpath());
+  dialog->addPage( page2, i18n("Environnment"), "env" );
   //User edited the configuration - update your local copies of the
   //configuration data
   connect( dialog, SIGNAL(settingsChanged()), this, SLOT(updateConfiguration()) );
index d63851266172c90a0c2a51266067db775085981f..04255cb1b78f65e709872dff2ef657a99c1f58fb 100644 (file)
@@ -50,6 +50,8 @@ class MainWindow : public KXmlGuiWindow
   public:
     MainWindow(QWidget *parent=0);
 
+    void parseProfiles();
+
   protected:
     virtual bool queryClose();
   
@@ -115,6 +117,7 @@ class MainWindow : public KXmlGuiWindow
     void slotSetClipDuration(int id, int duration);
     void slotUpdateMousePosition(int pos);
     void slotAddEffect(int effectType, const QString &effectName);
+    void slotEditProfiles();
 };
  
 #endif
diff --git a/src/widgets/configenv_ui.ui b/src/widgets/configenv_ui.ui
new file mode 100644 (file)
index 0000000..be532b9
--- /dev/null
@@ -0,0 +1,66 @@
+<ui version="4.0" >
+ <class>ConfigEnv_UI</class>
+ <widget class="QWidget" name="ConfigEnv_UI" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>354</width>
+    <height>182</height>
+   </rect>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_2" >
+   <item row="0" column="0" >
+    <widget class="QGroupBox" name="groupBox" >
+     <property name="title" >
+      <string>Mlt environnement</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout" >
+      <item row="0" column="0" >
+       <widget class="QLabel" name="label" >
+        <property name="text" >
+         <string>Mlt profiles folder</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1" >
+       <widget class="KUrlRequester" name="kcfg_mltpath" />
+      </item>
+      <item row="1" column="0" >
+       <widget class="QLabel" name="label_2" >
+        <property name="text" >
+         <string>Inigo path</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1" >
+       <widget class="KUrlRequester" name="kcfg_rendererpath" />
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="0" >
+    <spacer name="verticalSpacer" >
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>20</width>
+       <height>56</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KUrlRequester</class>
+   <extends>QFrame</extends>
+   <header>kurlrequester.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/widgets/profiledialog_ui.ui b/src/widgets/profiledialog_ui.ui
new file mode 100644 (file)
index 0000000..1db8ba5
--- /dev/null
@@ -0,0 +1,280 @@
+<ui version="4.0" >
+ <class>ProfilesDialog_UI</class>
+ <widget class="QDialog" name="ProfilesDialog_UI" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>356</width>
+    <height>339</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Dialog</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_2" >
+   <item row="0" column="1" >
+    <widget class="KComboBox" name="kcombobox" />
+   </item>
+   <item row="0" column="0" >
+    <widget class="QLabel" name="label" >
+     <property name="text" >
+      <string>Profile</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="3" >
+    <widget class="KPushButton" name="kpushbutton" >
+     <property name="text" >
+      <string>Create</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="4" >
+    <widget class="KPushButton" name="kpushbutton_2" >
+     <property name="text" >
+      <string>Delete</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0" colspan="2" >
+    <widget class="KPushButton" name="kpushbutton_3" >
+     <property name="text" >
+      <string>Use as default</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="3" colspan="2" >
+    <widget class="QDialogButtonBox" name="buttonBox" >
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons" >
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="2" >
+    <spacer name="horizontalSpacer" >
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>40</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="1" column="0" colspan="5" >
+    <widget class="QGroupBox" name="groupBox" >
+     <property name="title" >
+      <string>Properties</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout" >
+      <item row="0" column="0" >
+       <widget class="QLabel" name="label_2" >
+        <property name="text" >
+         <string>Description</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1" colspan="3" >
+       <widget class="KLineEdit" name="klineedit" />
+      </item>
+      <item row="1" column="0" >
+       <widget class="QLabel" name="label_5" >
+        <property name="text" >
+         <string>Size</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1" >
+       <widget class="KIntSpinBox" name="kintspinbox_3" />
+      </item>
+      <item row="1" column="2" >
+       <widget class="QLabel" name="label_6" >
+        <property name="sizePolicy" >
+         <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text" >
+         <string>x</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="3" >
+       <widget class="KIntSpinBox" name="kintspinbox_4" />
+      </item>
+      <item row="2" column="0" >
+       <widget class="QLabel" name="label_3" >
+        <property name="text" >
+         <string>Frame rate</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1" >
+       <widget class="KIntSpinBox" name="kintspinbox" />
+      </item>
+      <item row="2" column="2" >
+       <widget class="QLabel" name="label_4" >
+        <property name="sizePolicy" >
+         <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text" >
+         <string>/</string>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="3" >
+       <widget class="KIntSpinBox" name="kintspinbox_2" />
+      </item>
+      <item row="3" column="0" >
+       <widget class="QLabel" name="label_9" >
+        <property name="text" >
+         <string>Aspect ratio</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1" >
+       <widget class="KIntSpinBox" name="kintspinbox_5" />
+      </item>
+      <item row="3" column="2" >
+       <widget class="QLabel" name="label_7" >
+        <property name="sizePolicy" >
+         <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text" >
+         <string>/</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="3" >
+       <widget class="KIntSpinBox" name="kintspinbox_6" />
+      </item>
+      <item row="4" column="0" >
+       <widget class="QLabel" name="label_10" >
+        <property name="text" >
+         <string>Display ratio</string>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="1" >
+       <widget class="KIntSpinBox" name="kintspinbox_7" />
+      </item>
+      <item row="4" column="2" >
+       <widget class="QLabel" name="label_8" >
+        <property name="sizePolicy" >
+         <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text" >
+         <string>/</string>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="3" >
+       <widget class="KIntSpinBox" name="kintspinbox_8" />
+      </item>
+      <item row="6" column="0" >
+       <spacer name="verticalSpacer" >
+        <property name="orientation" >
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0" >
+         <size>
+          <width>105</width>
+          <height>17</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item row="5" column="0" >
+       <widget class="QCheckBox" name="checkBox" >
+        <property name="text" >
+         <string>Progressive</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+  <zorder>kcombobox</zorder>
+  <zorder>label</zorder>
+  <zorder>kpushbutton</zorder>
+  <zorder>kpushbutton_2</zorder>
+  <zorder>kpushbutton_3</zorder>
+  <zorder>buttonBox</zorder>
+  <zorder>horizontalSpacer</zorder>
+  <zorder>groupBox</zorder>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KComboBox</class>
+   <extends>QComboBox</extends>
+   <header>kcombobox.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KIntSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>knuminput.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>klineedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KPushButton</class>
+   <extends>QPushButton</extends>
+   <header>kpushbutton.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>ProfilesDialog_UI</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>ProfilesDialog_UI</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel" >
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel" >
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>