Vidalia  0.2.21
MessageLog.h
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file MessageLog.h
13 ** \brief Displays log messages and message log settings
14 */
15 
16 #ifndef _MESSAGELOG_H
17 #define _MESSAGELOG_H
18 
19 #include "ui_MessageLog.h"
20 #include "VidaliaWindow.h"
21 #include "LogFile.h"
22 #include "TorControl.h"
23 #include "VidaliaSettings.h"
24 
25 class LogTreeItem;
26 class QStringList;
27 
28 class MessageLog : public VidaliaWindow
29 {
30  Q_OBJECT
31 
32 public:
33  /** Default constructor **/
34  MessageLog(QWidget *parent = 0, Qt::WFlags flags = 0);
35  /** Default destructor **/
36  ~MessageLog();
37 
38 protected:
39  /** Called when the user changes the UI translation. */
40  virtual void retranslateUi();
41 
42 private slots:
43  /** Adds the passed message to the message log as the specified type **/
44  void log(tc::Severity severity, const QString &msg);
45  /** Called when the user triggers the "Save All" action. */
46  void saveAll();
47  /** Called when the user triggers "Save Selected" action. */
48  void saveSelected();
49  /** Called when the user triggers the "Select All" action. */
50  void selectAll();
51  /** Called when the user triggers the "Copy" action. */
52  void copy();
53  /** Called when the user triggers the "Clear" action. */
54  void clear();
55  /** Called when the user triggers the "Find" action. This will search
56  * through all currently displayed log entries for text specified by the
57  * user, highlighting the entries that contain a match. */
58  void find();
59  /** Called when user saves settings **/
60  void saveSettings();
61  /** Called when user cancels changed settings **/
62  void cancelChanges();
63  /** Called when the user clicks "Browse" to select a new log file. */
64  void browse();
65  /** Called when the user clicks "Help" to see help info about the log. */
66  void help();
67 
68 private:
69  /** Create and bind actions to events **/
70  void createActions();
71  /** Set Tool Tips for various widgets **/
72  void setToolTips();
73  /** Loads the saved Message Log settings **/
74  void loadSettings();
75  /** Registers the current message filter with Tor */
76  void registerLogEvents();
77  /** Saves the given list of items to a file */
78  void save(const QStringList &messages);
79  /** Rotates the log file based on the filename and the current logging status. */
80  bool rotateLogFile(const QString &filename);
81 
82  /** A pointer to a TorControl object, used to register for log events */
84  /** A VidaliaSettings object that handles getting/saving settings **/
86  /** Stores the current message filter */
87  uint _filter;
88  /** Set to true if we will log all messages to a file. */
90  /* The log file used to store log messages. */
92 
93  /** Qt Designer generatated QObject **/
94  Ui::MessageLog ui;
95 };
96 
97 #endif
98