Go to the documentation of this file.
56 #define LOC QString("RestoreData: ")
63 setLabel(QObject::tr(
"Restore XMLTV ID"));
66 "If checked, copy the XMLTV ID in field \"xmltvid\" "
67 "from a deleted channel "
68 "or from a channel in another video source."));
78 setLabel(QObject::tr(
"Restore Visible status"));
81 "If checked, copy the Visible status in field \"visible\" "
82 "from a deleted channel in this video source."));
92 setLabel(QObject::tr(
"Restore Icon filename"));
95 "If checked, copy the Icon filename in field \"icon\" "
96 "from a deleted channel "
97 "or from a channel in another video source."));
110 "The video source is selected in the Channel Editor page. "
111 "Searching for non-scanned data is done for all channels in this video source."
125 newTransport->setHelpText(
127 "Start searching for non-scanned data. The data is written to the database "
128 "when \'Save and Exit\' is selected in the \'Exit Settings?\' dialog box."
140 if (do_xmltvid || do_icon || do_visible)
142 QString msg = QString(
"Restore data from deleted channels for fields ");
155 LOG(VB_GENERAL, LOG_INFO,
LOC + msg);
166 "SELECT chanid, channum, name, serviceid, transportid, networkid, "
170 "FROM channel, dtv_multiplex "
171 "WHERE channel.sourceid = :SOURCEID "
172 " AND channel.mplexid = dtv_multiplex.mplexid "
173 " AND deleted IS NULL ");
200 if (do_xmltvid && cd.
xmltvid.isEmpty())
204 "FROM channel, dtv_multiplex "
205 "WHERE serviceid = :SERVICEID "
206 " AND transportid = :TRANSPORTID "
207 " AND networkid = :NETWORKID "
208 " AND channel.mplexid = dtv_multiplex.mplexid "
210 " AND (deleted IS NOT NULL OR "
211 " channel.sourceid != :SOURCEID)"
212 "ORDER BY deleted DESC;");
232 if (do_icon && cd.
icon.isEmpty())
236 "FROM channel, dtv_multiplex "
237 "WHERE serviceid = :SERVICEID "
238 " AND transportid = :TRANSPORTID "
239 " AND networkid = :NETWORKID "
240 " AND channel.mplexid = dtv_multiplex.mplexid "
242 " AND (deleted IS NOT NULL OR "
243 " channel.sourceid != :SOURCEID)"
244 "ORDER BY deleted DESC;");
266 "SELECT channel.visible "
267 "FROM channel, dtv_multiplex "
268 "WHERE serviceid = :SERVICEID "
269 " AND transportid = :TRANSPORTID "
270 " AND networkid = :NETWORKID "
271 " AND channel.sourceid = :SOURCEID "
272 " AND channel.mplexid = dtv_multiplex.mplexid "
273 " AND deleted IS NOT NULL "
274 "ORDER BY deleted DESC;");
286 int visible = query2.
value(0).toInt();
304 LOG(VB_GENERAL, LOG_INFO,
LOC +
"No data found in deleted channels or no data needed");
308 LOG(VB_GENERAL, LOG_INFO,
LOC +
309 QString(
"Restoring data in %1 channels from deleted channels:")
317 for (
auto & cd :
m_ocd)
319 QString msg = QString(
"Channel %1 \'%2\' update ").arg(cd.channum, cd.name);
320 if (cd.found_xmltvid)
322 msg += QString(
"xmltvid(%1) ").arg(cd.xmltvid);
327 msg += QString(
"icon(%1) ").arg(cd.icon);
330 if (cd.found_visible)
332 msg += QString(
"visible(%1) ").arg(cd.visible);
335 LOG(VB_GENERAL, LOG_INFO,
LOC + msg);
343 msg =
"No data found";
347 msg = QString(
"Found data for %1 channels\n").arg(
m_ocd.size());
350 msg += QString(
"xmltvid: %1 ").arg(num_xmltvid);
354 msg += QString(
"icon: %1 ").arg(num_icon);
358 msg += QString(
"visible: %1").arg(num_visible);
375 for (
auto & cd :
m_ocd)
380 " xmltvid = :XMLTVID, "
381 " visible = :VISIBLE "
382 "WHERE chanid = :CHANID");
393 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Restored data for %1 channels").arg(
m_ocd.size()));
bool isActive(void) const
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
bool WaitFor(MythConfirmationDialog *dialog)
Blocks until confirmation dialog exits.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
VideoSourceShow * m_videosource
QVariant value(int i) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
std::vector< OldChannelData > m_ocd
virtual void addChild(StandardSetting *child)
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
virtual void setHelpText(const QString &str)
RestoreXMLTVID * m_restoreXMLTVID
RestoreVisible * m_restoreVisible
virtual void setLabel(QString str)
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
RestoreData(uint sourceid)
RestoreIcon * m_restoreIcon
void setValue(const QString &newValue) override
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.