MythTV  master
logviewer.h
Go to the documentation of this file.
1 #ifndef LOGVIEWER_H_
2 #define LOGVIEWER_H_
3 
4 // qt
5 #include <QTimer>
6 
7 // myth
8 #include <libmyth/mythcontext.h>
10 
11 static constexpr std::chrono::seconds DEFAULT_UPDATE_TIME { 5s };
12 
13 class MythUIButton;
14 class MythUIButtonList;
15 class MythUIText;
16 
17 void showLogViewer(void);
18 
19 class LogViewer : public MythScreenType
20 {
21  Q_OBJECT
22 
23  public:
24 
25  explicit LogViewer(MythScreenStack *parent)
26  : MythScreenType(parent, "logviewer"),
27  m_autoUpdate(gCoreContext->GetBoolSetting("LogViewerAutoUpdate", true)),
28  m_updateTime(gCoreContext->GetDurSetting<std::chrono::seconds>(
29  "LogViewerUpdateTime", DEFAULT_UPDATE_TIME))
30  {};
31  ~LogViewer(void) override;
32 
33  bool Create(void) override; // MythScreenType
34  bool keyPressEvent(QKeyEvent *e) override; // MythScreenType
35 
36  void setFilenames(const QString &progressLog, const QString &fullLog);
37 
38  protected slots:
39  static void cancelClicked(void);
40  void updateClicked(void);
41  void updateTimerTimeout(void);
42  void toggleAutoUpdate(void);
43  static bool loadFile(const QString& filename, QStringList &list, int startline);
44  void showProgressLog(void);
45  void showFullLog(void);
46  void ShowMenu(void) override; // MythScreenType
48 
49  private:
50  void Init(void) override; // MythScreenType
51  static QString getSetting(const QString &key);
52 
53  bool m_autoUpdate {false};
54  std::chrono::seconds m_updateTime {DEFAULT_UPDATE_TIME};
55  QTimer *m_updateTimer {nullptr};
56 
57  QString m_currentLog;
58  QString m_progressLog;
59  QString m_fullLog;
60 
62  MythUIText *m_logText {nullptr};
63 
67 };
68 
69 #endif
LogViewer::toggleAutoUpdate
void toggleAutoUpdate(void)
Definition: logviewer.cpp:161
LogViewer::~LogViewer
~LogViewer(void) override
Definition: logviewer.cpp:79
showLogViewer
void showLogViewer(void)
Definition: logviewer.cpp:24
LogViewer::setFilenames
void setFilenames(const QString &progressLog, const QString &fullLog)
Definition: logviewer.cpp:304
DEFAULT_UPDATE_TIME
static constexpr std::chrono::seconds DEFAULT_UPDATE_TIME
Definition: logviewer.h:11
LogViewer::updateLogItem
void updateLogItem(MythUIButtonListItem *item)
Definition: logviewer.cpp:171
MythScreenStack
Definition: mythscreenstack.h:16
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
LogViewer
Definition: logviewer.h:19
LogViewer::cancelClicked
static void cancelClicked(void)
Definition: logviewer.cpp:177
LogViewer::Create
bool Create(void) override
Definition: logviewer.cpp:86
true
VERBOSE_PREAMBLE Most true
Definition: verbosedefs.h:95
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
LogViewer::getSetting
static QString getSetting(const QString &key)
Definition: logviewer.cpp:230
LogViewer::m_autoUpdate
bool m_autoUpdate
Definition: logviewer.h:53
LogViewer::m_exitButton
MythUIButton * m_exitButton
Definition: logviewer.h:64
LogViewer::m_updateButton
MythUIButton * m_updateButton
Definition: logviewer.h:66
LogViewer::m_updateTimer
QTimer * m_updateTimer
Definition: logviewer.h:55
LogViewer::ShowMenu
void ShowMenu(void) override
Definition: logviewer.cpp:325
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
LogViewer::m_logText
MythUIText * m_logText
Definition: logviewer.h:62
LogViewer::Init
void Init(void) override
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: logviewer.cpp:124
LogViewer::m_cancelButton
MythUIButton * m_cancelButton
Definition: logviewer.h:65
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:54
LogViewer::showFullLog
void showFullLog(void)
Definition: logviewer.cpp:318
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
LogViewer::LogViewer
LogViewer(MythScreenStack *parent)
Definition: logviewer.h:25
std
Definition: mythchrono.h:23
LogViewer::showProgressLog
void showProgressLog(void)
Definition: logviewer.cpp:311
LogViewer::updateTimerTimeout
void updateTimerTimeout(void)
Definition: logviewer.cpp:156
mythcontext.h
LogViewer::m_progressLog
QString m_progressLog
Definition: logviewer.h:58
LogViewer::loadFile
static bool loadFile(const QString &filename, QStringList &list, int startline)
Definition: logviewer.cpp:257
LogViewer::updateClicked
void updateClicked(void)
Definition: logviewer.cpp:193
LogViewer::m_updateTime
std::chrono::seconds m_updateTime
Definition: logviewer.h:54
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
LogViewer::m_logList
MythUIButtonList * m_logList
Definition: logviewer.h:61
build_compdb.filename
filename
Definition: build_compdb.py:21
LogViewer::m_currentLog
QString m_currentLog
Definition: logviewer.h:57
LogViewer::m_fullLog
QString m_fullLog
Definition: logviewer.h:59
mythscreentype.h
LogViewer::keyPressEvent
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
Definition: logviewer.cpp:131