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