Commit 7cd31167 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt, Message dialog: use a nicer update button

Close #4300
parent 6ea360ad
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include "dialogs/messages.hpp" #include "dialogs/messages.hpp"
#include <QSpinBox>
#include <QLabel>
#include <QTextEdit> #include <QTextEdit>
#include <QTextCursor> #include <QTextCursor>
#include <QFileDialog> #include <QFileDialog>
...@@ -36,10 +34,8 @@ ...@@ -36,10 +34,8 @@
#include <QTabWidget> #include <QTabWidget>
#include <QTreeWidget> #include <QTreeWidget>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QHeaderView>
#include <QMutex> #include <QMutex>
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton>
#include <QScrollBar> #include <QScrollBar>
#include <assert.h> #include <assert.h>
...@@ -83,7 +79,7 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) ...@@ -83,7 +79,7 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
updateTree(); updateTree();
/* Modules tree */ /* Modules tree */
ui.modulesTree->header()->hide(); ui.modulesTree->setHeaderHidden( true );
/* Buttons and general layout */ /* Buttons and general layout */
ui.saveLogButton->setToolTip( qtr( "Saves all the displayed logs to a file" ) ); ui.saveLogButton->setToolTip( qtr( "Saves all the displayed logs to a file" ) );
...@@ -95,14 +91,21 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) ...@@ -95,14 +91,21 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
"--verbose-objects=+printthatobject,-dontprintthatone\n" "--verbose-objects=+printthatobject,-dontprintthatone\n"
"(keyword 'all' to applies to all objects)"); "(keyword 'all' to applies to all objects)");
updateButton = new QPushButton( QIcon(":/update"), "" );
ui.mainTab->setCornerWidget( updateButton );
updateButton->setVisible( false );
updateButton->setFlat( true );
BUTTONACT( ui.clearButton, clear() ); BUTTONACT( ui.clearButton, clear() );
BUTTONACT( ui.updateButton, updateTree() ); BUTTONACT( updateButton, updateTree() );
BUTTONACT( ui.saveLogButton, save() ); BUTTONACT( ui.saveLogButton, save() );
CONNECT( ui.vbobjectsEdit, editingFinished(), this, updateConfig()); CONNECT( ui.vbobjectsEdit, editingFinished(), this, updateConfig());
CONNECT( ui.bottomButtonsBox, rejected(), this, hide() ); CONNECT( ui.bottomButtonsBox, rejected(), this, hide() );
CONNECT( ui.verbosityBox, valueChanged( int ), CONNECT( ui.verbosityBox, valueChanged( int ),
this, changeVerbosity( int ) ); this, changeVerbosity( int ) );
CONNECT( ui.mainTab, currentChanged( int ), this, tabChanged( int ) );
/* General action */ /* General action */
readSettings( "Messages", QSize( 600, 450 ) ); readSettings( "Messages", QSize( 600, 450 ) );
...@@ -279,6 +282,11 @@ void MessagesDialog::updateTree() ...@@ -279,6 +282,11 @@ void MessagesDialog::updateTree()
buildTree( NULL, VLC_OBJECT( p_intf->p_libvlc ) ); buildTree( NULL, VLC_OBJECT( p_intf->p_libvlc ) );
} }
void MessagesDialog::tabChanged( int i )
{
updateButton->setVisible( i == 1 );
}
static void MsgCallback( msg_cb_data_t *data, msg_item_t *item, unsigned ) static void MsgCallback( msg_cb_data_t *data, msg_item_t *item, unsigned )
{ {
int canc = vlc_savecancel(); int canc = vlc_savecancel();
......
...@@ -58,10 +58,13 @@ private slots: ...@@ -58,10 +58,13 @@ private slots:
void changeVerbosity( int ); void changeVerbosity( int );
void clear(); void clear();
void updateTree(); void updateTree();
void tabChanged( int );
private: private:
void buildTree( QTreeWidgetItem *, vlc_object_t * ); void buildTree( QTreeWidgetItem *, vlc_object_t * );
friend class Singleton<MessagesDialog>; friend class Singleton<MessagesDialog>;
QPushButton *updateButton;
}; };
#endif #endif
...@@ -72,7 +72,14 @@ ...@@ -72,7 +72,14 @@
</widget> </widget>
</item> </item>
<item row="1" column="3"> <item row="1" column="3">
<widget class="QLineEdit" name="vbobjectsEdit"/> <widget class="QLineEdit" name="vbobjectsEdit">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item> </item>
<item row="1" column="4"> <item row="1" column="4">
<widget class="QPushButton" name="saveLogButton"> <widget class="QPushButton" name="saveLogButton">
...@@ -97,13 +104,6 @@ ...@@ -97,13 +104,6 @@
</column> </column>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QPushButton" name="updateButton">
<property name="text">
<string>&amp;Update</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
......
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