Browse files

Always use internal player for video in mythgallery

  • Loading branch information...
1 parent 7460dc5 commit 9135b216787f9bd5b67089ceca64ece2df9ae593 @stuartm stuartm committed Jan 22, 2012
View
11 mythplugins/mythgallery/mythgallery/gallerysettings.cpp
@@ -83,16 +83,6 @@ static HostComboBox *MythGallerySortOrder()
return gc;
};
-static HostLineEdit *MythGalleryMoviePlayerCmd()
-{
- HostLineEdit *gc = new HostLineEdit("GalleryMoviePlayerCmd");
- gc->setLabel(QObject::tr("Command run to display movie files"));
- gc->setValue("mplayer -fs %s");
- gc->setHelpText(QObject::tr("This command is executed whenever a movie "
- "file is selected"));
- return gc;
-};
-
static HostSpinBox *MythGalleryOverlayCaption()
{
HostSpinBox *gc = new HostSpinBox("GalleryOverlayCaption", 0, 600, 1);
@@ -264,7 +254,6 @@ GallerySettings::GallerySettings()
general->addChild(MythGallerySortOrder());
general->addChild(MythGalleryImportDirs());
general->addChild(MythGalleryAutoLoad());
- general->addChild(MythGalleryMoviePlayerCmd());
general->addChild(MythGalleryFilter());
general->addChild(MythGalleryFilterType());
addChild(general);
View
41 mythplugins/mythgallery/mythgallery/galleryutil.cpp
@@ -18,6 +18,7 @@
// qt
#include <QDir>
+#include <QApplication>
// myth
#include <mythcontext.h>
@@ -26,6 +27,7 @@
#include <mythdirs.h>
#include <mythdb.h>
#include <mythuihelper.h>
+#include <mythmainwindow.h>
// mythgallery
#include "config.h"
@@ -141,7 +143,7 @@ long GalleryUtil::GetNaturalRotation(const unsigned char *buffer, int size)
}
catch (...)
{
- LOG(VB_GENERAL, LOG_ERR, LOC +
+ LOG(VB_GENERAL, LOG_ERR, LOC +
"Failed to extract EXIF headers from buffer");
}
#else
@@ -705,6 +707,43 @@ bool GalleryUtil::RenameDirectory(const QString &currDir, const QString &oldName
return true;
}
+
+void GalleryUtil::PlayVideo(const QString &filename)
+{
+ // HACK begin - remove when everything is using mythui
+ vector<QWidget *> widgetList;
+ if (GetMythMainWindow()->currentWidget())
+ {
+ QWidget *widget = GetMythMainWindow()->currentWidget();
+
+ while (widget)
+ {
+ widgetList.push_back(widget);
+ GetMythMainWindow()->detach(widget);
+ widget->hide();
+ widget = GetMythMainWindow()->currentWidget();
+ }
+
+ GetMythMainWindow()->GetPaintWindow()->raise();
+ GetMythMainWindow()->GetPaintWindow()->setFocus();
+ //GetMythMainWindow()->ShowPainterWindow();
+ }
+ // HACK end
+
+ GetMythMainWindow()->HandleMedia("Internal", filename);
+
+
+ // HACK begin - remove when everything is using mythui
+ vector<QWidget*>::reverse_iterator it;
+ for (it = widgetList.rbegin(); it != widgetList.rend(); ++it)
+ {
+ GetMythMainWindow()->attach(*it);
+ (*it)->show();
+ }
+ //GetMythMainWindow()->HidePainterWindow();
+ // HACK end
+}
+
static QFileInfo MakeUnique(const QFileInfo &dest)
{
QFileInfo newDest = dest;
View
14 mythplugins/mythgallery/mythgallery/galleryutil.h
@@ -1,20 +1,20 @@
// -*- Mode: c++ -*-
/* ============================================================
* File : exifutil.h
- * Description :
- *
+ * Description :
+ *
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published bythe Free Software Foundation;
* either version 2, 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.
- *
+ *
* ============================================================ */
#ifndef GALLERYUTIL_H
@@ -57,14 +57,16 @@ class GalleryUtil
static bool Copy(const QFileInfo &src, QFileInfo &dst);
static bool Move(const QFileInfo &src, QFileInfo &dst);
static bool Delete(const QFileInfo &file);
- static bool Rename(const QString &currDir, const QString &oldName,
+ static bool Rename(const QString &currDir, const QString &oldName,
const QString &newName);
+ static void PlayVideo(const QString &filename);
+
private:
static bool CopyDirectory(const QFileInfo src, QFileInfo &dst);
static bool MoveDirectory(const QFileInfo src, QFileInfo &dst);
static bool DeleteDirectory(const QFileInfo &dir);
- static bool RenameDirectory(const QString &currDir, const QString &oldName,
+ static bool RenameDirectory(const QString &currDir, const QString &oldName,
const QString &newName);
static long GetNaturalRotation(void *exifData);
};
View
17 mythplugins/mythgallery/mythgallery/glsingleview.cpp
@@ -207,21 +207,8 @@ void GLSingleView::paintGL(void)
{
m_movieState = 2;
ThumbItem* item = m_itemList.at(m_pos);
- QString cmd = gCoreContext->GetSetting("GalleryMoviePlayerCmd");
- if ((cmd.indexOf("internal", 0, Qt::CaseInsensitive) > -1) ||
- (cmd.length() < 1))
- {
- cmd = "Internal";
- GetMythMainWindow()->HandleMedia(cmd, item->GetPath());
- }
- else
- {
- QString path = QString("\"%1\"").arg(item->GetPath());
-
- cmd.replace("%s", path);
- myth_system(cmd);
- }
+ GalleryUtil::PlayVideo(item->GetPath());
if (!m_slideshow_running)
{
@@ -1315,7 +1302,7 @@ void GLSingleView::EffectKenBurns(void)
FindRandXY(m_effect_kenBurns_location_x[m_texCur],
m_effect_kenBurns_location_y[m_texCur]);
m_effect_kenBurns_projection[m_texCur] =
- 1 + (int)((2.0f * random() / (RAND_MAX + 1.0f)));
+ 1 + (int)((2.0f * random() / (RAND_MAX + 1.0f)));
}
else //No item, must be 1 of the first two preloaded items
{
View
15 mythplugins/mythgallery/mythgallery/singleview.cpp
@@ -182,21 +182,8 @@ void SingleView::paintEvent(QPaintEvent *)
{
m_movieState = 2;
ThumbItem *item = m_itemList.at(m_pos);
- QString cmd = gCoreContext->GetSetting("GalleryMoviePlayerCmd");
- if ((cmd.indexOf("internal", 0, Qt::CaseInsensitive) > -1) ||
- (cmd.length() < 1))
- {
- cmd = "Internal";
- GetMythMainWindow()->HandleMedia(cmd, item->GetPath());
- }
- else
- {
- QString path = QString("\"%1\"").arg(item->GetPath());
-
- cmd.replace("%s", path);
- myth_system(cmd);
- }
+ GalleryUtil::PlayVideo(item->GetPath());
if (!m_slideshow_running)
{

0 comments on commit 9135b21

Please sign in to comment.