MessageLog Class Reference

#include <messagelog.h>

Inheritance diagram for MessageLog:

VidaliaWindow

List of all members.

Public Member Functions

 MessageLog (QWidget *parent=0, Qt::WFlags flags=0)
 ~MessageLog ()

Protected Member Functions

void customEvent (QEvent *event)

Private Slots

void saveAll ()
void saveSelected ()
void copy ()
void find ()
void saveSettings ()
void cancelChanges ()
void browse ()
void help ()

Private Member Functions

void createActions ()
void setToolTips ()
void loadSettings ()
void registerLogEvents ()
void save (QStringList messages)
void log (LogEvent::Severity, QString msg)
bool rotateLogFile (QString filename)

Private Attributes

TorControl_torControl
VidaliaSettings_settings
uint _filter
bool _enableLogging
LogFile _logFile
Ui::MessageLog ui


Detailed Description

Definition at line 32 of file messagelog.h.


Constructor & Destructor Documentation

MessageLog::MessageLog ( QWidget *  parent = 0,
Qt::WFlags  flags = 0 
)

Default constructor

Constructor. The constructor will load the message log's settings from VidaliSettings and register for log events according to the most recently set severity filter.

Parameters:
torControl A TorControl object used to register for log events.
parent The parent widget of this MessageLog object.
flags Any desired window creation flags.

Definition at line 55 of file messagelog.cpp.

References _torControl, createActions(), loadSettings(), setToolTips(), LogTreeWidget::TimeColumn, Vidalia::torControl(), and ui.

MessageLog::~MessageLog (  ) 

Default destructor

Default Destructor. Simply frees up any memory allocated for member variables.

Definition at line 80 of file messagelog.cpp.

References _logFile, and LogFile::close().


Member Function Documentation

void MessageLog::browse (  )  [private, slot]

Called when the user clicks "Browse" to select a new log file.

Definition at line 267 of file messagelog.cpp.

References ui.

Referenced by createActions().

void MessageLog::cancelChanges (  )  [private, slot]

Called when user cancels changed settings

Simply restores the previously saved settings and hides the settings frame.

Definition at line 257 of file messagelog.cpp.

References loadSettings(), and ui.

Referenced by createActions().

void MessageLog::copy (  )  [private, slot]

Called when the user triggers the copy action

Copies contents of currently selected messages to the 'clipboard'.

Definition at line 334 of file messagelog.cpp.

References ui.

Referenced by createActions().

void MessageLog::createActions (  )  [private]

Create and bind actions to events

Binds events (signals) to actions (slots).

Definition at line 87 of file messagelog.cpp.

References browse(), cancelChanges(), copy(), Vidalia::createShortcut(), find(), help(), saveAll(), saveSelected(), saveSettings(), and ui.

Referenced by MessageLog().

void MessageLog::customEvent ( QEvent *  event  )  [protected]

Called to deliver custom event types

Custom event handler. Checks if the event is a log event. If it is, then it will write the message to the message log.

Parameters:
event The custom log event.

Definition at line 402 of file messagelog.cpp.

References log(), CustomEventType::LogEvent, LogEvent::message(), and LogEvent::severity().

void MessageLog::find (  )  [private, slot]

Called when the user triggers the find action. This will search through all currently displayed log entries for text specified by the user, highlighting the entries that contain a match.

Prompts the user for a search string. If the search string is not found in any of the currently displayed log entires, then a message will be displayed for the user informing them that no matches were found.

See also:
search()

Definition at line 349 of file messagelog.cpp.

References VMessageBox::information(), VMessageBox::Ok, p(), and ui.

Referenced by createActions().

void MessageLog::help (  )  [private, slot]

Called when the user clicks "Help" to see help info about the log.

Displays help information about the message log.

Definition at line 413 of file messagelog.cpp.

References VidaliaWindow::helpRequested().

Referenced by createActions().

void MessageLog::loadSettings (  )  [private]

void MessageLog::log ( LogEvent::Severity  type,
QString  message 
) [private]

Adds the passed message to the message log as the specified type

Writes a message to the Message History and tags it with the proper date, time and type.

Parameters:
type The message's severity type.
message The log message to be added.

Definition at line 375 of file messagelog.cpp.

References _enableLogging, _filter, _logFile, LogTreeItem::toString(), and ui.

Referenced by customEvent().

void MessageLog::registerLogEvents (  )  [private]

Registers the current message filter with Tor

Attempts to register the selected message filter with Tor and displays an error if setting the events fails.

Definition at line 176 of file messagelog.cpp.

References _filter, _torControl, DEFAULT_MSG_FILTER, VidaliaWindow::getSetting(), VMessageBox::Ok, p(), TorControl::setLogEvents(), SETTING_MSG_FILTER, and VMessageBox::warning().

Referenced by loadSettings(), and saveSettings().

bool MessageLog::rotateLogFile ( QString  filename  )  [private]

Rotates the log file based on the filename and the current logging status.

Opens a log file if necessary, or closes it if logging is disabled. If a log file is already opened and a new filename is specified, then the log file will be rotated to the new filename. In the case that the new filename can not be openend, the old file will remain open and writable.

Definition at line 192 of file messagelog.cpp.

References _enableLogging, _logFile, LogFile::close(), VMessageBox::Ok, LogFile::open(), p(), and VMessageBox::warning().

Referenced by loadSettings(), and saveSettings().

void MessageLog::save ( QStringList  messages  )  [private]

Saves the given list of items to a file

Saves the given list of items to a file.

Parameters:
items A list of log message items to save.

Definition at line 282 of file messagelog.cpp.

References VMessageBox::Ok, LogFile::open(), p(), and VMessageBox::warning().

Referenced by saveAll(), and saveSelected().

void MessageLog::saveAll (  )  [private, slot]

Called when the user triggers the save all action

Saves all shown messages to a file.

Definition at line 327 of file messagelog.cpp.

References save(), and ui.

Referenced by createActions().

void MessageLog::saveSelected (  )  [private, slot]

Called when the user triggers save selected action

Saves currently selected messages to a file.

Definition at line 320 of file messagelog.cpp.

References save(), and ui.

Referenced by createActions().

void MessageLog::saveSettings (  )  [private, slot]

Called when user saves settings

Saves the Message Log settings, adjusts the message list if required, and then hides the settings frame.

Definition at line 212 of file messagelog.cpp.

References _enableLogging, _filter, _logFile, ADD_TO_FILTER, LogEvent::Debug, LogEvent::Error, LogEvent::Info, LogFile::isOpen(), LogEvent::Notice, VMessageBox::Ok, p(), registerLogEvents(), rotateLogFile(), VidaliaWindow::saveSetting(), SETTING_ENABLE_LOGFILE, SETTING_LOGFILE, SETTING_MAX_MSG_COUNT, SETTING_MSG_FILTER, ui, LogEvent::Warn, and VMessageBox::warning().

Referenced by createActions().

void MessageLog::setToolTips (  )  [private]

Set Tool Tips for various widgets

Set tooltips for Message Filter checkboxes in code because they are long and Designer wouldn't let us insert newlines into the text.

Definition at line 123 of file messagelog.cpp.

References ui.

Referenced by MessageLog().


Member Data Documentation

Set to true if we will log all messages to a file.

Definition at line 89 of file messagelog.h.

Referenced by loadSettings(), log(), rotateLogFile(), and saveSettings().

uint MessageLog::_filter [private]

Stores the current message filter

Definition at line 87 of file messagelog.h.

Referenced by loadSettings(), log(), registerLogEvents(), and saveSettings().

Definition at line 91 of file messagelog.h.

Referenced by loadSettings(), log(), rotateLogFile(), saveSettings(), and ~MessageLog().

A VidaliaSettings object that handles getting/saving settings

Reimplemented from VidaliaWindow.

Definition at line 85 of file messagelog.h.

A pointer to a TorControl object, used to register for log events

Definition at line 83 of file messagelog.h.

Referenced by MessageLog(), and registerLogEvents().

Ui::MessageLog MessageLog::ui [private]

Qt Designer generatated QObject

Definition at line 94 of file messagelog.h.

Referenced by browse(), cancelChanges(), copy(), createActions(), find(), loadSettings(), log(), MessageLog(), saveAll(), saveSelected(), saveSettings(), and setToolTips().


The documentation for this class was generated from the following files:

Generated on Wed Nov 26 21:04:21 2008 for Vidalia by  doxygen 1.5.7.1