Go to the documentation of this file.
4 #include <QApplication>
7 #include <QDomDocument>
34 QDomDocument doc(
"mydocument");
36 if (!
file.open(QIODevice::ReadOnly))
39 if (!doc.setContent(&
file))
46 QString docType = doc.doctype().name();
48 if (docType ==
"MYTHARCHIVEITEM")
50 QDomNodeList itemNodeList = doc.elementsByTagName(
"item");
54 if (itemNodeList.count() < 1)
56 LOG(VB_GENERAL, LOG_ERR,
57 "Couldn't find an 'item' element in XML file");
61 QDomNode n = itemNodeList.item(0);
62 QDomElement e = n.toElement();
63 type = e.attribute(
"type");
65 if (
type ==
"recording")
67 QDomNodeList nodeList = e.elementsByTagName(
"recorded");
68 if (nodeList.count() < 1)
70 LOG(VB_GENERAL, LOG_ERR,
71 "Couldn't find a 'recorded' element in XML file");
83 if (e.tagName() ==
"title")
84 details->
title = e.text();
86 if (e.tagName() ==
"subtitle")
89 if (e.tagName() ==
"starttime")
92 if (e.tagName() ==
"description")
99 n = itemNodeList.item(0);
101 nodeList = e.elementsByTagName(
"channel");
102 if (nodeList.count() < 1)
104 LOG(VB_GENERAL, LOG_ERR,
105 "Couldn't find a 'channel' element in XML file");
113 n = nodeList.item(0);
115 details->
chanID = e.attribute(
"chanid");
116 details->
chanNo = e.attribute(
"channum");
117 details->
chanName = e.attribute(
"name");
118 details->
callsign = e.attribute(
"callsign");
123 QDomNodeList nodeList = e.elementsByTagName(
"videometadata");
124 if (nodeList.count() < 1)
126 LOG(VB_GENERAL, LOG_ERR,
127 "Couldn't find a 'videometadata' element in XML file");
131 n = nodeList.item(0);
139 if (e.tagName() ==
"title")
141 details->
title = e.text();
146 if (e.tagName() ==
"plot")
182 bool foundtheme =
LoadWindowFromXML(
"mythnative-ui.xml",
"archivefile_selector",
this);
201 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'archivefile_selector'");
252 .toString(
"dd MMM yy (hh:mm)"));
266 ShowOkPopup(tr(
"The selected item is not a valid archive file!"));
274 if (native->Create())
327 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'importarchive'");
343 .toString(
"dd MMM yy (hh:mm)"));
370 for (
int i = 0; i < actions.size() && !handled; i++)
372 const QString&
action = actions[i];
395 ShowOkPopup(tr(
"You need to select a valid channel id!"));
409 if (!tempDir.endsWith(
"/"))
412 QString logDir = tempDir +
"logs";
417 commandline =
"mytharchivehelper --logpath " + logDir +
" --importarchive "
419 "\" --chanid " + chanID;
426 ShowOkPopup(tr(
"It was not possible to import the Archive. "
427 " An error occured when running 'mytharchivehelper'") );
449 const QString &name,
const QString &callsign)
455 query.
prepare(
"SELECT chanid, channum, name, callsign FROM channel "
456 "WHERE chanid = :CHANID AND channum = :CHANNUM AND name = :NAME "
457 "AND callsign = :CALLSIGN;");
474 query.
prepare(
"SELECT chanid, channum, name, callsign FROM channel "
475 "WHERE callsign = :CALLSIGN;");
489 query.
prepare(
"SELECT chanid, channum, name, callsign FROM channel "
490 "WHERE name = :NAME;");
515 auto *searchDialog =
new
518 if (!searchDialog->Create())
521 searchDialog =
nullptr;
536 querystr = QString(
"SELECT %1 FROM channel ORDER BY %2").arg(field, field);
540 if (query.
exec(querystr))
562 query.
prepare(
"SELECT chanid, channum, name, callsign "
563 "FROM channel WHERE chanid = :CHANID;");
588 query.
prepare(
"SELECT chanid, channum, name, callsign "
589 "FROM channel WHERE channum = :CHANNUM;");
614 query.
prepare(
"SELECT chanid, channum, name, callsign "
615 "FROM channel WHERE name = :NAME;");
640 query.
prepare(
"SELECT chanid, channum, name, callsign "
641 "FROM channel WHERE callsign = :CALLSIGN;");
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
MythScreenStack * GetMainStack()
Provide a dialog to quickly find an entry in a list.
void gotChanNo(const QString &value)
MythScreenType * m_previousScreen
MythUIText * m_localChanIDText
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
@ kMSDontBlockInputDevs
avoid blocking LIRC & Joystick Menu
void itemClicked(MythUIButtonListItem *item)
bool Create(void) override
MythUIText * m_progDescriptionText
void updateFileList(void)
void searchCallsign(void)
void showList(const QString &caption, QString &value, INSlot slot)
QVariant value(int i) const
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void findChannelMatch(const QString &chanid, const QString &chanNo, const QString &name, const QString &callsign)
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
void gotChanID(const QString &value)
MythUIButton * m_backButton
MythUIText * m_chanNameText
MythUIText * m_progStartTime
MythUIText * m_progSubtitle
MythUIText * m_progTitleText
MythUIType * GetFocusWidget(void) const
void SetText(const QString &text, bool moveCursor=true)
MythUIText * m_localChanNoText
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MythUIButton * m_finishButton
bool SetFocusWidget(MythUIType *widget=nullptr)
@ GENERIC_EXIT_OK
Exited with no error.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
~ArchiveFileSelector(void) override
void BuildFocusList(void)
MythUIButton * m_searchChanNameButton
void gotCallsign(const QString &value)
MythUIText * m_localChanNameText
void locationEditLostFocus(void)
ArchiveFileSelector(MythScreenStack *parent)
void(ImportNative::*)(const QString &) INSlot
MythUITextEdit * m_locationEdit
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
void updateSelectedList(void)
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
@ GENERIC_EXIT_RUNNING
Process is running.
MythUIButton * m_nextButton
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
@ kMSRunBackground
run child in the background
void itemSelected(MythUIButtonListItem *item)
MythUIButton * m_searchCallsignButton
MythUIText * m_chanNoText
MythUIButton * m_cancelButton
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
MythUIButton * m_searchChanIDButton
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void gotName(const QString &value)
MythUIText * m_callsignText
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
MythUIButton * m_prevButton
virtual void SetText(const QString &text)
MythUIButton * m_prevButton
MythMainWindow * GetMythMainWindow(void)
bool Create(void) override
static bool loadDetailsFromXML(const QString &filename, FileDetails *details)
MythScreenStack * GetStack(const QString &Stackname)
void fillSearchList(const QString &field)
MythUIButton * m_homeButton
MythUIText * m_progDateTimeText
@ kMSDontDisableDrawing
avoid disabling UI drawing
void SaveSetting(const QString &key, int newValue)
QString GetText(void) const
MythUIButtonList * m_fileButtonList
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MythUIText * m_localCallsignText
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
MythUIButton * m_searchChanNoButton
MythUIButton * m_cancelButton
QString GetSetting(const QString &key, const QString &defaultval="")
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
MythUIText * m_chanIDText