Commit 1075ddb2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: convert VLC message stuff to QString

parent 166da1ce
......@@ -47,23 +47,32 @@ enum {
class MsgEvent : public QEvent
{
public:
MsgEvent( msg_item_t *msg )
: QEvent( (QEvent::Type)MsgEvent_Type )
{
this->msg = msg_Copy( msg );
}
virtual ~MsgEvent( void )
{
msg_Free( msg );
}
msg_item_t *msg;
MsgEvent( const msg_item_t * );
int priority;
uintptr_t object_id;
QString object_type;
QString header;
QString module;
QString text;
};
MsgEvent::MsgEvent( const msg_item_t *msg )
: QEvent( (QEvent::Type)MsgEvent_Type ),
priority( msg->i_type ),
object_id( msg->i_object_id ),
object_type( qfu(msg->psz_object_type) ),
header( qfu(msg->psz_header) ),
module( qfu(msg->psz_module) ),
text( qfu(msg->psz_msg) )
{
}
struct msg_cb_data_t
{
MessagesDialog *self;
};
static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
......@@ -71,7 +80,6 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
{
setWindowTitle( qtr( "Messages" ) );
setWindowRole( "vlc-messages" );
/* Build Ui */
ui.setupUi( this );
ui.bottomButtonsBox->addButton( new QPushButton( qtr("&Close"), this ),
......@@ -160,7 +168,7 @@ void MessagesDialog::updateConfig()
}
}
void MessagesDialog::sinkMessage( msg_item_t *item )
void MessagesDialog::sinkMessage( MsgEvent *msg )
{
QTextEdit *messages = ui.messages;
/* Only scroll if the viewport is at the end.
......@@ -180,9 +188,9 @@ void MessagesDialog::sinkMessage( msg_item_t *item )
messages->setFontItalic( true );
messages->setTextColor( "darkBlue" );
messages->insertPlainText( qfu( item->psz_module ) );
messages->insertPlainText( msg->module );
switch (item->i_type)
switch (msg->priority)
{
case VLC_MSG_INFO:
messages->setTextColor( "blue" );
......@@ -206,7 +214,7 @@ void MessagesDialog::sinkMessage( msg_item_t *item )
/* Add message Regular black Font */
messages->setFontItalic( false );
messages->setTextColor( "black" );
messages->insertPlainText( qfu(item->psz_msg) );
messages->insertPlainText( msg->text );
messages->insertPlainText( "\n" );
if ( b_autoscroll ) messages->ensureCursorVisible();
}
......@@ -216,7 +224,7 @@ void MessagesDialog::customEvent( QEvent *event )
MsgEvent *msge = static_cast<MsgEvent *>(event);
assert( msge );
sinkMessage( msge->msg );
sinkMessage( msge );
}
void MessagesDialog::clear()
......
......@@ -37,6 +37,7 @@ class QTextEdit;
class QTreeWidget;
class QTreeWidgetItem;
class QLineEdit;
class MsgEvent;
class MessagesDialog : public QVLCFrame, public Singleton<MessagesDialog>
{
......@@ -50,7 +51,7 @@ private:
msg_cb_data_t *cbData;
static void sinkMessage( msg_cb_data_t *, msg_item_t *, unsigned );
void customEvent( QEvent * );
void sinkMessage( msg_item_t *item );
void sinkMessage( MsgEvent * );
private slots:
bool save();
......
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