Commit 05f6ff05 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Message dialog: put the clear button in the corner

parent 3023a06e
...@@ -80,7 +80,6 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) ...@@ -80,7 +80,6 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
ui.setupUi( this ); ui.setupUi( this );
ui.bottomButtonsBox->addButton( new QPushButton( qtr("&Close"), this ), ui.bottomButtonsBox->addButton( new QPushButton( qtr("&Close"), this ),
QDialogButtonBox::RejectRole ); QDialogButtonBox::RejectRole );
updateTree();
/* Modules tree */ /* Modules tree */
ui.modulesTree->setHeaderHidden( true ); ui.modulesTree->setHeaderHidden( true );
...@@ -97,13 +96,12 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) ...@@ -97,13 +96,12 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
getSettings()->endGroup(); getSettings()->endGroup();
updateButton = new QPushButton( QIcon(":/update"), "" ); updateButton = new QPushButton( QIcon(":/update"), "" );
updateButton->setToolTip( qtr("Update the tree") );
ui.mainTab->setCornerWidget( updateButton );
updateButton->setVisible( false );
updateButton->setFlat( true ); updateButton->setFlat( true );
ui.mainTab->setCornerWidget( updateButton );
tabChanged(0);
BUTTONACT( ui.clearButton, clear() ); BUTTONACT( updateButton, updateOrClear() );
BUTTONACT( updateButton, updateTree() );
BUTTONACT( ui.saveLogButton, save() ); BUTTONACT( ui.saveLogButton, save() );
CONNECT( ui.filterEdit, editingFinished(), this, updateConfig() ); CONNECT( ui.filterEdit, editingFinished(), this, updateConfig() );
CONNECT( ui.filterEdit, textChanged(QString), this, filterMessages() ); CONNECT( ui.filterEdit, textChanged(QString), this, filterMessages() );
...@@ -118,6 +116,8 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) ...@@ -118,6 +116,8 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
/* Hook up to LibVLC messaging */ /* Hook up to LibVLC messaging */
vlc_Subscribe( &sub, MsgCallback, this ); vlc_Subscribe( &sub, MsgCallback, this );
buildTree( NULL, VLC_OBJECT( p_intf->p_libvlc ) );
} }
MessagesDialog::~MessagesDialog() MessagesDialog::~MessagesDialog()
...@@ -235,11 +235,6 @@ void MessagesDialog::customEvent( QEvent *event ) ...@@ -235,11 +235,6 @@ void MessagesDialog::customEvent( QEvent *event )
sinkMessage( msge ); sinkMessage( msge );
} }
void MessagesDialog::clear()
{
ui.messages->clear();
}
bool MessagesDialog::save() bool MessagesDialog::save()
{ {
QString saveLogFileName = QFileDialog::getSaveFileName( QString saveLogFileName = QFileDialog::getSaveFileName(
...@@ -300,15 +295,22 @@ void MessagesDialog::buildTree( QTreeWidgetItem *parentItem, ...@@ -300,15 +295,22 @@ void MessagesDialog::buildTree( QTreeWidgetItem *parentItem,
vlc_list_release( l ); vlc_list_release( l );
} }
void MessagesDialog::updateTree() void MessagesDialog::updateOrClear()
{ {
ui.modulesTree->clear(); if( ui.mainTab->currentIndex() == 1)
buildTree( NULL, VLC_OBJECT( p_intf->p_libvlc ) ); {
ui.modulesTree->clear();
buildTree( NULL, VLC_OBJECT( p_intf->p_libvlc ) );
}
else
ui.messages->clear();
} }
void MessagesDialog::tabChanged( int i ) void MessagesDialog::tabChanged( int i )
{ {
updateButton->setVisible( i == 1 ); updateButton->setIcon( i == 1 ? QIcon(":/update") : QIcon(":/toolbar/clear") );
updateButton->setToolTip( i == 1 ? qtr("Update the tree")
: qtr("Clear the messages") );
} }
void MessagesDialog::MsgCallback( void *self, int type, const msg_item_t *item, void MessagesDialog::MsgCallback( void *self, int type, const msg_item_t *item,
......
...@@ -64,8 +64,7 @@ private slots: ...@@ -64,8 +64,7 @@ private slots:
bool save(); bool save();
void updateConfig(); void updateConfig();
void changeVerbosity( int ); void changeVerbosity( int );
void clear(); void updateOrClear();
void updateTree();
void tabChanged( int ); void tabChanged( int );
void filterMessages(); void filterMessages();
......
...@@ -44,13 +44,6 @@ ...@@ -44,13 +44,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="5">
<widget class="QPushButton" name="clearButton">
<property name="text">
<string>&amp;Clear</string>
</property>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QVLCDebugLevelSpinBox" name="verbosityBox"> <widget class="QVLCDebugLevelSpinBox" name="verbosityBox">
<property name="wrapping"> <property name="wrapping">
......
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