Go to the documentation of this file.
10 #include <QDomDocument>
74 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'exportnative'");
107 for (
int i = 0; i < actions.size() && !handled; i++)
109 QString
action = actions[i];
116 else if (
action ==
"DELETE")
144 QString tmpSize = QString(
"%1 Mb").arg(freeSpace);
189 (a->subtitle !=
"" ? a->subtitle +
"\n" :
"") + a->description);
198 ShowOkPopup(tr(
"You need to add at least one item to archive!"));
236 item->SetData(QVariant::fromValue(a));
254 query.
prepare(
"SELECT intid, type, title, subtitle, description, size, "
255 "startdate, starttime, filename, hascutlist "
256 "FROM archiveitems WHERE type = 'Recording' OR type = 'Video' "
257 "ORDER BY title, subtitle");
265 item->
id = query.
value(0).toInt();
266 item->type = query.
value(1).toString();
267 item->title = query.
value(2).toString();
268 item->subtitle = query.
value(3).toString();
269 item->description = query.
value(4).toString();
270 item->size = query.
value(5).toLongLong();
271 item->startDate = query.
value(6).toString();
272 item->startTime = query.
value(7).toString();
273 item->filename = query.
value(8).toString();
274 item->hasCutlist = (query.
value(9).toInt() > 0);
275 item->useCutlist =
false;
276 item->editedDetails =
false;
301 query.
prepare(
"DELETE FROM archiveitems;");
304 "deleting archiveitems", query);
307 query.
prepare(
"INSERT INTO archiveitems (type, title, subtitle, "
308 "description, startdate, starttime, size, filename, hascutlist, "
309 "duration, cutduration, videowidth, videoheight, filecodec,"
310 "videocodec, encoderprofile) "
311 "VALUES(:TYPE, :TITLE, :SUBTITLE, :DESCRIPTION, :STARTDATE, "
312 ":STARTTIME, :SIZE, :FILENAME, :HASCUTLIST, :DURATION, "
313 ":CUTDURATION, :VIDEOWIDTH, :VIDEOHEIGHT, :FILECODEC, "
314 ":VIDEOCODEC, :ENCODERPROFILE);");
319 query.
bindValue(
":SUBTITLE", a->subtitle);
320 query.
bindValue(
":DESCRIPTION", a->description);
321 query.
bindValue(
":STARTDATE", a->startDate);
322 query.
bindValue(
":STARTTIME", a->startTime);
324 query.
bindValue(
":FILENAME", a->filename);
325 query.
bindValue(
":HASCUTLIST", a->hasCutlist);
343 auto *menuPopup =
new MythDialogBox(tr(
"Menu"), popupStack,
"actionmenu");
345 if (menuPopup->Create())
348 menuPopup->SetReturnEvent(
this,
"action");
362 query.
prepare(
"DELETE FROM archiveitems WHERE filename = :FILENAME;");
363 query.
bindValue(
":FILENAME", curItem->filename);
372 QDomDocument doc(
"NATIVEARCHIVEJOB");
374 QDomElement root = doc.createElement(
"nativearchivejob");
375 doc.appendChild(root);
377 QDomElement job = doc.createElement(
"job");
378 root.appendChild(job);
380 QDomElement media = doc.createElement(
"media");
381 job.appendChild(media);
386 QDomElement
file = doc.createElement(
"file");
387 file.setAttribute(
"type", a->type.toLower() );
388 file.setAttribute(
"title", a->title);
389 file.setAttribute(
"filename", a->filename);
390 file.setAttribute(
"delete",
"0");
391 media.appendChild(
file);
395 QDomElement
options = doc.createElement(
"options");
406 if (!f.open(QIODevice::WriteOnly))
408 LOG(VB_GENERAL, LOG_ERR,
409 QString(
"ExportNative::createConfigFile: "
410 "Failed to open file for writing - %1") .arg(
filename));
415 t << doc.toString(4);
422 QString logDir = tempDir +
"logs";
423 QString configDir = tempDir +
"config";
430 if (QFile::exists(logDir +
"/mythburncancel.lck"))
431 QFile::remove(logDir +
"/mythburncancel.lck");
434 commandline =
"mytharchivehelper --logpath " + logDir +
" --nativearchive "
435 "--outfile " + configDir +
"/mydata.xml";
442 ShowOkPopup(tr(
"It was not possible to create the DVD. "
443 "An error occured when running the scripts") );
459 if (selector->Create())
472 query.
prepare(
"SELECT title FROM videometadata");
489 if (selector->Create())
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()
void handlePrevPage(void)
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 getArchiveList(void)
ArchiveDestination m_archiveDestination
QVariant value(int i) const
MythUIText * m_maxsizeText
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
void saveConfiguration(void)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythUIButton * m_nextButton
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
@ GENERIC_EXIT_OK
Exited with no error.
QString getTempDirectory(bool showError)
MythUIText * m_descriptionText
MythUIButton * m_addrecordingButton
MythUIText * m_nofilesText
MythUIType * GetFocusWidget(void) const
MythUIProgressBar * m_sizeBar
void titleChanged(MythUIButtonListItem *item)
MythUIText * m_datetimeText
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void updateArchiveList(void)
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
~ExportNative(void) override
void handleAddRecording(void)
void handleAddVideo(void)
void createConfigFile(const QString &filename)
bool SetFocusWidget(MythUIType *widget=nullptr)
Basic menu dialog, message and a list of options.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
void BuildFocusList(void)
MythUIButton * m_cancelButton
MythUIButton * m_prevButton
MythUIText * m_currsizeText
void handleNextPage(void)
MythUIText * m_minsizeText
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
bool Create(void) override
void ShowMenu(void) override
MythUIText * m_filesizeText
QList< ArchiveItem * > m_archiveList
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
MBASE_PUBLIC QString formatKBytes(int64_t sizeKB, int prec=1)
MythUIButton * m_addvideoButton
@ kMSRunBackground
run child in the background
MythScreenType * m_previousScreen
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
virtual void SetText(const QString &text)
MythMainWindow * GetMythMainWindow(void)
MythScreenStack * GetStack(const QString &Stackname)
int numRowsAffected() const
void getArchiveListFromDB(void)
MythUIText * m_currsizeErrText
void loadConfiguration(void)
@ kMSDontDisableDrawing
avoid disabling UI drawing
@ GENERIC_EXIT_RUNNING
Process is running.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MythUIButtonList * m_archiveButtonList
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
void selectorClosed(bool ok)
QString GetSetting(const QString &key, const QString &defaultval="")
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.