tuchulcha  0.10.1
Graphical Workflow Configuration Editor
LogDialog.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Jens-Malte Gottfried
2 
3  This file is part of Tuchulcha.
4 
5  Tuchulcha is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Tuchulcha is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with Tuchulcha. If not, see <http://www.gnu.org/licenses/>.
17  */
25 #ifndef LOGDIALOG_H
26 #define LOGDIALOG_H
27 
28 #include <QDialog>
29 #include <QProcess>
30 
31 namespace Ui {class LogDialog;}
32 class QTextCursor;
33 class QMutex;
34 class QFile;
35 class QStringListModel;
36 class LogViewProxyModel;
37 
38 namespace LogDecorators{ class Decorator; }
39 
41 
47 class LogDialog : public QDialog
48 {
49  Q_OBJECT
50 
51 public:
53 
58  explicit LogDialog(
59  LogDecorators::Decorator* decorator,
60  QWidget* parent=0, Qt::WindowFlags f=0);
61  virtual ~LogDialog();
63 
66  bool waitForFinished(int msecs=1500);
67 
69  bool hasErrorLines();
70 
71 public slots:
73 
74  virtual void done(int r);
76 
77  void terminate(bool force=false);
79 
80  void kill(bool force=false);
82  void reprint();
84  void printStatus(QString msg);
86  void loadSettings();
88  void saveSettings();
89 
90 signals:
92  void helpRequested(QString);
93 
94 private slots:
100  void on_proc_started();
102  void on_proc_finished(int=0);
104  void on_proc_error(QProcess::ProcessError);
106  void on_checkDD_toggled(bool);
108  void on_bSaveLog_clicked();
110  void on_sBufSize_valueChanged(int);
112  void on_bSearchDown_clicked();
114  void on_bSearchUp_clicked();
116 
119  void searchLog(QString filter, int offset=0, bool up=false);
121  void on_eFilter_textEdited(QString);
124 
125 private:
126  QStringListModel* _log;
130  Ui::LogDialog* _ui;
131  QProcess* _proc;
132  QFile* _logFile;
133  QMutex* _logMutex;
135 };
136 
137 #endif // LOGDIALOG_H
class for logging display and communication with external processes
Definition: LogDialog.h:47
void saveSettings()
store config to settings
Definition: LogDialog.cpp:186
void on_checkDD_toggled(bool)
handle debug checkbox
Definition: LogDialog.cpp:418
void on_proc_finished(int=0)
setup close button and hide progress bar
Definition: LogDialog.cpp:372
void on_proc_error(QProcess::ProcessError)
handle errors running the process
Definition: LogDialog.cpp:383
log decorator base class to handle different kinds of log dialogs
Definition: LogDecorators.h:40
QFile * _logFile
log content output
Definition: LogDialog.h:132
void reprint()
reparse log output
Definition: LogDialog.cpp:321
bool _errorLinesDetected
true if log contains error lines
Definition: LogDialog.h:134
Ui::LogDialog * _ui
designer ui
Definition: LogDialog.h:130
void printStatus(QString msg)
print status message
Definition: LogDialog.cpp:413
void searchLog(QString filter, int offset=0, bool up=false)
search for given string
Definition: LogDialog.cpp:476
void terminate(bool force=false)
terminate process
Definition: LogDialog.cpp:214
void loadSettings()
load config from settings
Definition: LogDialog.cpp:173
bool hasErrorLines()
query for possible error lines in logfile
Definition: LogDialog.cpp:317
void on_bSearchUp_clicked()
search up
Definition: LogDialog.cpp:515
void on_bSearchDown_clicked()
search down
Definition: LogDialog.cpp:511
void on_proc_readyReadStandardError()
update content by querying process (stderr)
Definition: LogDialog.cpp:281
QStringListModel * _log
log model
Definition: LogDialog.h:126
void helpRequested(QString)
request help on specified page
QProcess * _proc
tuchulcha-run process
Definition: LogDialog.h:131
void kill(bool force=false)
kill process
Definition: LogDialog.cpp:227
void on_sBufSize_valueChanged(int)
handle buf size changes
Definition: LogDialog.cpp:472
QMutex * _logMutex
avoid parallel writes to log window
Definition: LogDialog.h:133
void on_eFilter_textEdited(QString)
handle search filter changes
Definition: LogDialog.cpp:507
void on_proc_readyReadStandardOutput()
update content by querying process (stdout)
Definition: LogDialog.cpp:247
virtual void done(int r)
handle process termination
Definition: LogDialog.cpp:195
void on_buttonBox_helpRequested()
handle help request
Definition: LogDialog.cpp:519
LogDialog(LogDecorators::Decorator *decorator, QWidget *parent=0, Qt::WindowFlags f=0)
constructor
Definition: LogDialog.cpp:43
void on_bSaveLog_clicked()
save logfile
Definition: LogDialog.cpp:433
LogDecorators::Decorator * _decorator
decorator implementation
Definition: LogDialog.h:129
void on_proc_started()
setup abort button and show progress bar
Definition: LogDialog.cpp:356
bool waitForFinished(int msecs=1500)
wait for process to finish
Definition: LogDialog.cpp:237
LogViewProxyModel * _logProx
log model proxy
Definition: LogDialog.h:127
class for highlighting and handling filtering of log output