]> git.sesse.net Git - kdenlive/commitdiff
Update effect list (show description & author name)
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 17 Feb 2008 10:04:44 +0000 (10:04 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 17 Feb 2008 10:04:44 +0000 (10:04 +0000)
svn path=/branches/KDE4/; revision=1852

src/CMakeLists.txt
src/effectslist.cpp
src/effectslist.h
src/effectslistview.cpp [new file with mode: 0644]
src/effectslistview.h [new file with mode: 0644]
src/mainwindow.cpp
src/mainwindow.h
src/widgets/effectlist_ui.ui [new file with mode: 0644]

index 5a7e95ec5253a9740b8268dbdf1dc2b556b17ed9..48adea655056f3fc0ca86f5a93856294e4861253 100644 (file)
@@ -24,6 +24,7 @@ kde4_add_ui_files(kdenlive_UI
   widgets/monitor_ui.ui
   widgets/colorclip_ui.ui
   widgets/configmisc_ui.ui
+  widgets/effectlist_ui.ui
 )
  
 set(kdenlive_SRCS 
@@ -60,6 +61,7 @@ set(kdenlive_SRCS
   clipmanager.cpp
   effectslist.cpp
   initeffects.cpp
+  effectslistview.cpp
 )
 
 kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc )
index 7007e7b1799ec3b5d990295ca001b85b1c42bb67..fbbc84616159fb95c4b5f4781a34951dfeb5ca66 100644 (file)
@@ -54,4 +54,14 @@ QStringList EffectsList::effectNames()
   return list;
 }
 
+QString EffectsList::getInfo(QString effectName)
+{
+  QString info;
+  QDomElement effect = getEffectByName(effectName);
+  QDomNode namenode = effect.elementsByTagName("description").item(0);
+  if (!namenode.isNull()) info = i18n(qstrdup(namenode.toElement().text().toUtf8()));
+  namenode = effect.elementsByTagName("author").item(0);
+  if (!namenode.isNull()) info.append(i18n("<br><b>Author:</b> ") + i18n(qstrdup(namenode.toElement().text().toUtf8())));
+  return info;
+}
 
index d555b25d469a6ce713b352d5d41b92d3742a55ff..d2c10dcb191f3f04be1894eeec77f9e9283d75ff 100644 (file)
@@ -35,6 +35,7 @@ class EffectsList:public QList < QDomElement > {
        /** Returns an XML version of this Effect.*/
   QDomElement getEffectByName(const QString & name);
   QStringList effectNames();
+  QString getInfo(QString effectName);
 
 };
 
diff --git a/src/effectslistview.cpp b/src/effectslistview.cpp
new file mode 100644 (file)
index 0000000..34b213a
--- /dev/null
@@ -0,0 +1,73 @@
+/***************************************************************************
+ *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+
+#include <KDebug>
+#include <KLocale>
+
+#include "effectslistview.h"
+
+EffectsListView::EffectsListView(EffectsList *audioEffectList, EffectsList *videoEffectList, EffectsList *customEffectList, QWidget *parent)
+    : QWidget(parent), m_audioList(audioEffectList), m_videoList(videoEffectList), m_customList(customEffectList)
+{
+  ui.setupUi(this);
+  initList();
+  connect(ui.video_button, SIGNAL(released()), this, SLOT(initList()));
+  connect(ui.audio_button, SIGNAL(released()), this, SLOT(initList()));
+  connect(ui.custom_button, SIGNAL(released()), this, SLOT(initList()));
+  connect(ui.effectlist, SIGNAL(itemSelectionChanged()), this, SLOT(slotDisplayInfo()));
+}
+
+void EffectsListView::initList()
+{
+  QStringList names;
+  if (ui.video_button->isChecked()) {
+    names = m_videoList->effectNames();
+  }
+  else if (ui.audio_button->isChecked()) {
+    names = m_audioList->effectNames();
+  }
+  if (ui.custom_button->isChecked()) {
+    names = m_customList->effectNames();
+  }
+  ui.effectlist->clear();
+  ui.effectlist->addItems(names);
+}
+
+void EffectsListView::slotDisplayInfo()
+{
+  QString info; 
+  if (ui.video_button->isChecked()) {
+    info = m_videoList->getInfo(ui.effectlist->currentItem()->text());
+  }
+  else if (ui.audio_button->isChecked()) {
+    info = m_audioList->getInfo(ui.effectlist->currentItem()->text());
+  }
+  if (ui.custom_button->isChecked()) {
+    info = m_customList->getInfo(ui.effectlist->currentItem()->text());
+  }
+  ui.infopanel->setText(info);
+}
+
+KListWidget *EffectsListView::listView()
+{
+  return ui.effectlist;
+}
+
+#include "effectslistview.moc"
diff --git a/src/effectslistview.h b/src/effectslistview.h
new file mode 100644 (file)
index 0000000..7050ac3
--- /dev/null
@@ -0,0 +1,51 @@
+/***************************************************************************
+ *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+
+#ifndef EFFECTLISTVIEW_H
+#define EFFECTLISTVIEW_H
+
+#include <KIcon>
+
+#include "ui_effectlist_ui.h"
+#include "effectslist.h"
+
+class EffectsListView : public QWidget
+{
+  Q_OBJECT
+  
+  public:
+    EffectsListView(EffectsList *audioEffectList, EffectsList *videoEffectList, EffectsList *customEffectList, QWidget *parent=0);
+    KListWidget *listView(); 
+
+  private:
+    Ui::EffectList_UI ui;
+    EffectsList *m_audioList;
+    EffectsList *m_videoList;
+    EffectsList *m_customList;
+
+  private slots:
+     void initList();
+    void slotDisplayInfo();
+
+  public slots:
+};
+
+#endif
index 926361496eb760e965ecfaf05ee12c51439b159a..20f14176f109684c3c04de7c6894f45eb52e638a 100644 (file)
@@ -71,7 +71,9 @@ MainWindow::MainWindow(QWidget *parent)
 
   effectListDock = new QDockWidget(i18n("Effect List"), this);
   effectListDock->setObjectName("effect_list");
-  m_effectList = new KListWidget(this);
+  m_effectList = new EffectsListView(&m_audioEffects, &m_videoEffects, &m_customEffects);
+
+  //m_effectList = new KListWidget(this);
   effectListDock->setWidget(m_effectList);
   addDockWidget(Qt::TopDockWidgetArea, effectListDock);
   
@@ -139,7 +141,6 @@ MainWindow::MainWindow(QWidget *parent)
   m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
 
   setAutoSaveSettings();
-  fillEffectsList();
   newFile();
 }
 
@@ -158,12 +159,6 @@ bool MainWindow::queryClose()
   }
 }
 
-void MainWindow::fillEffectsList()
-{
-  QStringList videoEffects = m_videoEffects.effectNames();
-  m_effectList->addItems(videoEffects);
-}
-
 void MainWindow::slotRaiseMonitor(bool clipMonitor)
 {
   if (clipMonitor) clipMonitorDock->raise();
index b2d676afc848c84938fafb7e673d7f3c44639529..ebd5f0798cc41084a8c3651ef68df9ae0ec673a9 100644 (file)
@@ -40,6 +40,7 @@
 #include "trackview.h"
 #include "customtrackview.h"
 #include "effectslist.h"
+#include "effectslistview.h"
 
 class MainWindow : public KXmlGuiWindow
 {
@@ -54,7 +55,6 @@ class MainWindow : public KXmlGuiWindow
   private:
     KTabWidget* m_timelineArea;
     void setupActions();
-    void fillEffectsList();
     QString fileName;
     KdenliveDoc *m_activeDocument;
     MonitorManager *m_monitorManager;
@@ -63,7 +63,8 @@ class MainWindow : public KXmlGuiWindow
     ProjectList *m_projectList;
 
     QDockWidget *effectListDock;
-    KListWidget *m_effectList;
+    EffectsListView *m_effectList;
+    //KListWidget *m_effectList;
 
     QDockWidget *effectStackDock;
     KListWidget *effectStack;
diff --git a/src/widgets/effectlist_ui.ui b/src/widgets/effectlist_ui.ui
new file mode 100644 (file)
index 0000000..dcbadd6
--- /dev/null
@@ -0,0 +1,84 @@
+<ui version="4.0" >
+ <class>EffectList_UI</class>
+ <widget class="QWidget" name="EffectList_UI" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>260</width>
+    <height>256</height>
+   </rect>
+  </property>
+  <layout class="QGridLayout" name="gridLayout" >
+   <property name="margin" >
+    <number>0</number>
+   </property>
+   <item row="0" column="0" colspan="2" >
+    <layout class="QHBoxLayout" name="horizontalLayout" >
+     <item>
+      <widget class="QRadioButton" name="video_button" >
+       <property name="text" >
+        <string>Video</string>
+       </property>
+       <property name="checked" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QRadioButton" name="audio_button" >
+       <property name="text" >
+        <string>Audio</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QRadioButton" name="custom_button" >
+       <property name="text" >
+        <string>Custom</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <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>
+    </layout>
+   </item>
+   <item row="1" column="0" >
+    <widget class="KListWidget" name="effectlist" />
+   </item>
+   <item row="1" column="1" >
+    <widget class="QTextEdit" name="infopanel" >
+     <property name="frameShape" >
+      <enum>QFrame::StyledPanel</enum>
+     </property>
+     <property name="frameShadow" >
+      <enum>QFrame::Sunken</enum>
+     </property>
+     <property name="readOnly" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KListWidget</class>
+   <extends>QListWidget</extends>
+   <header>klistwidget.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>