Go to the documentation of this file.
10 QString idTag(
":WHEREID");
11 QString
query(
"id = " + idTag);
20 QString idTag(
":SETID");
23 QString
query(
"id = " + idTag +
", " +
34 QStringList hostnames;
36 for (
const auto &
hostname : qAsConst(hostnames))
48 auto *cardInfo =
new CardInfo(*
this);
66 query.
prepare(
"SELECT DISTINCT cardtype FROM profilegroups");
78 const std::array<const QString,4> profile_names {
79 "Default",
"Live TV",
"High Quality",
"Low Quality" };
83 for (
auto Itype = cardtypes.begin();
84 Itype != cardtypes.end(); ++Itype)
86 if (Itype.key().startsWith(
"V4L2:") && existing.indexOf(Itype.key()) == -1)
90 ":CARDNAME, cardtype = :CARDTYPE, is_default = 1;");
102 for (
const auto & name : profile_names)
105 query.
prepare(
"INSERT INTO recordingprofiles SET name = "
106 ":NAME, profilegroup = :GROUPID;");
112 "recordingprofile.",
query);
129 "SELECT name, id, hostname, is_default, cardtype "
130 "FROM profilegroups");
138 while (result.
next())
140 QString name = result.
value(0).toString();
141 QString
id = result.
value(1).toString();
143 bool is_default = (
bool) result.
value(3).toInt();
144 QString cardtype = result.
value(4).toString();
148 bool have_cardtype = cardtypes.contains(cardtype);
149 if (is_default && (cardtype ==
"TRANSCODE") && !have_cardtype)
153 else if (have_cardtype)
156 name += QString(
" (%1)").arg(result.
value(2).toString());
165 profileGroup->loadByID(
id.toInt());
166 profileGroup->setLabel(name);
167 profileGroup->addChild(
184 result.
prepare(
"SELECT name from profilegroups WHERE id = :PROFILE_ID;");
188 return result.
value(0).toString();
197 QString querystr = QString(
"SELECT DISTINCT id FROM profilegroups WHERE "
198 "name = '%1' AND hostname = '%2';")
202 return !(result.
exec() && result.
next());
211 result.
prepare(
"SELECT DISTINCT hostname from capturecard");
215 while (result.
next())
216 hostnames->append(result.
value(0).toString());
bool allowedGroupName(void)
QMap< QString, QVariant > MSqlBindings
typedef for a map of string -> string bindings for generic queries.
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
static void fillSelections(GroupSetting *setting)
virtual void setValue(const QString &newValue)
int getProfileNum(void) const
QVariant lastInsertId()
Return the id of the last inserted row.
virtual void loadByID(int id)
QString GetWhereClause(MSqlBindings &bindings) const override
QVariant value(int i) const
QString GetColumnName(void) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
virtual void clearSettings()
virtual QString GetDBValue(void) const =0
static void fillSelections(MythUIComboBoxSetting *setting)
virtual void addChild(StandardSetting *child)
QString getName(void) const
QString GetSetClause(MSqlBindings &bindings) const override
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
const ProfileGroup & m_parent
virtual QString getValue(void) const
virtual void setLabel(QString str)
void addSelection(const QString &label, QString value=QString(), bool select=false)
static void getHostNames(QStringList *hostnames)
QMap< QString, QString > InputTypes
static bool addMissingDynamicProfiles(void)
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
static InputTypes GetInputTypes(void)
MSqlQuery query(MSqlQuery::InitCon())
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.