Permalink
Browse files

PVR - add parental control to channels (with epg)

  • Loading branch information...
1 parent 21a90b2 commit 473f0a24fcdb0475de4b7b4cd6f2be1001f52a23 @mikrohard committed with May 21, 2012
@@ -367,6 +367,27 @@
<onright>60</onright>
<onleft>20</onleft>
<onup>12</onup>
+ <ondown>14</ondown>
+ </control>
+ <control type="radiobutton" id ="14">
+ <description>Parental locked</description>
+ <posx>0</posx>
+ <posy>225</posy>
+ <width>380</width>
+ <height>35</height>
+ <font>font12</font>
+ <textcolor>white</textcolor>
+ <focusedcolor>white</focusedcolor>
+ <shadowcolor>black</shadowcolor>
+ <align>left</align>
+ <aligny>center</aligny>
+ <texturefocus border="5">button-focus2.png</texturefocus>
+ <texturenofocus border="5">button-nofocus.png</texturenofocus>
+ <pulseonselect>no</pulseonselect>
+ <label>19267</label>
+ <onleft>20</onleft>
+ <onright>60</onright>
+ <onup>13</onup>
<ondown>30</ondown>
</control>
</control>
@@ -399,7 +420,7 @@
<label>19205</label>
<onleft>20</onleft>
<onright>34</onright>
- <onup>13</onup>
+ <onup>14</onup>
<ondown>31</ondown>
</control>
<control type="button" id ="34">
@@ -416,7 +437,7 @@
<label>19024</label>
<onleft>30</onleft>
<onright>60</onright>
- <onup>13</onup>
+ <onup>14</onup>
<ondown>31</ondown>
</control>
<control type="button" id ="34">
@@ -433,7 +454,7 @@
<label>19023</label>
<onleft>30</onleft>
<onright>60</onright>
- <onup>13</onup>
+ <onup>14</onup>
<ondown>31</ondown>
</control>
<control type="button" id ="31">
@@ -7074,6 +7074,50 @@ msgctxt "#19256"
msgid "Stop recording"
msgstr ""
+msgctxt "#19257"
+msgid "Lock channel"
+msgstr ""
+
+msgctxt "#19258"
+msgid "Unlock channel"
+msgstr ""
+
+msgctxt "#19259"
+msgid "Parental control"
+msgstr ""
+
+msgctxt "#19260"
+msgid "Unlock duration"
+msgstr ""
+
+msgctxt "#19261"
+msgid "Change PIN"
+msgstr ""
+
+msgctxt "#19262"
+msgid "Parental control. Enter PIN:"
+msgstr ""
+
+msgctxt "#19263"
+msgid "Locked channel. Enter PIN:"
+msgstr ""
+
+msgctxt "#19264"
+msgid "Incorrect PIN"
+msgstr ""
+
+msgctxt "#19265"
+msgid "The entered PIN number was incorrect."
+msgstr ""
+
+msgctxt "#19266"
+msgid "Parental locked"
+msgstr ""
+
+msgctxt "#19267"
+msgid "Parental locked:"
+msgstr ""
+
msgctxt "#19499"
msgid "Other/Unknown"
msgstr ""
View
@@ -415,7 +415,7 @@ int CEpgDatabase::Persist(const CEpgInfoTag &tag, bool bSingleUpdate /* = true *
"iEpisodeId, iEpisodePart, sEpisodeName, iBroadcastUid) "
"VALUES (%u, %u, %u, '%s', '%s', '%s', %i, %i, '%s', %u, %i, %i, %i, %i, %i, %i, '%s', %i);",
tag.EpgID(), iStartTime, iEndTime,
- tag.Title().c_str(), tag.PlotOutline().c_str(), tag.Plot().c_str(), tag.GenreType(), tag.GenreSubType(), strGenre.c_str(),
+ tag.Title(true).c_str(), tag.PlotOutline(true).c_str(), tag.Plot(true).c_str(), tag.GenreType(), tag.GenreSubType(), strGenre.c_str(),
iFirstAired, tag.ParentalRating(), tag.StarRating(), tag.Notify(),
tag.SeriesNum(), tag.EpisodeNum(), tag.EpisodePart(), tag.EpisodeName().c_str(),
tag.UniqueBroadcastID());
@@ -428,7 +428,7 @@ int CEpgDatabase::Persist(const CEpgInfoTag &tag, bool bSingleUpdate /* = true *
"iEpisodeId, iEpisodePart, sEpisodeName, iBroadcastUid, idBroadcast) "
"VALUES (%u, %u, %u, '%s', '%s', '%s', %i, %i, '%s', %u, %i, %i, %i, %i, %i, %i, '%s', %i, %i);",
tag.EpgID(), iStartTime, iEndTime,
- tag.Title().c_str(), tag.PlotOutline().c_str(), tag.Plot().c_str(), tag.GenreType(), tag.GenreSubType(), strGenre.c_str(),
+ tag.Title(true).c_str(), tag.PlotOutline(true).c_str(), tag.Plot(true).c_str(), tag.GenreType(), tag.GenreSubType(), strGenre.c_str(),
iFirstAired, tag.ParentalRating(), tag.StarRating(), tag.Notify(),
tag.SeriesNum(), tag.EpisodeNum(), tag.EpisodePart(), tag.EpisodeName().c_str(),
tag.UniqueBroadcastID(), iBroadcastId);
View
@@ -399,13 +399,19 @@ void CEpgInfoTag::SetTitle(const CStdString &strTitle)
UpdatePath();
}
-CStdString CEpgInfoTag::Title(void) const
+CStdString CEpgInfoTag::Title(bool bOverrideParental /* = false */) const
{
CStdString retVal;
CSingleLock lock(m_critSection);
retVal = (m_strTitle.IsEmpty()) ?
g_localizeStrings.Get(19055) :
m_strTitle;
+
+ if (!bOverrideParental && !g_PVRManager.CheckParentalOverride(ChannelTag()))
+ {
+ retVal = g_localizeStrings.Get(19266);
+ }
+
return retVal;
}
@@ -425,11 +431,17 @@ void CEpgInfoTag::SetPlotOutline(const CStdString &strPlotOutline)
UpdatePath();
}
-CStdString CEpgInfoTag::PlotOutline(void) const
+CStdString CEpgInfoTag::PlotOutline(bool bOverrideParental /* = false */) const
{
CStdString retVal;
CSingleLock lock(m_critSection);
retVal = m_strPlotOutline;
+
+ if (!bOverrideParental && !g_PVRManager.CheckParentalOverride(ChannelTag()))
+ {
+ retVal = "";
+ }
+
return retVal;
}
@@ -453,11 +465,17 @@ void CEpgInfoTag::SetPlot(const CStdString &strPlot)
UpdatePath();
}
-CStdString CEpgInfoTag::Plot(void) const
+CStdString CEpgInfoTag::Plot(bool bOverrideParental /* = false */) const
{
CStdString retVal;
CSingleLock lock(m_critSection);
retVal = m_strPlot;
+
+ if (!bOverrideParental && !g_PVRManager.CheckParentalOverride(ChannelTag()))
+ {
+ retVal = "";
+ }
+
return retVal;
}
View
@@ -182,9 +182,10 @@ namespace EPG
/*!
* @brief Get the title of this event.
+ * @param bOverrideParental True to override parental control, false check it.
* @return The title.
*/
- virtual CStdString Title(void) const;
+ virtual CStdString Title(bool bOverrideParental = false) const;
/*!
* @brief Change the plot outline of this event.
@@ -194,9 +195,10 @@ namespace EPG
/*!
* @brief Get the plot outline of this event.
+ * @param bOverrideParental True to override parental control, false check it.
* @return The plot outline.
*/
- virtual CStdString PlotOutline(void) const;
+ virtual CStdString PlotOutline(bool bOverrideParental = false) const;
/*!
* @brief Change the plot of this event.
@@ -206,9 +208,10 @@ namespace EPG
/*!
* @brief Get the plot of this event.
+ * @param bOverrideParental True to override parental control, false check it.
* @return The plot.
*/
- virtual CStdString Plot(void) const;
+ virtual CStdString Plot(bool bOverrideParental = false) const;
/*!
* @brief Change the genre of this event.
@@ -100,8 +100,8 @@ bool EpgSearchFilter::MatchSearchTerm(const CEpgInfoTag &tag) const
if (!m_strSearchTerm.IsEmpty())
{
CTextSearch search(m_strSearchTerm, m_bIsCaseSensitive, SEARCH_DEFAULT_OR);
- bReturn = search.Search(tag.Title()) ||
- search.Search(tag.PlotOutline());
+ bReturn = search.Search(tag.Title(true)) ||
+ search.Search(tag.PlotOutline(true));
}
return bReturn;
@@ -26,6 +26,11 @@
#include "guilib/GUIControl.h"
#include "guilib/GUIListItemLayout.h"
+namespace PVR
+{
+ class CGUIWindowPVRGuide;
+}
+
namespace EPG
{
#define MAXCHANNELS 20
@@ -40,6 +45,8 @@ namespace EPG
class CGUIEPGGridContainer : public CGUIControl
{
+ friend class PVR::CGUIWindowPVRGuide;
+
public:
CGUIEPGGridContainer(int parentID, int controlID, float posX, float posY, float width, float height,
ORIENTATION orientation, int scrollTime, int preloadItems, int minutesPerPage,
View
@@ -68,6 +68,7 @@ bool CPVRDatabase::CreateTables()
"bIsRadio bool, "
"bIsHidden bool, "
"bIsUserSetIcon bool, "
+ "bIsLocked bool, "
"sIconPath varchar(255), "
"sChannelName varchar(64), "
"bIsVirtual bool, "
@@ -260,6 +261,9 @@ bool CPVRDatabase::UpdateOldVersion(int iVersion)
if (iVersion < 21)
m_pDS->exec("ALTER TABLE channelgroups ADD iGroupType integer");
+
+ if (iVersion < 22)
+ m_pDS->exec("ALTER TABLE channels ADD bIsLocked bool");
}
}
catch (...)
@@ -332,7 +336,7 @@ int CPVRDatabase::Get(CPVRChannelGroupInternal &results)
int iReturn(0);
CStdString strQuery = FormatSQL("SELECT channels.idChannel, channels.iUniqueId, channels.bIsRadio, channels.bIsHidden, channels.bIsUserSetIcon, "
- "channels.sIconPath, channels.sChannelName, channels.bIsVirtual, channels.bEPGEnabled, channels.sEPGScraper, channels.iLastWatched, channels.iClientId, "
+ "channels.sIconPath, channels.sChannelName, channels.bIsVirtual, channels.bEPGEnabled, channels.sEPGScraper, channels.iLastWatched, channels.iClientId, channels.bIsLocked, "
"channels.iClientChannelNumber, channels.sInputFormat, channels.sInputFormat, channels.sStreamURL, channels.iEncryptionSystem, map_channelgroups_channels.iChannelNumber, channels.idEpg "
"FROM map_channelgroups_channels "
"LEFT JOIN channels ON channels.idChannel = map_channelgroups_channels.idChannel "
@@ -350,6 +354,7 @@ int CPVRDatabase::Get(CPVRChannelGroupInternal &results)
channel->m_bIsRadio = m_pDS->fv("bIsRadio").get_asBool();
channel->m_bIsHidden = m_pDS->fv("bIsHidden").get_asBool();
channel->m_bIsUserSetIcon = m_pDS->fv("bIsUserSetIcon").get_asBool();
+ channel->m_bIsLocked = m_pDS->fv("bIsLocked").get_asBool();
channel->m_strIconPath = m_pDS->fv("sIconPath").get_asString();
channel->m_strChannelName = m_pDS->fv("sChannelName").get_asString();
channel->m_bIsVirtual = m_pDS->fv("bIsVirtual").get_asBool();
@@ -895,11 +900,11 @@ bool CPVRDatabase::Persist(CPVRChannel &channel, bool bQueueWrite /* = false */)
{
/* new channel */
strQuery = FormatSQL("INSERT INTO channels ("
- "iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, "
+ "iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idEpg) "
- "VALUES (%i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i)",
- channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0),
+ "VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i)",
+ channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(),
channel.EpgID());
@@ -908,11 +913,11 @@ bool CPVRDatabase::Persist(CPVRChannel &channel, bool bQueueWrite /* = false */)
{
/* update channel */
strQuery = FormatSQL("REPLACE INTO channels ("
- "iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, "
+ "iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idChannel, idEpg) "
- "VALUES (%i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i, %i)",
- channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0),
+ "VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i, %i)",
+ channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.ChannelID(),
channel.EpgID());
View
@@ -60,7 +60,7 @@ namespace PVR
* @brief Get the minimal database version that is required to operate correctly.
* @return The minimal database version.
*/
- virtual int GetMinVersion() const { return 21; };
+ virtual int GetMinVersion() const { return 22; };
/*!
* @brief Get the default sqlite database filename.
Oops, something went wrong.

0 comments on commit 473f0a2

Please sign in to comment.