Vidalia 0.2.15
|
00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If you 00004 ** did not receive the LICENSE file with this file, you may obtain it from the 00005 ** Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 00007 ** including this file, may be copied, modified, propagated, or distributed 00008 ** except according to the terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file MessageLog.h 00013 ** \brief Displays log messages and message log settings 00014 */ 00015 00016 #ifndef _MESSAGELOG_H 00017 #define _MESSAGELOG_H 00018 00019 #include "ui_MessageLog.h" 00020 #include "VidaliaWindow.h" 00021 #include "LogFile.h" 00022 #include "TorControl.h" 00023 #include "VidaliaSettings.h" 00024 00025 class LogTreeItem; 00026 class QStringList; 00027 00028 class MessageLog : public VidaliaWindow 00029 { 00030 Q_OBJECT 00031 00032 public: 00033 /** Default constructor **/ 00034 MessageLog(QWidget *parent = 0, Qt::WFlags flags = 0); 00035 /** Default destructor **/ 00036 ~MessageLog(); 00037 00038 protected: 00039 /** Called when the user changes the UI translation. */ 00040 virtual void retranslateUi(); 00041 00042 private slots: 00043 /** Adds the passed message to the message log as the specified type **/ 00044 void log(tc::Severity severity, const QString &msg); 00045 /** Called when the user triggers the "Save All" action. */ 00046 void saveAll(); 00047 /** Called when the user triggers "Save Selected" action. */ 00048 void saveSelected(); 00049 /** Called when the user triggers the "Select All" action. */ 00050 void selectAll(); 00051 /** Called when the user triggers the "Copy" action. */ 00052 void copy(); 00053 /** Called when the user triggers the "Clear" action. */ 00054 void clear(); 00055 /** Called when the user triggers the "Find" action. This will search 00056 * through all currently displayed log entries for text specified by the 00057 * user, highlighting the entries that contain a match. */ 00058 void find(); 00059 /** Called when user saves settings **/ 00060 void saveSettings(); 00061 /** Called when user cancels changed settings **/ 00062 void cancelChanges(); 00063 /** Called when the user clicks "Browse" to select a new log file. */ 00064 void browse(); 00065 /** Called when the user clicks "Help" to see help info about the log. */ 00066 void help(); 00067 00068 private: 00069 /** Create and bind actions to events **/ 00070 void createActions(); 00071 /** Set Tool Tips for various widgets **/ 00072 void setToolTips(); 00073 /** Loads the saved Message Log settings **/ 00074 void loadSettings(); 00075 /** Registers the current message filter with Tor */ 00076 void registerLogEvents(); 00077 /** Saves the given list of items to a file */ 00078 void save(const QStringList &messages); 00079 /** Rotates the log file based on the filename and the current logging status. */ 00080 bool rotateLogFile(const QString &filename); 00081 00082 /** A pointer to a TorControl object, used to register for log events */ 00083 TorControl* _torControl; 00084 /** A VidaliaSettings object that handles getting/saving settings **/ 00085 VidaliaSettings* _settings; 00086 /** Stores the current message filter */ 00087 uint _filter; 00088 /** Set to true if we will log all messages to a file. */ 00089 bool _enableLogging; 00090 /* The log file used to store log messages. */ 00091 LogFile _logFile; 00092 00093 /** Qt Designer generatated QObject **/ 00094 Ui::MessageLog ui; 00095 }; 00096 00097 #endif 00098