All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Static Public Member Functions
Qtilities::CoreGui::LoggerGui Class Reference

A class providing static member functions to acccess and create GUIs related to the Qtilities Logging library. More...

#include <LoggerGui.h>

List of all members.

Static Public Member Functions

static QDockWidget * createLogDockWidget (QString *engine_name, WidgetLoggerEngine::MessageDisplaysFlag message_displays_flag=WidgetLoggerEngine::DefaultDisplays, const QString &window_title=QString(), bool is_active=true, Logger::MessageTypeFlags message_types=Logger::AllLogLevels)
 Creates and returns a new logger dock widget.
static QWidget * createLoggerConfigWidget (bool applyButtonVisible=true)
 Return a settings widget for the logger.
static QWidget * createLogWidget (QString *engine_name, WidgetLoggerEngine::MessageDisplaysFlag message_displays_flag=WidgetLoggerEngine::DefaultDisplays, const QString &window_title=QString(), bool is_active=true, Logger::MessageTypeFlags message_types=Logger::AllLogLevels)
 Creates and returns a new logger widget.
static QWidget * createTempLogWidget (QString *engine_name, WidgetLoggerEngine::MessageDisplaysFlag message_displays_flag=WidgetLoggerEngine::DefaultDisplays, const QString &window_title=QString(), Logger::MessageTypeFlags message_types=Logger::AllLogLevels, const QSize &size=QSize(1000, 600))
 Creates and returns a temporary logger widget.

Detailed Description

A class providing static member functions to acccess and create GUIs related to the Qtilities Logging library.

This class allows easy creation of log widgets through static functions. For example:

// Create the widget:
QString engine_name = "Session Log"
QDockWidget* session_log_dock = LoggerGui::createLogDockWidget(&engine_name);
session_log_dock->show();
// We can then access the AbstractLoggerEngine created using the engine name:
AbstractLoggerEngine* engine = Log->loggerEngineReference(*engine_name);

The QDockWidget produced by the above code is shown below. Note the ready to use Qtilities::CoreGui::SearchBoxWidget at the bottom of the log window.

log_dock_widget.jpg
Log Dock Widget

Member Function Documentation

static QDockWidget* Qtilities::CoreGui::LoggerGui::createLogDockWidget ( QString *  engine_name,
WidgetLoggerEngine::MessageDisplaysFlag  message_displays_flag = WidgetLoggerEngine::DefaultDisplays,
const QString &  window_title = QString(),
bool  is_active = true,
Logger::MessageTypeFlags  message_types = Logger::AllLogLevels 
)
inlinestatic

Creates and returns a new logger dock widget.

This function is similar to createLogWidget() but it wraps the widget produced by createLogWidget() with a QDockWidget().

Parameters:
engine_nameThe name of the engine.
message_displays_flagThe message display flags indicating which message tabs should be shown in the logger widget.
window_titleThe created window's title. By default an empty string is passed which will result in the engine_name being used.
is_activeIndicates if the engine must be active after it was created.
message_typesThe message types which must be logged in this log widget.
Note:
The user must manage the new widget instance.
See also:
createLogWidget(), createTempLogWidget()
static QWidget* Qtilities::CoreGui::LoggerGui::createLogWidget ( QString *  engine_name,
WidgetLoggerEngine::MessageDisplaysFlag  message_displays_flag = WidgetLoggerEngine::DefaultDisplays,
const QString &  window_title = QString(),
bool  is_active = true,
Logger::MessageTypeFlags  message_types = Logger::AllLogLevels 
)
inlinestatic

Creates and returns a new logger widget.

When creating new logger widgets through the LoggerGui class the name assigned to the log can change if a engine with the same name already exists. Therefore you pass the name to the logger as a pointer which will be updated with the new name if it was changed. When a engine with the same name exists the name will be changed by adding " (1)" to the engine (where the number will match an unused number).

Parameters:
engine_nameThe name of the engine. If an engine with the same name already exists this function will assign an unique name to the new widget by appending a number to engine_name.
message_displays_flagThe message display flags indicating which message tabs should be shown in the logger widget.
window_titleThe created window's title. By default an empty string is passed which will result in the engine_name being used.
is_activeIndicates if the engine must be active after it was created.
message_typesThe message types which must be logged in this log widget.

For example:

// Get a widget that shows all log messages:
QString log_widget_name = tr("Session Log");
QWidget* log_widget = LoggerGui::createLogWidget(&log_widget_name);
// We can now access the AbstractLoggerEngine instance like this:
AbstractLoggerEngine* log_engine = Log->loggerEngineReference(log_widget_name);
Q_ASSERT(log_engine);
// As an example, lets change the message context to log only messages specifically logged to this engine:
log_engine->setMessageContexts(Logger::EngineSpecificMessages);
Note:
The user must manage the new widget instance.
See also:
createTempLogWidget(), createLogDockWidget()
static QWidget* Qtilities::CoreGui::LoggerGui::createTempLogWidget ( QString *  engine_name,
WidgetLoggerEngine::MessageDisplaysFlag  message_displays_flag = WidgetLoggerEngine::DefaultDisplays,
const QString &  window_title = QString(),
Logger::MessageTypeFlags  message_types = Logger::AllLogLevels,
const QSize &  size = QSize(1000,600) 
)
inlinestatic

Creates and returns a temporary logger widget.

Temporary log widgets are usefull when you want to given updates to the user during intensive processing. In that case you can create a temp log widget using this function and when you are done with your processing you can simply close the widget causing it to be deleted (The Qt::WA_DeleteOnClose flag is set to true on the widget to enable this behaviour).

The returned widget is essentially the same as the widget created using createLogWidget(), except for the following:

  • It is active by default.
  • It has a parameter which you can specify its size explicity, the default is 1000x600.
  • The widget is positioned in the middle of the screen.
  • The widget has its Qt::WA_QuitOnClose attribute set to false, thus if the temporary widget is still open when the application is closed it will be destructed and the application will close. Note that this depends on the way widgets are managed in your application, by default the mentioned behavior will happen.
Parameters:
engine_nameThe name of the engine.
message_displays_flagThe message display flags indicating which message tabs should be shown in the logger widget.
window_titleThe created window's title. By default an empty string is passed which will result in the engine_name being used.
message_typesThe message types which must be logged in this log widget.
sizeThe size of the widget
Note:
The user must manage the new widget instance.
See also:
createLogWidget(), createLogDockWidget()


Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé