Skip to content

Commit

Permalink
Always use internal player for video in mythgallery
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartm committed Jan 22, 2012
1 parent 7460dc5 commit 9135b21
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 47 deletions.
11 changes: 0 additions & 11 deletions mythplugins/mythgallery/mythgallery/gallerysettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
41 changes: 40 additions & 1 deletion mythplugins/mythgallery/mythgallery/galleryutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

// qt
#include <QDir>
#include <QApplication>

// myth
#include <mythcontext.h>
Expand All @@ -26,6 +27,7 @@
#include <mythdirs.h>
#include <mythdb.h>
#include <mythuihelper.h>
#include <mythmainwindow.h>

// mythgallery
#include "config.h"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 8 additions & 6 deletions mythplugins/mythgallery/mythgallery/galleryutil.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
};
Expand Down
17 changes: 2 additions & 15 deletions mythplugins/mythgallery/mythgallery/glsingleview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
{
Expand Down
15 changes: 1 addition & 14 deletions mythplugins/mythgallery/mythgallery/singleview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 9135b21

Please sign in to comment.