messagelog.h

Go to the documentation of this file.
00001 /****************************************************************
00002  *  Vidalia is distributed under the following license:
00003  *
00004  *  Copyright (C) 2006,  Matt Edman, Justin Hipple
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  as published by the Free Software Foundation; either version 2
00009  *  of the License, or (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00019  *  Boston, MA  02110-1301, USA.
00020  ****************************************************************/
00021 
00022 /** 
00023  * \file messagelog.h
00024  * \version $Id: messagelog.h 1238 2006-09-25 17:50:57Z edmanm $
00025  * \brief Displays log messages and message log settings
00026  */
00027 
00028 #ifndef _MESSAGELOG_H
00029 #define _MESSAGELOG_H
00030 
00031 #include <QMainWindow>
00032 #include <QResizeEvent>
00033 #include <control/torcontrol.h>
00034 #include <config/vidaliasettings.h>
00035 #include <gui/common/vidaliawindow.h>
00036 
00037 #include "logfile.h"
00038 #include "logtreeitem.h"
00039 #include "ui_messagelog.h"
00040 
00041 
00042 class MessageLog : public VidaliaWindow
00043 {
00044   Q_OBJECT
00045 
00046 public:
00047   /** Default constructor **/
00048   MessageLog(QWidget *parent = 0, Qt::WFlags flags = 0);
00049   /** Default destructor **/
00050   ~MessageLog();
00051   
00052 protected:
00053   /** Called to deliver custom event types */
00054   void customEvent(QEvent *event);
00055   
00056 private slots:
00057   /** Called when the user triggers the save all action **/
00058   void saveAll();
00059   /** Called when the user triggers save selected action **/
00060   void saveSelected();
00061   /** Called when the user triggers the copy action **/
00062   void copy();
00063   /** Called when the user triggers the find action. This will search
00064    * through all currently displayed log entries for text specified by the
00065    * user, highlighting the entries that contain a match. */
00066   void find();
00067   /** Called when user saves settings **/
00068   void saveSettings();
00069   /** Called when user cancels changed settings **/
00070   void cancelChanges();
00071   /** Called when the user clicks "Browse" to select a new log file. */
00072   void browse();
00073   /** Called when the user clicks "Help" to see help info about the log. */
00074   void help();
00075 
00076 protected:
00077   /** Responds to the user resizing the message log. */
00078   void resizeEvent(QResizeEvent *event);
00079   
00080 private:  
00081   /** Create and bind actions to events **/
00082   void createActions();
00083   /** Set Tool Tips for various widgets **/
00084   void setToolTips();
00085   /** Loads the saved Message Log settings **/
00086   void loadSettings();
00087   /** Registers the current message filter with Tor */
00088   void registerLogEvents();
00089   /** Saves the given list of items to a file */
00090   void save(QList<LogTreeItem *> items);
00091   /** Adds the passed message to the message log as the specified type **/
00092   void log(LogEvent::Severity, QString msg);
00093   /** Rotates the log file based on the filename and the current logging status. */
00094   bool rotateLogFile(QString filename);
00095 
00096   /** A pointer to a TorControl object, used to register for log events */
00097   TorControl* _torControl;
00098   /** A VidaliaSettings object that handles getting/saving settings **/
00099   VidaliaSettings* _settings;
00100   /** Stores the current message filter */
00101   uint _filter;
00102   /** Set to true if we will log all messages to a file. */      
00103   bool _enableLogging;  
00104   /* The log file used to store log messages. */
00105   LogFile _logFile;
00106 
00107   /** Qt Designer generatated QObject **/
00108   Ui::MessageLog ui;
00109 };
00110 
00111 #endif
00112 

Generated on Mon Oct 23 20:08:16 2006 for Vidalia by  doxygen 1.5.0