[Digikam-devel] extragear/graphics/digikam/digikam

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Digikam-devel] extragear/graphics/digikam/digikam

Gilles Caulier-2
SVN commit 615356 by cgilles:

digiKam from trunk : Add a preview mode for multimedia files (video/sound) using an embedded instance of default KDE media player like a Kpart component.
For example, on Album view, select a video file taken with your camera and press F3. The KDE media player is loaded like an embedded widget and will play automaticly the movie. There is no external instance of KDE media player started outside digiKam. Just press ESC to go back on Album view.

BUGS: 132309
CCMAIL: [hidden email]

 M  +2 -1      Makefile.am  
 M  +35 -8     albumwidgetstack.cpp  
 M  +7 -2      albumwidgetstack.h  
 M  +16 -3     digikamview.cpp  
 AM            mediaplayerview.cpp   [License: GPL]
 AM            mediaplayerview.h   [License: GPL]
 D             welcomepage.cpp  
 D             welcomepage.h  
 A             welcomepageview.cpp   welcomepage.cpp#615327 [License: GPL]
 A             welcomepageview.h   welcomepage.h#615327 [License: GPL]


--- trunk/extragear/graphics/digikam/digikam/Makefile.am #615355:615356
@@ -72,6 +72,7 @@
                     kdatetimeedit.cpp \
                     kdatepickerpopup.cpp \
                     kipiinterface.cpp \
+    mediaplayerview.cpp \
                     monthwidget.cpp \
                     pixmapmanager.cpp \
                     ratingwidget.cpp \
@@ -88,7 +89,7 @@
                     tagfolderview.cpp \
                     tagspopupmenu.cpp \
                     upgradedb_sqlite2tosqlite3.cpp \
-    welcomepage.cpp
+    welcomepageview.cpp
 
 libdigikam_la_LIBADD = $(LIB_KIO) $(LIB_SQLITE3) $(LIB_KABC) $(LIB_KHTML) \
                $(LIBKIPI_LIBS) $(LIB_KUTILS) $(EXIV2_LIBS) \
--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.cpp #615355:615356
@@ -37,7 +37,8 @@
 #include "themeengine.h"
 #include "imagepreviewwidget.h"
 #include "albumiconview.h"
-#include "welcomepage.h"
+#include "welcomepageview.h"
+#include "mediaplayerview.h"
 #include "albumwidgetstack.h"
 #include "albumwidgetstack.moc"
 
@@ -57,6 +58,7 @@
         backButton         = 0;
         editButton         = 0;
         welcomePageView    = 0;
+        mediaPlayerView    = 0;
     }
 
     QPushButton        *backButton;
@@ -64,11 +66,13 @@
 
     QWidget            *buttonsArea;
 
-    WelcomePage        *welcomePageView;
+    WelcomePageView    *welcomePageView;
 
     ImagePreviewWidget *previewItemWidget;
 
     AlbumIconView      *previewAlbumWidget;
+
+    MediaPlayerView    *mediaPlayerView;
 };
 
 AlbumWidgetStack::AlbumWidgetStack(QWidget *parent)
@@ -99,20 +103,28 @@
     hlay->addWidget(d->editButton);
     hlay->addStretch(1);
 
-    // -- HTML help view -----------------------------------------------
+    // -- Welcome page view --------------------------------------------
 
-    d->welcomePageView = new WelcomePage(this);
+    d->welcomePageView = new WelcomePageView(this);
 
+    // -- Media player view --------------------------------------------
+
+    d->mediaPlayerView = new MediaPlayerView(this);
+
     // -- Stack widgets ------------------------------------------------
 
     addWidget(previewArea,                PreviewItemMode);
     addWidget(d->previewAlbumWidget,      PreviewAlbumMode);
     addWidget(d->welcomePageView->view(), WelcomePageMode);
+    addWidget(d->mediaPlayerView,         MediaPlayerMode);
 
     setPreviewMode(PreviewAlbumMode);
 
     // -----------------------------------------------------------------
 
+    connect(d->mediaPlayerView, SIGNAL( backToAlbumSignal() ),
+            this, SIGNAL( backToAlbumSignal() ) );
+
     connect(d->backButton, SIGNAL( clicked() ),
             this, SIGNAL( backToAlbumSignal() ) );
             
@@ -142,6 +154,12 @@
     d->buttonsArea->setPaletteBackgroundColor(ThemeEngine::instance()->baseColor());
 }
 
+void AlbumWidgetStack::slotEscapePreview()
+{
+    if (previewMode() == MediaPlayerMode)
+        d->mediaPlayerView->slotBackButtonClicked();
+}
+
 AlbumIconView* AlbumWidgetStack::albumIconView()
 {
     return d->previewAlbumWidget;
@@ -152,13 +170,21 @@
     return d->previewItemWidget;
 }
 
-void AlbumWidgetStack::setPreviewItem(const QString& path)
+void AlbumWidgetStack::setPreviewItem(const KURL& url)
 {
-    if (path.isNull())
+    if (url.isEmpty())
         slotPreviewFailed();
     
     visibleWidget()->setFocus();
-    d->previewItemWidget->setImagePath(path);
+
+    if (previewMode() == MediaPlayerMode)
+    {
+        d->mediaPlayerView->setMediaPlayerFromUrl(url);
+    }
+    else
+    {
+        d->previewItemWidget->setImagePath(url.path());
+    }
 }
 
 int AlbumWidgetStack::previewMode(void)
@@ -168,7 +194,8 @@
 
 void AlbumWidgetStack::setPreviewMode(int mode)
 {
-    if (mode != PreviewAlbumMode && mode != PreviewItemMode && mode != WelcomePageMode)
+    if (mode != PreviewAlbumMode && mode != PreviewItemMode &&
+        mode != WelcomePageMode  && mode != MediaPlayerMode)
         return;
 
     raiseWidget(mode);
--- trunk/extragear/graphics/digikam/digikam/albumwidgetstack.h #615355:615356
@@ -49,7 +49,8 @@
     {
         PreviewAlbumMode=0,
         PreviewItemMode,
-        WelcomePageMode
+        WelcomePageMode,
+        MediaPlayerMode
     };
 
 public:
@@ -60,7 +61,7 @@
     AlbumIconView* albumIconView();
     ImagePreviewWidget* imagePreviewWidget();
 
-    void setPreviewItem(const QString& path=QString::null);
+    void setPreviewItem(const KURL& url=QString::null);
     int  previewMode(void);
     void setPreviewMode(int mode);
 
@@ -69,6 +70,10 @@
     void backToAlbumSignal();    
     void editImageSignal();
 
+public slots:
+
+    void slotEscapePreview();
+
 private slots:
     
     void slotThemeChanged();
--- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #615355:615356
@@ -187,6 +187,9 @@
     connect(d->parent, SIGNAL(signalEscapePressed()),
             this, SLOT(slotEscapePreview()));
 
+    connect(d->parent, SIGNAL(signalEscapePressed()),
+            d->albumPreviews, SLOT(slotEscapePreview()));
+
     connect(d->parent, SIGNAL(signalNextItem()),
             this, SLOT(slotNextItem()));
 
@@ -623,7 +626,7 @@
     {
         d->rightSideBar->itemChanged(d->dispatchSelectedItem->imageInfo()->kurl(),
                                      d->iconView, d->dispatchSelectedItem, 0, 0);
-        d->albumPreviews->setPreviewItem(d->dispatchSelectedItem->imageInfo()->kurl().path());
+        d->albumPreviews->setPreviewItem(d->dispatchSelectedItem->imageInfo()->kurl());
         emit signal_imageSelected(true);
         d->dispatchSelectedItem = 0;
     }
@@ -831,7 +834,6 @@
 {
     if (d->albumPreviews->previewMode() == AlbumWidgetStack::PreviewAlbumMode)
     {
-        d->albumPreviews->setPreviewMode( AlbumWidgetStack::PreviewItemMode );
         AlbumIconItem *item=0;
 
         if (!iconItem)
@@ -848,7 +850,18 @@
             item = iconItem;
         }
 
-        d->albumPreviews->setPreviewItem( item->imageInfo()->kurl().path() );
+        AlbumSettings *settings      = AlbumSettings::instance();
+        QString currentFileExtension = item->imageInfo()->name().section( '.', -1 );
+        QString mediaplayerfilter    = settings->getMovieFileFilter().lower() +
+                                       settings->getMovieFileFilter().upper() +
+                                       settings->getAudioFileFilter().lower() +
+                                       settings->getAudioFileFilter().upper();
+        if ( !mediaplayerfilter.contains(currentFileExtension) )
+            d->albumPreviews->setPreviewMode( AlbumWidgetStack::PreviewItemMode );
+        else
+            d->albumPreviews->setPreviewMode( AlbumWidgetStack::MediaPlayerMode );
+
+        d->albumPreviews->setPreviewItem( item->imageInfo()->kurl() );
     }
     else
     {
** trunk/extragear/graphics/digikam/digikam/mediaplayerview.cpp #property svn:eol-style
   + native
** trunk/extragear/graphics/digikam/digikam/mediaplayerview.h #property svn:eol-style
   + native
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel