Go to the documentation of this file.
7 #include <QCoreApplication>
10 #include <QTextStream>
36 progressLog = logDir +
"/progress.log";
39 fullLog = logDir +
"/mythburn.log";
42 if ((!progressLog.isEmpty()) && (!fullLog.isEmpty()))
46 if (progressLog.isEmpty() && fullLog.isEmpty())
53 logFiles =
d.entryList(filters, QDir::Files | QDir::Readable, QDir::Time);
55 if (!logFiles.isEmpty())
58 progressLog = logDir +
'/' + logFiles[0];
67 if ((!progressLog.isEmpty()) || (!fullLog.isEmpty()))
70 viewer->setFilenames(progressLog, fullLog);
77 "Cannot find any logs to show!"));
104 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'logviewer'");
141 for (
int i = 0; i < actions.size() && !handled; i++)
143 const QString&
action = actions[i];
182 QFile lockFile(tempDir +
"/logs/mythburncancel.lck");
184 if (!lockFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
185 LOG(VB_GENERAL, LOG_ERR,
186 "LogViewer: Failed to create mythburncancel.lck file");
188 lockFile.write(
"Cancel\n\r");
191 ShowOkPopup(tr(
"Background creation has been asked to stop.\n"
192 "This may take a few minutes."));
204 bool bUpdateCurrent =
208 for (
const auto & label : std::as_const(list))
215 bool bRunning = (
getSetting(
"MythArchiveLastRunStatus") ==
"Running");
239 query.
prepare(
"SELECT data FROM settings WHERE value = :VALUE "
240 "AND hostname = :HOSTNAME ;");
246 return query.
value(0).toString();
251 LOG(VB_GENERAL, LOG_ERR,
252 QString(
"Database not open while trying to load setting: %1")
261 bool strip = !(
filename.endsWith(
"progress.log") ||
filename.endsWith(
"mythburn.log"));
270 if (
file.open( QIODevice::ReadOnly ))
273 QTextStream stream(&
file);
276 while ( !stream.atEnd() && startline > 0)
283 while ( !stream.atEnd() )
285 s = stream.readLine();
291 int pos = s.indexOf(
" - ");
332 auto *menuPopup =
new MythDialogBox(tr(
"Menu"), popupStack,
"actionmenu");
334 if (menuPopup->Create())
337 menuPopup->SetReturnEvent(
this,
"action");
void toggleAutoUpdate(void)
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
~LogViewer(void) override
QSqlQuery wrapper that fetches a DB connection from the connection pool.
MythScreenStack * GetMainStack()
void setFilenames(const QString &progressLog, const QString &fullLog)
void updateLogItem(MythUIButtonListItem *item)
QVariant value(int i) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
std::enable_if_t< std::chrono::__is_duration< T >::value, void > SaveDurSetting(const QString &key, T newValue)
QString getTempDirectory(bool showError)
static void cancelClicked(void)
bool Create(void) override
MythUIType * GetFocusWidget(void) const
void showWarningDialog(const QString &msg)
static QString getSetting(const QString &key)
MythUIButton * m_exitButton
MythUIButton * m_updateButton
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
bool SetFocusWidget(MythUIType *widget=nullptr)
Basic menu dialog, message and a list of options.
void ShowMenu(void) override
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
void BuildFocusList(void)
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
void SetEnabled(bool enable)
MythUIButton * m_cancelButton
bool isConnected(void) const
Only updated once during object creation.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
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.
void showProgressLog(void)
void updateTimerTimeout(void)
virtual void SetText(const QString &text)
MythMainWindow * GetMythMainWindow(void)
MythScreenStack * GetStack(const QString &Stackname)
static bool loadFile(const QString &filename, QStringList &list, int startline)
QString GetHostName(void)
std::chrono::seconds m_updateTime
static const iso6937table * d
void SaveSetting(const QString &key, int newValue)
MythUIButtonList * m_logList
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
QString GetSetting(const QString &key, const QString &defaultval="")
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.