2#include <QCoreApplication>
16 const QString& _name) :
28 QString nameTag(
":WHERENAME");
29 QString query(
"name = " + nameTag);
42 setLabel(PlayGroupConfig::tr(
"Title match (regex)"));
43 setHelpText(PlayGroupConfig::tr(
"Automatically set new recording rules "
44 "to use this group if the title "
45 "matches this regular expression. "
46 "For example, \"(News|CNN)\" would "
47 "match any title in which \"News\" or "
65 setLabel(PlayGroupConfig::tr(
"Skip ahead (seconds)"));
66 setHelpText(PlayGroupConfig::tr(
"How many seconds to skip forward on "
83 setLabel(PlayGroupConfig::tr(
"Skip back (seconds)"));
84 setHelpText(PlayGroupConfig::tr(
"How many seconds to skip backward on "
101 setLabel(PlayGroupConfig::tr(
"Jump amount (minutes)"));
102 setHelpText(PlayGroupConfig::tr(
"How many minutes to jump forward or "
103 "backward when the jump keys are "
121 setLabel(PlayGroupConfig::tr(
"Time stretch (speed x 100)"));
122 setHelpText(PlayGroupConfig::tr(
"Initial playback speed with adjusted "
123 "audio. Use 100 for normal speed, 50 "
124 "for half speed and 200 for double "
179 if (titleMatch.isNull())
183 query.
prepare(
"INSERT playgroup "
184 "(name, titlematch, skipahead, skipback, jump, timestretch) "
186 "(:NEWNAME, :TITLEMATCH, :SKIPAHEAD, :SKIPBACK, :JUMP, :TIMESTRETCH);");
189 query.
bindValue(
":TITLEMATCH", titleMatch);
206 return (
getName() !=
"Default");
212 query.
prepare(
"DELETE FROM playgroup "
213 "WHERE name = :NAME ;");
225 query.
prepare(
"SELECT COUNT(name) FROM playgroup "
226 "WHERE name <> 'Default' ORDER BY name;");
229 else if (query.
next())
230 names = query.
value(0).toInt();
240 query.
prepare(
"SELECT name FROM playgroup "
241 "WHERE name <> 'Default' ORDER BY name;");
247 names << query.
value(0).toString();
255 QString res =
"Default";
260 query.
prepare(
"SELECT name FROM playgroup "
261 "WHERE name = :TITLE1 OR "
262 " name = :CATEGORY OR "
263 " (titlematch <> '' AND "
264 " :TITLE2 REGEXP titlematch) ");
271 else if (query.
next())
272 res = query.
value(0).toString();
283 query.
prepare(QString(
"SELECT name, %1 FROM playgroup "
284 "WHERE (name = :NAME OR name = 'Default') "
286 "ORDER BY name = 'Default';")
291 else if (query.
next())
292 res = query.
value(1).toInt();
311 tr(
"Enter new group name"));
313 if (settingdialog->Create())
321 delete settingdialog;
329 ShowOkPopup(tr(
"Sorry, this Playback Group name cannot be blank."));
336 "WHERE name = :NAME");
347 ShowOkPopup(tr(
"Sorry, this Playback Group name is already in use."));
361 while (!names.isEmpty())
void updateButton(MythUIButtonListItem *item) override
This method is called whenever the UI need to reflect a change Reimplement this If you widget need a ...
JumpMinutes(const PlayGroupConfig &_parent)
QSqlQuery wrapper that fetches a DB connection from the connection pool.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
QVariant value(int i) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
MythScreenStack * GetStack(const QString &Stackname)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Dialog prompting the user to enter a text string.
PlayGroupConfig(const QString &label, const QString &name, bool isNew=false)
StandardSetting * m_titleMatch
MythUISpinBoxSetting * m_skipBack
MythUISpinBoxSetting * m_jumpMinutes
MythUISpinBoxSetting * m_timeStrech
void updateButton(MythUIButtonListItem *item) override
This method is called whenever the UI need to reflect a change Reimplement this If you widget need a ...
MythUISpinBoxSetting * m_skipAhead
void deleteEntry(void) override
bool canDelete(void) override
const PlayGroupConfig & m_parent
QString GetWhereClause(MSqlBindings &bindings) const override
PlayGroupDBStorage(StandardSetting *_setting, const PlayGroupConfig &_parent, const QString &_name)
void CreateNewPlayBackGroupSlot(const QString &name)
void CreateNewPlayBackGroup() const
ButtonStandardSetting * m_addGroupButton
static int GetCount(void)
static QStringList GetNames(void)
static int GetSetting(const QString &name, const QString &field, int defval)
static QString GetInitialName(const ProgramInfo *pi)
Holds information on recordings and videos.
QString GetTitle(void) const
QString GetCategory(void) const
SkipAhead(const PlayGroupConfig &_parent)
SkipBack(const PlayGroupConfig &_parent)
virtual void addChild(StandardSetting *child)
virtual void setName(const QString &name)
QString getName(void) const
void settingsChanged(StandardSetting *selectedSetting=nullptr)
virtual void setHelpText(const QString &str)
virtual void setValue(const QString &newValue)
Storage * GetStorage(void) const
virtual QString getValue(void) const
virtual void setLabel(QString str)
void setChanged(bool changed)
TimeStretch(const PlayGroupConfig &_parent)
TitleMatch(const PlayGroupConfig &_parent)
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
MythMainWindow * GetMythMainWindow(void)