From kde-commits Mon Apr 20 15:40:38 2009 From: Marco Gulino Date: Mon, 20 Apr 2009 15:40:38 +0000 To: kde-commits Subject: kdereview/mplayerthumbs/src Message-Id: <1240242038.647241.2020.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=124024204911998 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 @@ 0 0 - 477 - 493 + 405 + 277 + + + + + Backend + + + + + + + + + Create strips around thumbnails @@ -59,6 +73,11 @@ + KComboBox + QComboBox +
kcombobox.h
+
+ KEditListBox QGroupBox
keditlistbox.h
--- trunk/kdereview/mplayerthumbs/src/configuration/mplayerthumbscfg.cpp #956777:956778 @@ -19,6 +19,7 @@ ***************************************************************************/ #include "mplayerthumbscfg.h" +#include "videobackendiface.h" #include #include #include @@ -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 @@ true + + + 1 + --- 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;