[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdereview/mplayerthumbs/src
From:       Marco Gulino <marco.gulino () gmail ! com>
Date:       2009-04-20 15:40:38
Message-ID: 1240242038.647241.2020.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 956778 by gulino:

runtime backend selection


 M  +1 -0      configuration/CMakeLists.txt  
 M  +21 -2     configuration/configDialog.ui  
 M  +3 -1      configuration/mplayerthumbscfg.cpp  
 M  +4 -0      mplayerthumbs.kcfg  
 M  +12 -7     servicesfactory.cpp  
 M  +1 -0      videobackendiface.h  


--- trunk/kdereview/mplayerthumbs/src/configuration/CMakeLists.txt #956777:956778
@@ -1,4 +1,5 @@
 set(mplayerthumbsconfig_SRCS main.cpp mplayerthumbscfg.cpp)
+include_directories( .. )
 kde4_add_kcfg_files(mplayerthumbsconfig_SRCS ../mplayerthumbs.kcfgc)
 kde4_add_ui_files(mplayerthumbsconfig_SRCS configDialog.ui mplayerConfig.ui)
 kde4_add_executable(mplayerthumbsconfig ${mplayerthumbsconfig_SRCS})
--- trunk/kdereview/mplayerthumbs/src/configuration/configDialog.ui #956777:956778
@@ -6,12 +6,26 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>477</width>
-    <height>493</height>
+    <width>405</width>
+    <height>277</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Backend</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="KComboBox" name="kcfg_backend"/>
+     </item>
+    </layout>
+   </item>
+   <item>
     <widget class="QCheckBox" name="kcfg_createStrips">
      <property name="text">
       <string>Create strips around thumbnails</string>
@@ -59,6 +73,11 @@
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KComboBox</class>
+   <extends>QComboBox</extends>
+   <header>kcombobox.h</header>
+  </customwidget>
+  <customwidget>
    <class>KEditListBox</class>
    <extends>QGroupBox</extends>
    <header>keditlistbox.h</header>
--- trunk/kdereview/mplayerthumbs/src/configuration/mplayerthumbscfg.cpp \
#956777:956778 @@ -19,6 +19,7 @@
  ***************************************************************************/
 
 #include "mplayerthumbscfg.h"
+#include "videobackendiface.h"
 #include <q3vbox.h>
 #include <klineedit.h>
 #include <kpushbutton.h>
@@ -49,7 +50,8 @@
 //     setFaceType(Plain);
     if(!config->mplayerbin().length() )
         QTimer::singleShot( 100, this, SLOT(autoFindPath()));
-
+    dialogUI->kcfg_backend->addItem(i18n("MPlayer"), VideoBackendIFace::MPlayer );
+    dialogUI->kcfg_backend->addItem(i18n("Phonon"), VideoBackendIFace::Phonon );
 }
 
 MPlayerThumbsConfig::~MPlayerThumbsConfig()
--- trunk/kdereview/mplayerthumbs/src/mplayerthumbs.kcfg #956777:956778
@@ -16,5 +16,9 @@
         <label>Create strips in thumbnail</label>
         <default>true</default>
     </entry>
+    <entry name="backend" type="Int">
+        <label>Backend</label>
+        <default>1</default>
+    </entry>
     </group>
 </kcfg>
--- trunk/kdereview/mplayerthumbs/src/servicesfactory.cpp #956777:956778
@@ -16,24 +16,29 @@
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
 */
-
+#include "constants.h"
 #include "servicesfactory.h"
 #include "previewingfile.h"
 #include "videobackendiface.h"
 #include "mplayervideobackend.h"
 #include "mplayerthumbs.h"
 #include "phononbackend.h"
-#define COMPILE_WITH_PHONON
 PreviewingFile* ServicesFactory::previewingFile(const QString& filePath, unsigned \
int scalingWidth, unsigned int scalingHeight, QObject* parent) {  return new \
PreviewingFile(filePath, scalingWidth, scalingHeight, parent);  }
 
 VideoBackendIFace *ServicesFactory::videoBackend(PreviewingFile* previewingFile, \
                MPlayerThumbsCfg* cfg) {
-#ifdef COMPILE_WITH_PHONON
-  return new PhononBackend(previewingFile, cfg);
-#else
-  return new MPlayerVideoBackend(previewingFile, cfg);
-#endif
+  kDebug(DBG_AREA) << "videopreview: backend: " << cfg->backend() << endl;
+  switch(cfg->backend() ) {
+    case VideoBackendIFace::MPlayer:
+      kDebug(DBG_AREA) << "videopreview: Selected mplayer backend\n";
+      return new MPlayerVideoBackend(previewingFile, cfg);
+    case VideoBackendIFace::Phonon:
+      kDebug(DBG_AREA) << "videopreview: Selected phonon backend\n";
+      return new PhononBackend(previewingFile, cfg);
+  }
+  // Well, we should never be here...
+  return NULL;
 }
 
 MPlayerThumbsCfg* ServicesFactory::config() {
--- trunk/kdereview/mplayerthumbs/src/videobackendiface.h #956777:956778
@@ -32,6 +32,7 @@
 public:
   VideoBackendIFace(PreviewingFile *previewingFile, MPlayerThumbsCfg* cfg);
   bool cannotPreview();
+  enum Backend { MPlayer=0, Phonon=1 };
 
   virtual Thumbnail *preview(FrameSelector *frameSelector) = 0;
   virtual bool readStreamInformation() = 0;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic