2#include <QCoreApplication>
17 const QString& _name) :
31 QString nameTag(
":WHERENAME");
32 QString query(
"name = " + nameTag);
45 setLabel(PlayGroupConfig::tr(
"Title match (regex)"));
46 setHelpText(PlayGroupConfig::tr(
"Automatically set new recording rules "
47 "to use this group if the title "
48 "matches this regular expression. "
49 "For example, \"(News|CNN)\" would "
50 "match any title in which \"News\" or "
68 setLabel(PlayGroupConfig::tr(
"Skip ahead (seconds)"));
69 setHelpText(PlayGroupConfig::tr(
"How many seconds to skip forward on "
86 setLabel(PlayGroupConfig::tr(
"Skip back (seconds)"));
87 setHelpText(PlayGroupConfig::tr(
"How many seconds to skip backward on "
104 setLabel(PlayGroupConfig::tr(
"Jump amount (minutes)"));
105 setHelpText(PlayGroupConfig::tr(
"How many minutes to jump forward or "
106 "backward when the jump keys are "
124 setLabel(PlayGroupConfig::tr(
"Time stretch (speed x 100)"));
125 setHelpText(PlayGroupConfig::tr(
"Initial playback speed with adjusted "
126 "audio. Use 100 for normal speed, 50 "
127 "for half speed and 200 for double "
182 if (titleMatch.isNull())
186 query.
prepare(
"INSERT playgroup "
187 "(name, titlematch, skipahead, skipback, jump, timestretch) "
189 "(:NEWNAME, :TITLEMATCH, :SKIPAHEAD, :SKIPBACK, :JUMP, :TIMESTRETCH);");
192 query.
bindValue(
":TITLEMATCH", titleMatch);
209 return (
getName() !=
"Default");
215 query.
prepare(
"DELETE FROM playgroup "
216 "WHERE name = :NAME ;");
228 query.
prepare(
"SELECT COUNT(name) FROM playgroup "
229 "WHERE name <> 'Default' ORDER BY name;");
232 else if (query.
next())
233 names = query.
value(0).toInt();
243 query.
prepare(
"SELECT name FROM playgroup "
244 "WHERE name <> 'Default' ORDER BY name;");
252 names << query.
value(0).toString();
260 QString res =
"Default";
265 query.
prepare(
"SELECT name FROM playgroup "
266 "WHERE name = :TITLE1 OR "
267 " name = :CATEGORY OR "
268 " (titlematch <> '' AND "
269 " :TITLE2 REGEXP titlematch) ");
276 else if (query.
next())
277 res = query.
value(0).toString();
288 query.
prepare(QString(
"SELECT name, %1 FROM playgroup "
289 "WHERE (name = :NAME OR name = 'Default') "
291 "ORDER BY name = 'Default';")
296 else if (query.
next())
297 res = query.
value(1).toInt();
316 tr(
"Enter new group name"));
318 if (settingdialog->Create())
326 delete settingdialog;
334 ShowOkPopup(tr(
"Sorry, this Playback Group name cannot be blank."));
341 "WHERE name = :NAME");
352 ShowOkPopup(tr(
"Sorry, this Playback Group name is already in use."));
366 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)