Go to the documentation of this file.
4 #include <QApplication>
7 #include <QDomDocument>
33 QDomDocument doc(
"mydocument");
35 if (!
file.open(QIODevice::ReadOnly))
38 if (!doc.setContent(&
file))
45 QString docType = doc.doctype().name();
47 if (docType ==
"MYTHARCHIVEITEM")
49 QDomNodeList itemNodeList = doc.elementsByTagName(
"item");
53 if (itemNodeList.count() < 1)
55 LOG(VB_GENERAL, LOG_ERR,
56 "Couldn't find an 'item' element in XML file");
60 QDomNode n = itemNodeList.item(0);
61 QDomElement e = n.toElement();
62 type = e.attribute(
"type");
64 if (
type ==
"recording")
66 QDomNodeList nodeList = e.elementsByTagName(
"recorded");
67 if (nodeList.count() < 1)
69 LOG(VB_GENERAL, LOG_ERR,
70 "Couldn't find a 'recorded' element in XML file");
82 if (e.tagName() ==
"title")
83 details->
title = e.text();
85 if (e.tagName() ==
"subtitle")
88 if (e.tagName() ==
"starttime")
91 if (e.tagName() ==
"description")
98 n = itemNodeList.item(0);
100 nodeList = e.elementsByTagName(
"channel");
101 if (nodeList.count() < 1)
103 LOG(VB_GENERAL, LOG_ERR,
104 "Couldn't find a 'channel' element in XML file");
112 n = nodeList.item(0);
114 details->
chanID = e.attribute(
"chanid");
115 details->
chanNo = e.attribute(
"channum");
116 details->
chanName = e.attribute(
"name");
117 details->
callsign = e.attribute(
"callsign");
122 QDomNodeList nodeList = e.elementsByTagName(
"videometadata");
123 if (nodeList.count() < 1)
125 LOG(VB_GENERAL, LOG_ERR,
126 "Couldn't find a 'videometadata' element in XML file");
130 n = nodeList.item(0);
138 if (e.tagName() ==
"title")
140 details->
title = e.text();
145 if (e.tagName() ==
"plot")
181 bool foundtheme =
LoadWindowFromXML(
"mythnative-ui.xml",
"archivefile_selector",
this);
200 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'archivefile_selector'");
251 .toString(
"dd MMM yy (hh:mm)"));
265 ShowOkPopup(tr(
"The selected item is not a valid archive file!"));
273 if (native->Create())
326 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'importarchive'");
342 .toString(
"dd MMM yy (hh:mm)"));
369 for (
int i = 0; i < actions.size() && !handled; i++)
371 const QString&
action = actions[i];
394 ShowOkPopup(tr(
"You need to select a valid channel id!"));
408 if (!tempDir.endsWith(
"/"))
411 QString logDir = tempDir +
"logs";
416 commandline =
"mytharchivehelper --logpath " + logDir +
" --importarchive "
418 "\" --chanid " + chanID;
425 ShowOkPopup(tr(
"It was not possible to import the Archive. "
426 " An error occured when running 'mytharchivehelper'") );
448 const QString &name,
const QString &callsign)
454 query.
prepare(
"SELECT chanid, channum, name, callsign FROM channel "
455 "WHERE chanid = :CHANID AND channum = :CHANNUM AND name = :NAME "
456 "AND callsign = :CALLSIGN;");
473 query.
prepare(
"SELECT chanid, channum, name, callsign FROM channel "
474 "WHERE callsign = :CALLSIGN;");
488 query.
prepare(
"SELECT chanid, channum, name, callsign FROM channel "
489 "WHERE name = :NAME;");
514 auto *searchDialog =
new
517 if (!searchDialog->Create())
520 searchDialog =
nullptr;
535 querystr = QString(
"SELECT %1 FROM channel ORDER BY %2").arg(field, field);
539 if (query.
exec(querystr))
561 query.
prepare(
"SELECT chanid, channum, name, callsign "
562 "FROM channel WHERE chanid = :CHANID;");
587 query.
prepare(
"SELECT chanid, channum, name, callsign "
588 "FROM channel WHERE channum = :CHANNUM;");
613 query.
prepare(
"SELECT chanid, channum, name, callsign "
614 "FROM channel WHERE name = :NAME;");
639 query.
prepare(
"SELECT chanid, channum, name, callsign "
640 "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