Skip to content

Commit

Permalink
Merge branch 'master' of github.com:MythTV/mythtv
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Kuphal committed Aug 9, 2011
2 parents b3db7b9 + 8f37c6e commit be80e46
Show file tree
Hide file tree
Showing 287 changed files with 12,245 additions and 9,475 deletions.
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchive/mythburn.cpp
Expand Up @@ -410,7 +410,7 @@ void MythBurn::updateArchiveList(void)
else
{
delete busyPopup;
busyPopup = false;
busyPopup = NULL;
}

qApp->processEvents();
Expand Down
24 changes: 12 additions & 12 deletions mythplugins/mytharchive/mytharchive/recordingselector.cpp
Expand Up @@ -9,11 +9,11 @@
#include <QKeyEvent>
#include <QTimer>
#include <QApplication>
#include <QThread>

// mythtv
#include <mythcontext.h>
#include <mythdb.h>
#include <mthread.h>
#include <programinfo.h>
#include <remoteutil.h>
#include <mythtimer.h>
Expand All @@ -24,26 +24,26 @@
#include <mythmainwindow.h>
#include <mythprogressdialog.h>
#include <mythdialogbox.h>
#include "mythlogging.h"
#include <mythlogging.h>

// mytharchive
#include "recordingselector.h"
#include "archiveutil.h"

class GetRecordingListThread : public QThread
class GetRecordingListThread : public MThread
{
public:
GetRecordingListThread(RecordingSelector *parent)
GetRecordingListThread(RecordingSelector *parent) :
MThread("GetRecordingList"), m_parent(parent)
{
m_parent = parent;
start();
}

virtual void run(void)
{
threadRegister("GetRecordingList");
RunProlog();
m_parent->getRecordingList();
threadDeregister();
RunEpilog();
}

RecordingSelector *m_parent;
Expand Down Expand Up @@ -131,17 +131,17 @@ void RecordingSelector::Init(void)
else
{
delete busyPopup;
busyPopup = false;
busyPopup = NULL;
}

GetRecordingListThread *thread = new GetRecordingListThread(this);
while (thread->isRunning())
{
qApp->processEvents();
usleep(100);
usleep(2000);
}

if (!m_recordingList || m_recordingList->size() == 0)
if (!m_recordingList || m_recordingList->empty())
{
ShowOkPopup(tr("Either you don't have any recordings or "
"no recordings are available locally!"));
Expand Down Expand Up @@ -391,7 +391,7 @@ void RecordingSelector::cancelPressed()

void RecordingSelector::updateRecordingList(void)
{
if (!m_recordingList || m_recordingList->size() == 0)
if (!m_recordingList || m_recordingList->empty())
return;

m_recordingButtonList->Reset();
Expand Down Expand Up @@ -437,7 +437,7 @@ void RecordingSelector::getRecordingList(void)
m_recordingList = RemoteGetRecordedList(-1);
m_categories.clear();

if (m_recordingList && m_recordingList->size() > 0)
if (m_recordingList && !m_recordingList->empty())
{
vector<ProgramInfo *>::iterator i = m_recordingList->begin();
for ( ; i != m_recordingList->end(); i++)
Expand Down
41 changes: 38 additions & 3 deletions mythplugins/mytharchive/mytharchive/thumbfinder.cpp
Expand Up @@ -280,6 +280,21 @@ void ThumbFinder::loadCutList()
progInfo->QueryCutList(m_deleteMap);
delete progInfo;
}

// if the first mark is a end mark then add the start mark at the beginning
frm_dir_map_t::const_iterator it = m_deleteMap.begin();
if (it.value() == MARK_CUT_END)
m_deleteMap.insert(0, MARK_CUT_START);


// if the last mark is a start mark then add the end mark at the end
it = m_deleteMap.end();
--it;
if (it != m_deleteMap.end())
{
if (it.value() == MARK_CUT_START)
m_deleteMap.insert(m_archiveItem->duration * m_fps, MARK_CUT_END);
}
}

void ThumbFinder::savePressed()
Expand Down Expand Up @@ -430,12 +445,12 @@ bool ThumbFinder::getThumbImages()
return false;
}

if (m_archiveItem->type == "Recording")
loadCutList();

if (!initAVCodec(m_archiveItem->filename))
return false;

if (m_archiveItem->type == "Recording")
loadCutList();

// calculate the file duration taking the cut list into account
m_finalDuration = calcFinalDuration();

Expand Down Expand Up @@ -658,7 +673,14 @@ int ThumbFinder::checkFramePosition(int frameNumber)
for (it = m_deleteMap.begin(); it != m_deleteMap.end(); ++it)
{
int start = it.key();

++it;
if (it == m_deleteMap.end())
{
LOG(VB_GENERAL, LOG_ERR, "ThumbFinder: found a start cut but no cut end");
break;
}

int end = it.key();

if (start <= frameNumber + diff)
Expand Down Expand Up @@ -947,6 +969,12 @@ void ThumbFinder::updatePositionBar(int64_t frame)
startdelta = size.width();

++it;
if (it == m_deleteMap.end())
{
LOG(VB_GENERAL, LOG_ERR, "ThumbFinder: found a start cut but no cut end");
break;
}

if (it.key() != 0)
enddelta = (m_archiveItem->duration * m_fps) / it.key();
else
Expand Down Expand Up @@ -983,7 +1011,14 @@ int ThumbFinder::calcFinalDuration()
for (it = m_deleteMap.begin(); it != m_deleteMap.end(); ++it)
{
start = it.key();

++it;
if (it == m_deleteMap.end())
{
LOG(VB_GENERAL, LOG_ERR, "ThumbFinder: found a start cut but no cut end");
break;
}

end = it.key();
cutLen += end - start;
}
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchive/videoselector.cpp
Expand Up @@ -464,7 +464,7 @@ void VideoSelector::getVideoList(void)
m_videoList = getVideoListFromDB();
QStringList categories;

if (m_videoList && m_videoList->size() > 0)
if (m_videoList && !m_videoList->empty())
{
vector<VideoInfo *>::iterator i = m_videoList->begin();
for ( ; i != m_videoList->end(); i++)
Expand Down
138 changes: 138 additions & 0 deletions mythplugins/mythgallery/mythgallery/galleryfilter.cpp
@@ -0,0 +1,138 @@
#include <set>
#include <mythuitextedit.h>

#include <mythcontext.h>
#include <mythuibuttonlist.h>
#include <mythuibutton.h>
#include <mythuitext.h>
#include <mythuitextedit.h>
#include <mythlogging.h>

#include "config.h"
#include "galleryfilter.h"
#include "galleryutil.h"

GalleryFilter::GalleryFilter(bool loaddefaultsettings) :
m_dirFilter(""), m_typeFilter(kTypeFilterAll),
m_sort(kSortOrderUnsorted),
m_changed_state(0)
{
// do nothing yet
if (loaddefaultsettings)
{
m_dirFilter = gCoreContext->GetSetting("GalleryFilterDirectory", "");
m_typeFilter = gCoreContext->GetNumSetting("GalleryFilterType",
kTypeFilterAll);
m_sort = gCoreContext->GetNumSetting("GallerySortOrder",
kSortOrderUnsorted);
}
}

GalleryFilter::GalleryFilter(const GalleryFilter &gfs) :
m_changed_state(0)
{
*this = gfs;
}

GalleryFilter & GalleryFilter::operator=(const GalleryFilter &gfs)
{
if (m_dirFilter != gfs.m_dirFilter)
{
m_dirFilter = gfs.m_dirFilter;
m_changed_state = true;
}

if (m_typeFilter != gfs.m_typeFilter)
{
m_typeFilter = gfs.m_typeFilter;
m_changed_state = true;
}

if (m_sort != gfs.m_sort)
{
m_sort = gfs.m_sort;
m_changed_state = true;
}

return *this;
}

void GalleryFilter::saveAsDefault()
{
gCoreContext->SaveSetting("GalleryFilterDirectory", m_dirFilter);
gCoreContext->SaveSetting("GalleryFilterType", m_typeFilter);
gCoreContext->SaveSetting("GallerySortOrder", m_sort);
}

bool GalleryFilter::TestFilter(const QString& dir, const GalleryFilter& flt,
int *dirCount, int *imageCount, int *movieCount)
{
QStringList splitFD;
const QFileInfo *fi;

QDir d(dir);
QString currDir = d.absolutePath();
QFileInfoList list = d.entryInfoList(GalleryUtil::GetMediaFilter(),
QDir::Files | QDir::AllDirs,
(QDir::SortFlag)flt.getSort());

if (list.isEmpty())
return false;

if (!flt.getDirFilter().isEmpty())
splitFD = flt.getDirFilter().split(":");

for (QFileInfoList::const_iterator it = list.begin();
it != list.end(); it++)
{
fi = &(*it);
if (fi->fileName() == "." || fi->fileName() == "..")
continue;

// remove these already-resized pictures.
if ((fi->fileName().indexOf(".thumb.") > 0) ||
(fi->fileName().indexOf(".sized.") > 0) ||
(fi->fileName().indexOf(".highlight.") > 0))
continue;

// skip filtered directory
if (fi->isDir())
{
if (!splitFD.filter(fi->fileName(), Qt::CaseInsensitive).isEmpty())
continue;

// add directory
(*dirCount)++;
GalleryFilter::TestFilter(QDir::cleanPath(fi->absoluteFilePath()),
flt, dirCount, imageCount, movieCount);
}
else
{
if (GalleryUtil::IsImage(fi->absoluteFilePath()) &&
flt.getTypeFilter() != kTypeFilterMoviesOnly)
(*imageCount)++;
else if (GalleryUtil::IsMovie(fi->absoluteFilePath()) &&
flt.getTypeFilter() != kTypeFilterImagesOnly)
(*movieCount)++;
}
}

return true;
}


void GalleryFilter::dumpFilter(QString src)
{
LOG(VB_GENERAL, LOG_DEBUG, QString("Dumping GalleryFilter from: %1")
.arg(src));
LOG(VB_GENERAL, LOG_DEBUG, QString("directory fiter: %1")
.arg(m_dirFilter));
LOG(VB_GENERAL, LOG_DEBUG, QString("type filter: %1")
.arg(m_typeFilter));
LOG(VB_GENERAL, LOG_DEBUG, QString("sort options: %1")
.arg(m_sort));
}

/*
* vim:ts=4:sw=4:ai:et:si:sts=4
*/

0 comments on commit be80e46

Please sign in to comment.