casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
logviewer.qo.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 //# $Id: $
26 
27 
28 #ifndef LOGVIEWER_H
29 #define LOGVIEWER_H
30 
31 #if ! defined(__APPLE__) || defined(__USE_WS_X11__)
32 #include <graphics/X11/X_enter.h>
33 #endif
34 
35 #include <fstream>
36 #include <QMainWindow>
37 #include <QMap>
38 #include <QModelIndex>
39 #include <QPointer>
40 #include <QMutex>
41 #include <QTime>
42 #include <QFileSystemWatcher>
43 #include <QTextStream>
44 
45 
46 class QAction;
47 class QComboBox;
48 class QLineEdit;
49 class QTreeView;
50 class QTreeWidget;
51 class QMenu;
52 class QFile;
53 class QSortFilterProxyModel;
54 class QCheckBox;
55 class QLabel;
56 
57 #if ! defined(__APPLE__) || defined(__USE_WS_X11__)
58 #include <graphics/X11/X_exit.h>
59 #endif
60 
61 namespace casa {
62 
63 class LogModel;
64 class FileWatcher;
65 
66 class LogViewer : public QMainWindow
67 {
68  Q_OBJECT
69 
70 public:
71  LogViewer(QString logger = 0, QWidget *parent = 0);
72 
73 protected:
74  virtual void closeEvent(QCloseEvent *e);
75  virtual void moveEvent(QMoveEvent *e);
76 
77 private:
78  void setupFileActions();
79  void setupEditActions();
80  void setupInsertActions();
81  void updateMenus();
82  bool load(const QString &f);
83  bool maybeSave();
84 
85 private slots:
86  void fileOpen();
87  bool fileSave();
88  bool fileSaveAs();
89  void filePrint();
90  void filePrintPdf();
91  void fileChanged(const QString&);
92  void logOpen();
93 
94  void search();
95  void findNext();
96  void remove();
97  void purge();
98  void copy();
99  void insert();
100  void changeFilterText();
101  void changeFilterColumn(int);
102  void doFilter();
103  void refresh();
104  void reload();
105  void hide();
106  void changeFont();
107 
108  void clicked(const QModelIndex &index);
109 
110  virtual QSize sizeHint () const;
111 
112 private:
113 
114  QAction *actionOpen,
115  *actionSave,
116  *actionSaveAs,
117  *actionSearch,
118  *actionNext,
119  *actionFilter,
120  *actionInsert,
121  *actionCopy,
122  *actionDelete,
124  *actionPrint,
125  *actionPdf,
129  *actionWrite,
130  *actionRefresh,
131  *actionReload,
132  *actionLarge,
133  *actionSmall;
134 
135  QLineEdit *searchText,
136  *insertText,
137  *filterText;
138 
139  QComboBox *filterColumn;
140 
141  QToolBar *tb;
142  QLabel *searchLabel;
143  QLabel *filterLabel;
144  QLabel *insertLabel;
145 
147  QModelIndex currentLogRow;
148  QString currentFilter;
149  QString currentSearch;
150  int nextRow;
151 
152  QString fileName;
153 
154  //#
155  //# Switched from QTextStream to ifstream because QTextStream seemed broken
156  //# on RHEL5 (qt4-4.2.1-1). If this is changed, test on RHEL5 *and* qt 4.2.1.
157  //#
158  std::ifstream *logStream;
159 
160  QTreeView *logView;
162  QSortFilterProxyModel *proxyModel;
163  QFileSystemWatcher *logWatcher;
164  qint64 logPos;
165  bool canClose;
166  QCheckBox* lockScroll;
167 
168  QMutex mutex;
169 };
170 
171 }
172 #endif
QAction * actionDelete
Definition: logviewer.qo.h:114
QModelIndex currentLogRow
Definition: logviewer.qo.h:147
QAction * actionHidePrio
Definition: logviewer.qo.h:114
virtual void closeEvent(QCloseEvent *e)
QAction * actionLarge
Definition: logviewer.qo.h:114
QLineEdit * searchText
Definition: logviewer.qo.h:135
QAction * actionSave
Definition: logviewer.qo.h:114
QAction * actionPrint
Definition: logviewer.qo.h:114
QToolBar * tb
Definition: logviewer.qo.h:141
QLineEdit * insertText
Definition: logviewer.qo.h:135
std::ifstream * logStream
Definition: logviewer.qo.h:158
QSortFilterProxyModel * proxyModel
Definition: logviewer.qo.h:162
virtual void moveEvent(QMoveEvent *e)
virtual QSize sizeHint() const
void setupInsertActions()
QAction * actionNext
Definition: logviewer.qo.h:114
void setupFileActions()
QAction * actionOpen
Definition: logviewer.qo.h:114
QAction * actionHideDate
Definition: logviewer.qo.h:114
void clicked(const QModelIndex &index)
LogModel * logModel
Definition: logviewer.qo.h:161
void changeFilterText()
QLabel * searchLabel
Definition: logviewer.qo.h:142
LogViewer(QString logger=0, QWidget *parent=0)
QAction * actionFilter
Definition: logviewer.qo.h:114
void setupEditActions()
QAction * actionPdf
Definition: logviewer.qo.h:114
QString currentSearch
Definition: logviewer.qo.h:149
QAction * actionSaveAs
Definition: logviewer.qo.h:114
void changeFilterColumn(int)
void fileChanged(const QString &)
QAction * actionCopy
Definition: logviewer.qo.h:114
QLineEdit * filterText
Definition: logviewer.qo.h:135
QAction * actionReload
Definition: logviewer.qo.h:114
QComboBox * filterColumn
Definition: logviewer.qo.h:139
QAction * actionDeleteAll
Definition: logviewer.qo.h:114
QLabel * filterLabel
Definition: logviewer.qo.h:143
const Double e
e and functions thereof:
QAction * actionSmall
Definition: logviewer.qo.h:114
QFileSystemWatcher * logWatcher
Definition: logviewer.qo.h:163
QAction * actionInsert
Definition: logviewer.qo.h:114
QAction * actionRefresh
Definition: logviewer.qo.h:114
QAction * actionWrite
Definition: logviewer.qo.h:114
QString currentFilter
Definition: logviewer.qo.h:148
QAction * actionHideFrom
Definition: logviewer.qo.h:114
QTreeView * logView
Definition: logviewer.qo.h:160
QLabel * insertLabel
Definition: logviewer.qo.h:144
bool load(const QString &f)
QCheckBox * lockScroll
Definition: logviewer.qo.h:166
QAction * actionSearch
Definition: logviewer.qo.h:114