Commit 6327c52d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: apply verbosity filtering within Qt, do not rely on core

parent 28fde051
......@@ -42,29 +42,28 @@
* @{
*/
/** Message types */
enum msg_item_type
{
VLC_MSG_INFO=0, /**< Important information */
VLC_MSG_ERR, /**< Error */
VLC_MSG_WARN, /**< Warning */
VLC_MSG_DBG, /**< Debug */
};
/**
* Store a single message sent to user.
* Log message
*/
typedef struct
{
int i_type; /**< message type, see below */
uintptr_t i_object_id;
const char *psz_object_type;
const char *psz_module;
const char *psz_header; /**< Additional header */
char * psz_msg; /**< the message itself */
unsigned i_type; /**< Message type, see @ref msg_item_type */
uintptr_t i_object_id; /**< Emitter (temporaly) unique object ID or 0 */
const char *psz_object_type; /**< Emitter object type name */
const char *psz_module; /**< Emitter module (source code) */
const char *psz_header; /**< Additional header (used by VLM media) */
char *psz_msg; /**< Message text */
} msg_item_t;
/* Message types */
/** standard messages */
#define VLC_MSG_INFO 0
/** error messages */
#define VLC_MSG_ERR 1
/** warning messages */
#define VLC_MSG_WARN 2
/** debug messages */
#define VLC_MSG_DBG 3
VLC_MALLOC VLC_USED
static inline msg_item_t *msg_Copy (const msg_item_t *msg)
{
......
/*****************************************************************************
* Messages.cpp : Information about an item
****************************************************************************
* Copyright (C) 2006-2007 the VideoLAN team
* Copyright (C) 2006-2011 the VideoLAN team
* $Id$
*
* Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
......@@ -25,6 +25,7 @@
#endif
#include "dialogs/messages.hpp"
#include <vlc_atomic.h>
#include <QTextEdit>
#include <QTextCursor>
......@@ -73,8 +74,6 @@ struct msg_cb_data_t
MessagesDialog *self;
};
static void MsgCallback( msg_cb_data_t *, const msg_item_t * );
MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
: QVLCFrame( _p_intf )
{
......@@ -92,7 +91,9 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
/* Buttons and general layout */
ui.saveLogButton->setToolTip( qtr( "Saves all the displayed logs to a file" ) );
ui.verbosityBox->setValue( var_InheritInteger( p_intf, "verbose" ) );
int verbosity = var_InheritInteger( p_intf, "verbose" );
vlc_atomic_set( &this->verbosity, verbosity );
ui.verbosityBox->setValue( verbosity );
ui.vbobjectsEdit->setText(config_GetPsz( p_intf, "verbose-objects"));
ui.vbobjectsEdit->setToolTip( "verbose-objects usage: \n"
......@@ -122,7 +123,6 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
cbData = new msg_cb_data_t;
cbData->self = this;
sub = msg_Subscribe( p_intf->p_libvlc, MsgCallback, cbData );
changeVerbosity( ui.verbosityBox->value() );
}
MessagesDialog::~MessagesDialog()
......@@ -134,7 +134,7 @@ MessagesDialog::~MessagesDialog()
void MessagesDialog::changeVerbosity( int verbosity )
{
msg_SubscriptionSetVerbosity( sub , verbosity );
vlc_atomic_set( &this->verbosity, verbosity );
}
void MessagesDialog::updateConfig()
......@@ -296,11 +296,15 @@ void MessagesDialog::tabChanged( int i )
updateButton->setVisible( i == 1 );
}
static void MsgCallback( msg_cb_data_t *data, const msg_item_t *item )
void MessagesDialog::MsgCallback( msg_cb_data_t *data, const msg_item_t *item )
{
int canc = vlc_savecancel();
MessagesDialog *dialog = data->self;
int verbosity = vlc_atomic_get( &dialog->verbosity );
QApplication::postEvent( data->self, new MsgEvent( item ) );
if( verbosity < 0 || verbosity < (item->i_type - VLC_MSG_ERR) )
return;
int canc = vlc_savecancel();
QApplication::postEvent( dialog, new MsgEvent( item ) );
vlc_restorecancel( canc );
}
......@@ -53,6 +53,9 @@ private:
void customEvent( QEvent * );
void sinkMessage( MsgEvent * );
vlc_atomic_t verbosity;
static void MsgCallback( msg_cb_data_t *, const msg_item_t * );
private slots:
bool save();
void updateConfig();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment