Commit 4f28199b authored by Rémi Duraffort's avatar Rémi Duraffort

Add an "update button" to update the modules tree.

parent 5609e081
...@@ -49,9 +49,10 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) ...@@ -49,9 +49,10 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
/* General widgets */ /* General widgets */
QGridLayout *mainLayout = new QGridLayout( this ); QGridLayout *mainLayout = new QGridLayout( this );
QTabWidget *mainTab = new QTabWidget( this ); mainTab = new QTabWidget( this );
mainTab->setTabPosition( QTabWidget::North ); mainTab->setTabPosition( QTabWidget::North );
/* Messages */ /* Messages */
QWidget *msgWidget = new QWidget; QWidget *msgWidget = new QWidget;
QGridLayout *msgLayout = new QGridLayout( msgWidget ); QGridLayout *msgLayout = new QGridLayout( msgWidget );
...@@ -76,10 +77,11 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) ...@@ -76,10 +77,11 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
treeLayout->addWidget( modulesTree, 0, 0, 1, 0 ); treeLayout->addWidget( modulesTree, 0, 0, 1, 0 );
mainTab->addTab( treeWidget, qtr( "Modules tree" ) ); mainTab->addTab( treeWidget, qtr( "Modules tree" ) );
/* Buttons and general layout */ /* Buttons and general layout */
QPushButton *closeButton = new QPushButton( qtr( "&Close" ) ); QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
closeButton->setDefault( true ); closeButton->setDefault( true );
clearButton = new QPushButton( qtr( "&Clear" ) ); clearUpdateButton = new QPushButton( qtr( "&Clear" ) );
saveLogButton = new QPushButton( qtr( "&Save as..." ) ); saveLogButton = new QPushButton( qtr( "&Save as..." ) );
verbosityBox = new QSpinBox(); verbosityBox = new QSpinBox();
...@@ -94,11 +96,11 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) ...@@ -94,11 +96,11 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
mainLayout->addWidget( verbosityLabel, 1, 0, 1, 1 ); mainLayout->addWidget( verbosityLabel, 1, 0, 1, 1 );
mainLayout->addWidget( verbosityBox, 1, 1 ); mainLayout->addWidget( verbosityBox, 1, 1 );
mainLayout->addWidget( saveLogButton, 1, 3 ); mainLayout->addWidget( saveLogButton, 1, 3 );
mainLayout->addWidget( clearButton, 1, 4 ); mainLayout->addWidget( clearUpdateButton, 1, 4 );
mainLayout->addWidget( closeButton, 1, 5 ); mainLayout->addWidget( closeButton, 1, 5 );
BUTTONACT( closeButton, hide() ); BUTTONACT( closeButton, hide() );
BUTTONACT( clearButton, clear() ); BUTTONACT( clearUpdateButton, clearOrUpdate() );
BUTTONACT( saveLogButton, save() ); BUTTONACT( saveLogButton, save() );
CONNECT( mainTab, currentChanged( int ), CONNECT( mainTab, currentChanged( int ),
this, updateTab( int ) ); this, updateTab( int ) );
...@@ -109,19 +111,21 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) ...@@ -109,19 +111,21 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
void MessagesDialog::updateTab( int index ) void MessagesDialog::updateTab( int index )
{ {
/* Second tab : modules tree */
if( index == 1 ) if( index == 1 )
{ {
verbosityLabel->hide(); verbosityLabel->hide();
verbosityBox->hide(); verbosityBox->hide();
clearButton->hide(); clearUpdateButton->setText( qtr( "&Update" ) );
saveLogButton->hide(); saveLogButton->hide();
updateTree(); updateTree();
} }
/* First tab : messages */
else else
{ {
verbosityLabel->show(); verbosityLabel->show();
verbosityBox->show(); verbosityBox->show();
clearButton->show(); clearUpdateButton->setText( qtr( "&Clear" ) );
saveLogButton->show(); saveLogButton->show();
} }
} }
...@@ -221,6 +225,14 @@ void MessagesDialog::buildTree( QTreeWidgetItem *parentItem, ...@@ -221,6 +225,14 @@ void MessagesDialog::buildTree( QTreeWidgetItem *parentItem,
vlc_object_release( p_obj ); vlc_object_release( p_obj );
} }
void MessagesDialog::clearOrUpdate()
{
if( mainTab->currentIndex() )
updateTree();
else
clear();
}
void MessagesDialog::updateTree() void MessagesDialog::updateTree()
{ {
modulesTree->clear(); modulesTree->clear();
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "util/qvlcframe.hpp" #include "util/qvlcframe.hpp"
class QTabWidget;
class QPushButton; class QPushButton;
class QSpinBox; class QSpinBox;
class QGridLayout; class QGridLayout;
...@@ -55,19 +56,21 @@ public: ...@@ -55,19 +56,21 @@ public:
private: private:
MessagesDialog( intf_thread_t * ); MessagesDialog( intf_thread_t * );
static MessagesDialog *instance; static MessagesDialog *instance;
QTabWidget *mainTab;
QSpinBox *verbosityBox; QSpinBox *verbosityBox;
QLabel *verbosityLabel; QLabel *verbosityLabel;
QTextEdit *messages; QTextEdit *messages;
QTreeWidget *modulesTree; QTreeWidget *modulesTree;
QPushButton *clearButton; QPushButton *clearUpdateButton;
QPushButton *saveLogButton; QPushButton *saveLogButton;
private slots: private slots:
void updateTab( int ); void updateTab( int );
void updateLog(); void updateLog();
void clear(); void clearOrUpdate();
bool save(); bool save();
private: private:
void clear();
void updateTree(); void updateTree();
void buildTree( QTreeWidgetItem *, vlc_object_t * ); void buildTree( QTreeWidgetItem *, vlc_object_t * );
}; };
......
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