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