[vlc-commits] Message dialog: put the clear button in the corner
Jean-Baptiste Kempf
git at videolan.org
Sun Jun 10 23:15:41 CEST 2012
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Jun 10 15:06:40 2012 +0200| [05f6ff05dee969e7108fdbcaa08dc0cc578a98ec] | committer: Jean-Baptiste Kempf
Message dialog: put the clear button in the corner
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=05f6ff05dee969e7108fdbcaa08dc0cc578a98ec
---
modules/gui/qt4/dialogs/messages.cpp | 32 +++++++++++++++++---------------
modules/gui/qt4/dialogs/messages.hpp | 3 +--
modules/gui/qt4/ui/messages_panel.ui | 7 -------
3 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/modules/gui/qt4/dialogs/messages.cpp b/modules/gui/qt4/dialogs/messages.cpp
index 9fbcc9f..4071346 100644
--- a/modules/gui/qt4/dialogs/messages.cpp
+++ b/modules/gui/qt4/dialogs/messages.cpp
@@ -80,7 +80,6 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
ui.setupUi( this );
ui.bottomButtonsBox->addButton( new QPushButton( qtr("&Close"), this ),
QDialogButtonBox::RejectRole );
- updateTree();
/* Modules tree */
ui.modulesTree->setHeaderHidden( true );
@@ -97,13 +96,12 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
getSettings()->endGroup();
updateButton = new QPushButton( QIcon(":/update"), "" );
- updateButton->setToolTip( qtr("Update the tree") );
- ui.mainTab->setCornerWidget( updateButton );
- updateButton->setVisible( false );
updateButton->setFlat( true );
+ ui.mainTab->setCornerWidget( updateButton );
+
+ tabChanged(0);
- BUTTONACT( ui.clearButton, clear() );
- BUTTONACT( updateButton, updateTree() );
+ BUTTONACT( updateButton, updateOrClear() );
BUTTONACT( ui.saveLogButton, save() );
CONNECT( ui.filterEdit, editingFinished(), this, updateConfig() );
CONNECT( ui.filterEdit, textChanged(QString), this, filterMessages() );
@@ -118,6 +116,8 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
/* Hook up to LibVLC messaging */
vlc_Subscribe( &sub, MsgCallback, this );
+
+ buildTree( NULL, VLC_OBJECT( p_intf->p_libvlc ) );
}
MessagesDialog::~MessagesDialog()
@@ -235,11 +235,6 @@ void MessagesDialog::customEvent( QEvent *event )
sinkMessage( msge );
}
-void MessagesDialog::clear()
-{
- ui.messages->clear();
-}
-
bool MessagesDialog::save()
{
QString saveLogFileName = QFileDialog::getSaveFileName(
@@ -300,15 +295,22 @@ void MessagesDialog::buildTree( QTreeWidgetItem *parentItem,
vlc_list_release( l );
}
-void MessagesDialog::updateTree()
+void MessagesDialog::updateOrClear()
{
- ui.modulesTree->clear();
- buildTree( NULL, VLC_OBJECT( p_intf->p_libvlc ) );
+ if( ui.mainTab->currentIndex() == 1)
+ {
+ ui.modulesTree->clear();
+ buildTree( NULL, VLC_OBJECT( p_intf->p_libvlc ) );
+ }
+ else
+ ui.messages->clear();
}
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,
diff --git a/modules/gui/qt4/dialogs/messages.hpp b/modules/gui/qt4/dialogs/messages.hpp
index 0bdf85b..7f83787 100644
--- a/modules/gui/qt4/dialogs/messages.hpp
+++ b/modules/gui/qt4/dialogs/messages.hpp
@@ -64,8 +64,7 @@ private slots:
bool save();
void updateConfig();
void changeVerbosity( int );
- void clear();
- void updateTree();
+ void updateOrClear();
void tabChanged( int );
void filterMessages();
diff --git a/modules/gui/qt4/ui/messages_panel.ui b/modules/gui/qt4/ui/messages_panel.ui
index d1b2eed..53f7bfb 100644
--- a/modules/gui/qt4/ui/messages_panel.ui
+++ b/modules/gui/qt4/ui/messages_panel.ui
@@ -44,13 +44,6 @@
</property>
</widget>
</item>
- <item row="1" column="5">
- <widget class="QPushButton" name="clearButton">
- <property name="text">
- <string>&Clear</string>
- </property>
- </widget>
- </item>
<item row="1" column="1">
<widget class="QVLCDebugLevelSpinBox" name="verbosityBox">
<property name="wrapping">
More information about the vlc-commits
mailing list