tuchulcha  0.10.1
Graphical Workflow Configuration Editor
LogDecorators.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 LOG_DECORATORS_H
26 #define LOG_DECORATORS_H
27 
28 #include <QObject>
29 #include <QRegExp>
30 #include <QFont>
31 
32 class QStandardItemModel;
33 class QWidget;
34 class QTableView;
35 class QModelIndex;
36 
38 namespace LogDecorators {
40  class Decorator : public QObject {
41  Q_OBJECT
42  public:
43  Decorator();
44  virtual ~Decorator();
46  virtual QString title() const;
48  virtual QString desc() const;
50 
52  virtual bool ready(QWidget* parent) const;
54  virtual QStringList arguments() const = 0;
56 
58  virtual QStringList postStartCommands(QWidget* parent) const;
60  virtual QString filenameHint() const;
62  virtual QString logFileName() const = 0;
66 
68  virtual void processLine(QString line);
70  virtual void finishProcessing();
72  virtual QWidget* statusWidget();
74  virtual QString helpAnchor();
75 
76  signals:
77  void finish();
78  void message(QString);
79  void filter(QString);
80  };
81 
83  class Update : public Decorator {
84  Q_OBJECT
85  public:
86  Update();
87  virtual QStringList arguments() const;
88  virtual QStringList postStartCommands(QWidget* parent) const;
89  virtual QString title() const;
90  virtual QString desc() const;
91  virtual QString filenameHint() const;
92  virtual QString logFileName() const;
93  virtual void processLine(QString line);
94  virtual void finishProcessing();
95  virtual QWidget* statusWidget();
96  virtual QString helpAnchor();
97 
99  enum StatusCode {
100  Invalid = 0,
101  Passed = 1,
102  NoPlugin = 2,
103  Warnings = 4,
104  Failed = 6
105  };
106  private:
107  QString _summary;
108  QString _curFile;
110  QString _curPlugin;
111  QRegExp _fileRegex;
112  QRegExp _noPluginRegex;
113  QRegExp _warnRegex;
114  QRegExp _failRegex;
115  QRegExp _passRegex;
116  QRegExp _finishRegex;
117  QStandardItemModel* _result;
118  QTableView* _view;
119  QFont _ttFont;
120  QFont _sfFont;
121  private slots:
123  void _searchOutput(const QModelIndex&);
125  void _appendSummaryRow();
126  };
127 
129  class UpdateDynamics : public Decorator {
130  Q_OBJECT
131  public:
133 
134  UpdateDynamics(QString fileName);
135  virtual QString title() const;
136  virtual QString desc() const;
137  virtual QStringList arguments() const;
138  virtual QString logFileName() const;
139  virtual QStringList postStartCommands(QWidget* pp) const;
140  private:
141  QString _fileName;
142  };
143 
145  class RunWorkflow : public Decorator {
146  Q_OBJECT
147  public:
149 
150  RunWorkflow(QString fileName);
151  virtual bool ready(QWidget* parent) const;
152  virtual QStringList arguments() const;
154  virtual QString finishMessage() const;
155  virtual QStringList postStartCommands(QWidget* parent) const;
156  virtual QString filenameHint() const;
157  virtual QString logFileName() const;
158  virtual void processLine(QString line);
159  virtual QString helpAnchor();
160  signals:
162 
163  void highlightObject(QString objName) const;
164  private:
165  QString _fileName;
166  };
167 }
168 
169 #endif // LOG_DECORATORS_H
virtual QString finishMessage() const
finish message to display when workflow finished
QString _summary
update summary
virtual QString logFileName() const =0
logfile name for output logging
void message(QString)
status message
void filter(QString)
set search filter
decorator for run workspace dialog
void finish()
finish signal
QRegExp _failRegex
fail regex
log decorator base class to handle different kinds of log dialogs
Definition: LogDecorators.h:40
virtual QString title() const
title string
QRegExp _warnRegex
no plugin info
StatusCode _curStatus
status cache
virtual void processLine(QString line)
decorator hook to allow log line parsing
QRegExp _noPluginRegex
no plugin info
QRegExp _finishRegex
plugin unloaded
virtual QStringList arguments() const
determine command line arguments
decorator for update dialog
Definition: LogDecorators.h:83
void _appendSummaryRow()
append log row with current information
virtual QString desc() const
description string
QString _fileName
filename cache
virtual QString desc() const
description string
virtual QString title() const
title string
virtual QStringList postStartCommands(QWidget *pp) const
commands sent to the proccess after start
QFont _ttFont
typewriter font
virtual void finishProcessing()
inform about finished processing
RunWorkflow(QString fileName)
constructor
QStandardItemModel * _result
update summary
virtual QStringList postStartCommands(QWidget *parent) const
commands sent to the proccess after start
void highlightObject(QString objName) const
highlight the currently active object
StatusCode
status code used in log parsing
Definition: LogDecorators.h:99
QFont _sfFont
sans-serif font
virtual bool ready(QWidget *parent) const
check if process may be started
virtual QString logFileName() const
logfile name for output logging
virtual QWidget * statusWidget()
custom status widget
virtual void processLine(QString line)
decorator hook to allow log line parsing
virtual QStringList postStartCommands(QWidget *parent) const
commands sent to the proccess after start
QTableView * _view
summary list
virtual void finishProcessing()
inform about finished processing
virtual QString desc() const
description string
virtual QString filenameHint() const
hint for filename on save dialog
virtual QWidget * statusWidget()
custom status widget
virtual QString logFileName() const
logfile name for output logging
QString _fileName
filename cache
UpdateDynamics(QString fileName)
constructor
QString _curPlugin
plugin name cache
virtual QString helpAnchor()
html anchor on help page
info message: no plugin
virtual QString helpAnchor()
html anchor on help page
virtual QString title() const
title string
virtual QString filenameHint() const
hint for filename on save dialog
QRegExp _fileRegex
file name regexp
virtual bool ready(QWidget *parent) const
check if process may be started
decorator for update dynamics dialog
should not occur, initial value
QRegExp _passRegex
plugin passed regexp
virtual QString helpAnchor()
html anchor on help page
virtual QString filenameHint() const
hint for filename on save dialog
virtual QStringList postStartCommands(QWidget *parent) const
commands sent to the proccess after start
bool debugOutput
debug output mode
Definition: LogDecorators.h:64
void _searchOutput(const QModelIndex &)
show corresponding log line on selection
QString _curFile
file name cache
virtual QStringList arguments() const
determine command line arguments
virtual void processLine(QString line)
decorator hook to allow log line parsing
virtual QStringList arguments() const
determine command line arguments
virtual QStringList arguments() const =0
determine command line arguments
virtual QString logFileName() const
logfile name for output logging