LogTextEdit.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
3 
4  This file is part of the TerraLib - a Framework for building GIS enabled
5  applications.
6 
7  TerraLib is free software: you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation, either version 3 of the License,
10  or (at your option) any later version.
11 
12  TerraLib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with TerraLib. See COPYING. If not, write to
19  TerraLib Team at <terralib-team@terralib.org>.
20  */
21 
22 /*!
23  \file terralib/qt/widgets/ceditor/LogTextEdit.h
24 
25  \brief A TextEdit that can be used to watch a log file.
26 */
27 
28 #ifndef __TERRALIB_QTWIDGETS_LOG_LOGTEXTEDIT_H__
29 #define __TERRALIB_QTWIDGETS_LOG_LOGTEXTEDIT_H__
30 
31 // TerraLib
32 #include "../Config.h"
33 #include "../../../core/filesystem/FileWatcher.h"
34 
35 // STL
36 #include <memory>
37 
38 // QT
39 #include <QPlainTextEdit>
40 
41 namespace te
42 {
43 
44  namespace qt
45  {
46  namespace widgets
47  {
48  class TEQTWIDGETSEXPORT LogTextEdit : public QPlainTextEdit
49  {
50  Q_OBJECT
51  public:
52  LogTextEdit(QWidget *parent = 0, const QString& fileName = "");
53  ~LogTextEdit();
54 
55  public slots:
56  void findAll(const QString &str);
57 
58  private slots:
59  void textReady();
60  void read();
61 
62  signals:
63  void textPending();
64 
65  private:
66  QFile m_file;
67  std::unique_ptr<te::core::FileWatcher> m_watcher;
68  qint64 m_pos;
69  };
70  } // end namespace widgets
71  } // end namespace qt
72 } // end namespace te
73 #endif //__TERRALIB_QTWIDGETS_LOG_LOGTEXTEDIT_H__
std::unique_ptr< te::core::FileWatcher > m_watcher
Definition: LogTextEdit.h:67
#define slots
URI C++ Library.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63