]> git.sesse.net Git - kdenlive/commitdiff
Start of the config dialog
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 30 Dec 2007 00:09:45 +0000 (00:09 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 30 Dec 2007 00:09:45 +0000 (00:09 +0000)
svn path=/branches/KDE4/; revision=1779

src/CMakeLists.txt
src/kdenlivesettings.kcfg [new file with mode: 0644]
src/kdenlivesettings.kcfgc [new file with mode: 0644]
src/mainwindow.cpp
src/mainwindow.h
src/projectlist.cpp
src/widgets/configmisc_ui.ui [new file with mode: 0644]

index a9afc59bb8e3031dd0b0a76652b1b9d8f4aa6bfc..3088830bae81bba8cfc0bdaf8e02e759c42302fd 100644 (file)
@@ -20,6 +20,7 @@ kde4_add_ui_files(kdenlive_UI
   widgets/timeline_ui.ui
   widgets/monitor_ui.ui
   widgets/colorclip_ui.ui
+  widgets/configmisc_ui.ui
 )
  
 set(kdenlive_SRCS 
@@ -37,8 +38,10 @@ set(kdenlive_SRCS
   timecode.cpp
 )
 
+kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc )
+
 kde4_add_executable(kdenlive ${kdenlive_SRCS} ${kdenlive_UI})
+
 target_link_libraries(kdenlive 
   ${KDE4_KDEUI_LIBS}
   ${KDE4_KIO_LIBS} 
@@ -47,5 +50,5 @@ target_link_libraries(kdenlive
 )
  
 install(TARGETS kdenlive DESTINATION ${BIN_INSTALL_DIR})
-install( FILES kdenliveui.rc 
-         DESTINATION  ${DATA_INSTALL_DIR}/kdenlive )
\ No newline at end of file
+install( FILES kdenliveui.rc DESTINATION  ${DATA_INSTALL_DIR}/kdenlive )
+install (FILES kdenlive.kcfg DESTINATION share/config.kcfg)
\ No newline at end of file
diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg
new file mode 100644 (file)
index 0000000..ecac237
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE kcfg SYSTEM
+    "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
+<kcfg>
+  <kcfgfile/>
+  <group name="misc">
+    <entry name="color_duration" type="String">
+      <label>Default color clip duration.</label>
+      <default>00:00:05:00</default>
+    </entry>
+    <entry name="image_duration" type="String">
+      <label>Default image clip duration.</label>
+      <default>00:00:05:00</default>
+    </entry>
+  </group>
+</kcfg>
\ No newline at end of file
diff --git a/src/kdenlivesettings.kcfgc b/src/kdenlivesettings.kcfgc
new file mode 100644 (file)
index 0000000..7e3d936
--- /dev/null
@@ -0,0 +1,4 @@
+File=kdenlivesettings.kcfg
+ClassName=KdenliveSettings
+Singleton=true
+Mutators=true
\ No newline at end of file
index 822d82c89256d0acc0fa81102ed5e793f08607da..79f8449ea17562299659c80237099e37a7b7b0af 100644 (file)
@@ -1,4 +1,6 @@
 
+
+#include <QTextStream>
  
 #include <KApplication>
 #include <KAction>
 #include <KIO/NetAccess>
 #include <KSaveFile>
 #include <KRuler>
-#include <QTextStream>
+#include <KConfigDialog>
+
 
 #include <mlt++/Mlt.h>
 
 #include "mainwindow.h"
 #include "trackview.h"
+#include "kdenlivesettings.h"
+#include "ui_configmisc_ui.h"
  
 MainWindow::MainWindow(QWidget *parent)
     : KXmlGuiWindow(parent),
@@ -107,6 +112,12 @@ void MainWindow::setupActions()
  
   KStandardAction::openNew(this, SLOT(newFile()),
                         actionCollection());
+
+  KStandardAction::openNew(this, SLOT(newFile()),
+                        actionCollection());
+
+  KStandardAction::preferences(this, SLOT(slotPreferences()),
+           actionCollection());
  
   setupGUI();
 }
@@ -176,4 +187,31 @@ void MainWindow::connectDocument(KdenliveDoc *doc) //changed
   //connect(doc, SIGNAL(addClip(QDomElement &)), m_projectList, SLOT(slotAddClip(QDomElement &)));
 }
 
+
+void MainWindow::slotPreferences()
+{
+  //An instance of your dialog could be already created and could be
+  // cached, in which case you want to display the cached dialog
+  // instead of creating another one
+  if ( KConfigDialog::showDialog( "settings" ) )
+    return;
+
+  // KConfigDialog didn't find an instance of this dialog, so lets
+  // create it :
+  KConfigDialog* dialog = new KConfigDialog(this, "settings",
+                                          KdenliveSettings::self());
+
+  QWidget *page1 = new QWidget;
+  Ui::ConfigMisc_UI* confWdg = new Ui::ConfigMisc_UI( );
+  confWdg->setupUi(page1);
+
+  dialog->addPage( page1, i18n("Misc"), "misc" );
+
+  //User edited the configuration - update your local copies of the
+  //configuration data
+  connect( dialog, SIGNAL(settingsChanged()), this, SLOT(updateConfiguration()) );
+
+  dialog->show();
+}
+
 #include "mainwindow.moc"
index 18e1cf203f5e0a8c45f4c7e6dc10ccab1079bdd6..af93385bb6b6db9c411daadbc5f4766dfefc6ada 100644 (file)
@@ -51,6 +51,7 @@ class MainWindow : public KXmlGuiWindow
     void saveFile();
     void saveFileAs();
     void saveFileAs(const QString &outputFileName);
+    void slotPreferences();
 };
  
 #endif
index 6635bb4c66478f9cc0db69e5cc1949d5e417132f..e0e29237f9342ba05e9d0fc012152dd9ce468dc4 100644 (file)
@@ -270,7 +270,7 @@ void ProjectList::addProducer(QDomElement producer)
     pix.fill(QColor(colour.left(7)));
     QStringList itemEntry;
     itemEntry.append(QString::null);
-    itemEntry.append(producer.attribute("name"););
+    itemEntry.append(producer.attribute("name"));
     ProjectItem *item = new ProjectItem(listView, itemEntry, producer);
     item->setIcon(0, QIcon(pix));
     item->setData(1, ClipTypeRole, (int) type);
diff --git a/src/widgets/configmisc_ui.ui b/src/widgets/configmisc_ui.ui
new file mode 100644 (file)
index 0000000..b4eab50
--- /dev/null
@@ -0,0 +1,80 @@
+<ui version="4.0" >
+ <class>ConfigMisc_UI</class>
+ <widget class="QWidget" name="ConfigMisc_UI" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>316</width>
+    <height>117</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" >
+   <item row="0" column="0" >
+    <widget class="QGroupBox" name="groupBox" >
+     <property name="title" >
+      <string>Default durations</string>
+     </property>
+     <layout class="QGridLayout" >
+      <item row="0" column="0" >
+       <widget class="QLabel" name="label" >
+        <property name="text" >
+         <string>Color clips</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1" >
+       <widget class="KRestrictedLine" name="kcfg_color_duration" >
+        <property name="inputMask" >
+         <string>99:99:99:99; </string>
+        </property>
+        <property name="text" >
+         <string>:::</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0" >
+       <widget class="QLabel" name="label_2" >
+        <property name="text" >
+         <string>Image clips</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1" >
+       <widget class="KRestrictedLine" name="kcfg_image_duration" >
+        <property name="inputMask" >
+         <string>99:99:99:99; </string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="0" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KRestrictedLine</class>
+   <extends>KLineEdit</extends>
+   <header>krestrictedline.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>