Debian Codegraph @

HercStudio/LogWidget.h

raw symbols SCIP
1 /*
2 * File: LogsWidget.h
3 *
4 * Author: Jacob Dekel
5 * Created on: July 1, 2010
6 *
7 * Copyright (c) 2010 Jacob Dekel
8 * $Id:
9 *
10 * Multiple QTextEdit wrapper with selection tab
11 *
12 * This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 *
25 */
26
27 #ifndef LOGSWIDGET_H_
28 #define LOGSWIDGET_H_
29
30 #include <QTextEdit>
31 #include <QResizeEvent>
32 #include <QString>
33
34 class QTabWidget;
35 class PlainLogWidget : public QTextEdit
36 {
37 Q_OBJECT
38 public:
39 enum WriteType
40 {
41 MenuCommand,
42 Overflow,
43 Shutdown
44 } ;
45 PlainLogWidget(QWidget * parent, const char * suffix="");
46 virtual void append(const QByteArray & text);
47 virtual QString toPlainText();
48 virtual bool isOSLog();
49 virtual void writeToFile(WriteType type);
50 virtual void preferencesChanged();
51 virtual void setIpled(bool ipled);
52 virtual void clear();
53 virtual bool textIsSelected(); // text to be copied available
54 virtual QString copySelectedText(); // copies selected text to clipboard
55
56
57 protected:
58
59 void getTimeStamp(bool withDate);
60 void setLogFileName (QString& suffix);
61 char mTimeStamp[64];
62 int mLogFileLines;
63 bool mIpled;
64 bool mSaveLog;
65 QString mLogFileName;
66 QColor mGreen, mYellow, mRed, mBlack, mWhite;
67 long mLinesWritten;
68 bool mDarkBackground;
69 bool mSelectedTextExists;
70
71 private slots:
72 void keepSelection(bool selected);
73
74 signals:
75 void logCopy();
76 };
77
78
79 class LogWidget : public PlainLogWidget
80 {
81 Q_OBJECT
82 public:
83 LogWidget(QWidget * parent);
84 virtual ~LogWidget();
85
86 int active();
87 void setActive(int i);
88 void setReadOnly(bool readOnly);
89 void setFont(const QFont & font);
90 void setTextBackgroundColor (const QColor &);
91 void setTextColor (const QColor &);
92 QTabWidget * tabWidget();
93 virtual bool empty();
94 virtual void clear();
95 virtual bool textIsSelected();
96 virtual QString copySelectedText();
97
98 virtual void append(const QByteArray & text);
99 virtual QString toPlainText();
100 virtual bool isOSLog();
101 virtual void writeToFile(PlainLogWidget::WriteType writeType);
102 virtual void preferencesChanged();
103 virtual void setIpled(bool ipled);
104
105 private:
106 const int cHercIndex;
107 const int cOsIndex;
108 QTabWidget * mTabWidget;
109 PlainLogWidget * mLogs[2];
110 int mActive;
111 bool mIpled;
112 };
113
114 #endif /* LOGSWIDGET_H_ */