Skip to content

Commit

Permalink
Merge branch 'mythsystem-rewrite'
Browse files Browse the repository at this point in the history
  • Loading branch information
Beirdo committed Jan 2, 2011
2 parents 0f063f5 + f1450ba commit 4a7472f
Show file tree
Hide file tree
Showing 49 changed files with 274 additions and 251 deletions.
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchive/recordingselector.cpp
Expand Up @@ -116,7 +116,7 @@ bool RecordingSelector::Create(void)

void RecordingSelector::Init(void)
{
QString message = tr("Retrieving Recording List. Please Wait...");
QString message = tr("Retrieving Recording List.\nPlease Wait...");

MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");

Expand Down
93 changes: 21 additions & 72 deletions mythplugins/mytharchive/mytharchive/videoselector.cpp
Expand Up @@ -28,8 +28,12 @@ VideoSelector::VideoSelector(MythScreenStack *parent, QList<ArchiveItem *> *arch
:MythScreenType(parent, "VideoSelector")
{
m_archiveList = archiveList;
m_currentParentalLevel = 1;
m_currentParentalLevel = ParentalLevel::plNone;
m_videoList = NULL;

m_parentalLevelChecker = new ParentalLevelChangeChecker();
connect(m_parentalLevelChecker, SIGNAL(SigResultReady(bool, ParentalLevel::Level)),
this, SLOT(parentalLevelChanged(bool, ParentalLevel::Level)));
}

VideoSelector::~VideoSelector(void)
Expand All @@ -40,6 +44,8 @@ VideoSelector::~VideoSelector(void)
while (!m_selectedList.isEmpty())
delete m_selectedList.takeFirst();
m_selectedList.clear();

delete m_parentalLevelChecker;
}

bool VideoSelector::Create(void)
Expand Down Expand Up @@ -86,6 +92,8 @@ bool VideoSelector::Create(void)

SetFocusWidget(m_videoButtonList);

setParentalLevel(ParentalLevel::plLowest);

updateSelectedList();
updateVideoList();

Expand All @@ -112,19 +120,19 @@ bool VideoSelector::keyPressEvent(QKeyEvent *event)
}
else if (action == "1")
{
setParentalLevel(1);
setParentalLevel(ParentalLevel::plLowest);
}
else if (action == "2")
{
setParentalLevel(2);
setParentalLevel(ParentalLevel::plLow);
}
else if (action == "3")
{
setParentalLevel(3);
setParentalLevel(ParentalLevel::plMedium);
}
else if (action == "4")
{
setParentalLevel(4);
setParentalLevel(ParentalLevel::plHigh);
}
else
handled = false;
Expand Down Expand Up @@ -521,79 +529,20 @@ void VideoSelector::updateSelectedList()
}
}

void VideoSelector::setParentalLevel(int which_level)
void VideoSelector::setParentalLevel(ParentalLevel::Level level)
{
if (which_level < 1)
which_level = 1;

if (which_level > 4)
which_level = 4;

if ((which_level > m_currentParentalLevel) && !checkParentPassword())
which_level = m_currentParentalLevel;


if (m_currentParentalLevel != which_level)
{
m_currentParentalLevel = which_level;
updateVideoList();
m_plText->SetText(QString::number(which_level));
}
m_parentalLevelChecker->Check(m_currentParentalLevel, level);
}

bool VideoSelector::checkParentPassword()
void VideoSelector::parentalLevelChanged(bool passwordValid, ParentalLevel::Level newLevel)
{
QDateTime curr_time = QDateTime::currentDateTime();
QString last_time_stamp = gCoreContext->GetSetting("VideoPasswordTime");
QString password = gCoreContext->GetSetting("VideoAdminPassword");
if (password.length() < 1)
if (passwordValid)
{
return true;
}

// See if we recently (and succesfully) asked for a password
if (last_time_stamp.length() < 1)
{
// Probably first time used
}
else
{
QDateTime last_time = QDateTime::fromString(last_time_stamp,
Qt::TextDate);
if (last_time.secsTo(curr_time) < 120)
{
// Two minute window
last_time_stamp = curr_time.toString(Qt::TextDate);
gCoreContext->SetSetting("VideoPasswordTime", last_time_stamp);
gCoreContext->SaveSetting("VideoPasswordTime", last_time_stamp);
return true;
}
}

// See if there is a password set
if (password.length() > 0)
{
bool ok = false;
MythPasswordDialog *pwd = new MythPasswordDialog(tr("Parental Pin:"),
&ok,
password,
GetMythMainWindow());
pwd->exec();
pwd->deleteLater();
if (ok)
{
// All is good
last_time_stamp = curr_time.toString(Qt::TextDate);
gCoreContext->SetSetting("VideoPasswordTime", last_time_stamp);
gCoreContext->SaveSetting("VideoPasswordTime", last_time_stamp);
return true;
}
m_currentParentalLevel = newLevel;
updateVideoList();
m_plText->SetText(QString::number(newLevel));
}
else
{
return true;
}

return false;
ShowOkPopup(tr("You need to enter a valid password for this parental level"));
}

11 changes: 7 additions & 4 deletions mythplugins/mytharchive/mytharchive/videoselector.h
Expand Up @@ -12,6 +12,7 @@

// mythtv
#include <mythscreentype.h>
#include <metadata/parentalcontrols.h>

// mytharchive
#include "archiveutil.h"
Expand All @@ -22,7 +23,6 @@ class MythUIButton;
class MythUIButtonList;
class MythUIButtonListItem;


typedef struct
{
int id;
Expand Down Expand Up @@ -62,20 +62,23 @@ class VideoSelector : public MythScreenType
void titleChanged(MythUIButtonListItem *item);
void toggleSelected(MythUIButtonListItem *item);

void parentalLevelChanged(bool passwordValid, ParentalLevel::Level newLevel);

private:
void updateVideoList(void);
void updateSelectedList(void);
void getVideoList(void);
void wireUpTheme(void);
std::vector<VideoInfo *> *getVideoListFromDB(void);
bool checkParentPassword(void);
void setParentalLevel(int which_level);
void setParentalLevel(ParentalLevel::Level level);

ParentalLevelChangeChecker *m_parentalLevelChecker;

QList<ArchiveItem *> *m_archiveList;
std::vector<VideoInfo *> *m_videoList;
QList<VideoInfo *> m_selectedList;

int m_currentParentalLevel;
ParentalLevel::Level m_currentParentalLevel;

MythUIText *m_plText;
MythUIButtonList *m_videoButtonList;
Expand Down
10 changes: 5 additions & 5 deletions mythplugins/mytharchive/mytharchivehelper/main.cpp
Expand Up @@ -1888,7 +1888,7 @@ static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int
unsigned char *outputbuf = new unsigned char[bufflen];

int frameNo = -1, thumbCount = 0;
int frameFinished;
int frameFinished = 0;
int keyFrame;

while (av_read_frame(inputFC, &pkt) >= 0)
Expand All @@ -1901,7 +1901,7 @@ static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int
thumbCount++;

avcodec_flush_buffers(codecCtx);
avcodec_decode_video(codecCtx, frame, &frameFinished, pkt.data, pkt.size);
avcodec_decode_video2(codecCtx, frame, &frameFinished, &pkt);
keyFrame = frame->key_frame;

while (!frameFinished || !keyFrame)
Expand All @@ -1913,7 +1913,7 @@ static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int
if (pkt.stream_index == videostream)
{
frameNo++;
avcodec_decode_video(codecCtx, frame, &frameFinished, pkt.data, pkt.size);
avcodec_decode_video2(codecCtx, frame, &frameFinished, &pkt);
keyFrame = frame->key_frame;
}
}
Expand Down Expand Up @@ -1972,9 +1972,9 @@ static int grabThumbnail(QString inFile, QString thumbList, QString outFile, int
if (pkt.stream_index == videostream)
{
frameNo++;
avcodec_decode_video(codecCtx, frame,
avcodec_decode_video2(codecCtx, frame,
&frameFinished,
pkt.data, pkt.size);
&pkt);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions mythplugins/mytharchive/theme/default-wide/mytharchive-ui.xml
Expand Up @@ -147,15 +147,15 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
</fill>
</shape>
</state>
<state name="selectedinactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
Expand Down Expand Up @@ -261,15 +261,15 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
</fill>
</shape>
</state>
<state name="selectedinactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
Expand Down Expand Up @@ -333,15 +333,15 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
</fill>
</shape>
</state>
<state name="selectedinactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
Expand Down
7 changes: 4 additions & 3 deletions mythplugins/mytharchive/theme/default-wide/mythburn-ui.xml
Expand Up @@ -10,9 +10,10 @@ MythArchive GUI theme
<window name="profilepopup">
<area>-1,-1,413,426</area>

<imagetype name="box">
<filename>mz_function_popup.png</filename>
</imagetype>
<shape name="background" from="basebackground">
<area>0,0,413,426</area>
<fill color="#000000" alpha="220" />
</shape>

<textarea name="title" from="basetextarea">
<area>20,20,360,40</area>
Expand Down
12 changes: 6 additions & 6 deletions mythplugins/mytharchive/theme/default/mytharchive-ui.xml
Expand Up @@ -146,15 +146,15 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
</fill>
</shape>
</state>
<state name="selectedinactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
Expand Down Expand Up @@ -259,15 +259,15 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
</fill>
</shape>
</state>
<state name="selectedinactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
Expand Down Expand Up @@ -330,15 +330,15 @@ Common MythArchive window definitions
</statetype>
</state>
<state name="selectedactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" />
</fill>
</shape>
</state>
<state name="selectedinactive" from="active">
<shape name="buttonbackground">
<shape name="background">
<area>0,0,100%,100%</area>
<fill style="gradient">
<gradient start="#52CA38" end="#349838" alpha="100" />
Expand Down
7 changes: 4 additions & 3 deletions mythplugins/mytharchive/theme/default/mythburn-ui.xml
Expand Up @@ -10,9 +10,10 @@ MythArchive GUI theme
<window name="profilepopup">
<area>-1,-1,413,426</area>

<imagetype name="box">
<filename>mz_function_popup.png</filename>
</imagetype>
<shape name="background" from="basebackground">
<area>0,0,413,426</area>
<fill color="#000000" alpha="220" />
</shape>

<textarea name="title" from="basetextarea">
<area>20,20,360,40</area>
Expand Down
Empty file modified mythplugins/mythbrowser/i18n/mythbrowser_fr.ts 100755 → 100644
Empty file.

0 comments on commit 4a7472f

Please sign in to comment.