From 897144d1e6d04da5f454fee57f8947aeae1523ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20Stenac?= Date: Wed, 13 Sep 2006 12:45:46 +0000 Subject: [PATCH] Some cleanup here and there * Add a CONNECT macro for simple signal->slot connections * Untested save support in simple preferences --- modules/gui/qt4/components/infopanels.cpp | 9 ++- .../qt4/components/playlist/standardpanel.cpp | 23 +++--- modules/gui/qt4/components/preferences.cpp | 62 +++++---------- modules/gui/qt4/components/preferences.hpp | 11 +-- .../qt4/components/preferences_widgets.cpp | 26 +++++++ .../qt4/components/preferences_widgets.hpp | 13 +--- .../gui/qt4/components/simple_preferences.cpp | 77 ++++--------------- .../gui/qt4/components/simple_preferences.hpp | 14 ++-- modules/gui/qt4/dialogs/messages.cpp | 23 +++--- modules/gui/qt4/dialogs/messages.hpp | 6 +- modules/gui/qt4/dialogs/prefs_dialog.cpp | 47 +++++------ modules/gui/qt4/dialogs/prefs_dialog.hpp | 10 +-- modules/gui/qt4/dialogs_provider.cpp | 23 +++--- modules/gui/qt4/dialogs_provider.hpp | 7 +- modules/gui/qt4/input_manager.cpp | 13 ++-- modules/gui/qt4/menus.cpp | 12 +-- modules/gui/qt4/playlist_model.cpp | 7 +- modules/gui/qt4/playlist_model.hpp | 1 + modules/gui/qt4/qt4.cpp | 2 + modules/gui/qt4/qt4.hpp | 2 + 20 files changed, 163 insertions(+), 225 deletions(-) diff --git a/modules/gui/qt4/components/infopanels.cpp b/modules/gui/qt4/components/infopanels.cpp index 592bb8c642..01ae143880 100644 --- a/modules/gui/qt4/components/infopanels.cpp +++ b/modules/gui/qt4/components/infopanels.cpp @@ -45,9 +45,12 @@ void InputStatsPanel::Update( input_item_t *p_item ) { QString str; ui.widget->setText( str.sprintf( format, ## calc ) ); } UPDATE( read_text, "%8.0f kB", (float)(p_item->p_stats->i_read_bytes)/1000); - UPDATE( input_bitrate_text, "%6.0f kb/s", (float)(p_item->p_stats->f_input_bitrate * 8000 )); - UPDATE( demuxed_text, "%8.0f kB", (float)(p_item->p_stats->i_demux_read_bytes)/1000 ); - UPDATE( stream_bitrate_text, "%6.0f kb/s", (float)(p_item->p_stats->f_demux_bitrate * 8000 )); + UPDATE( input_bitrate_text, "%6.0f kb/s", + (float)(p_item->p_stats->f_input_bitrate * 8000 )); + UPDATE( demuxed_text, "%8.0f kB", + (float)(p_item->p_stats->i_demux_read_bytes)/1000 ); + UPDATE( stream_bitrate_text, "%6.0f kb/s", + (float)(p_item->p_stats->f_demux_bitrate * 8000 )); /* Video */ UPDATE( vdecoded_text, "%5i", p_item->p_stats->i_decoded_video ); diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp index 90a32d79ec..e78ce43ac6 100644 --- a/modules/gui/qt4/components/playlist/standardpanel.cpp +++ b/modules/gui/qt4/components/playlist/standardpanel.cpp @@ -21,21 +21,23 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +#include "qt4.hpp" #include "playlist_model.hpp" #include "components/playlist/panels.hpp" +#include "util/customwidgets.hpp" + #include #include #include #include #include #include -#include "qt4.hpp" -#include #include #include #include #include -#include "util/customwidgets.hpp" + +#include StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf, playlist_t *p_playlist, @@ -52,15 +54,12 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf, view->header()->setClickable( true ); view->setSelectionMode( QAbstractItemView::ExtendedSelection ); - connect( view, SIGNAL( activated( const QModelIndex& ) ), model, - SLOT( activateItem( const QModelIndex& ) ) ); - - connect( view, SIGNAL( rightClicked( QModelIndex , QPoint ) ), - this, SLOT( doPopup( QModelIndex, QPoint ) ) ); - - connect( model, - SIGNAL( dataChanged( const QModelIndex&, const QModelIndex& ) ), - this, SLOT( handleExpansion( const QModelIndex& ) ) ); + CONNECT( view, activated( const QModelIndex& ) , + model,activateItem( const QModelIndex& ) ); + CONNECT( view, rightClicked( QModelIndex , QPoint ), + this, doPopup( QModelIndex, QPoint ) ); + CONNECT( model, dataChanged( const QModelIndex&, const QModelIndex& ), + this, handleExpansion( const QModelIndex& ) ); QVBoxLayout *layout = new QVBoxLayout(); layout->setSpacing( 0 ); layout->setMargin( 0 ); diff --git a/modules/gui/qt4/components/preferences.cpp b/modules/gui/qt4/components/preferences.cpp index 162b86f46d..aeba7bb91e 100644 --- a/modules/gui/qt4/components/preferences.cpp +++ b/modules/gui/qt4/components/preferences.cpp @@ -20,20 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#include "components/preferences.hpp" -#include "components/preferences_widgets.hpp" -#include "qt4.hpp" -#include -#include -#include -#include "pixmaps/audio.xpm" -#include "pixmaps/video.xpm" -#include "pixmaps/type_net.xpm" -#include "pixmaps/type_playlist.xpm" -#include "pixmaps/advanced.xpm" -#include "pixmaps/codec.xpm" -#include "pixmaps/intf.xpm" #include #include #include @@ -47,10 +34,25 @@ #include #include #include - #include #include +#include "components/preferences.hpp" +#include "components/preferences_widgets.hpp" +#include "qt4.hpp" + +#include +#include +#include + +#include "pixmaps/audio.xpm" +#include "pixmaps/video.xpm" +#include "pixmaps/type_net.xpm" +#include "pixmaps/type_playlist.xpm" +#include "pixmaps/advanced.xpm" +#include "pixmaps/codec.xpm" +#include "pixmaps/intf.xpm" + #define ITEM_HEIGHT 25 /********************************************************************* @@ -69,9 +71,6 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : setAlternatingRowColors( true ); header()->hide(); - QFont myFont = QApplication::font(0); - myFont.setPointSize( myFont.pointSize() + 3 ); myFont.setBold( true ); - #define BI( a,b) QIcon a##_icon = QIcon( QPixmap( b##_xpm )) BI( audio, audio ); BI( video, video ); @@ -338,7 +337,7 @@ PrefsPanel::PrefsPanel( QWidget *_parent ) : QWidget( _parent ) {} PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, - PrefsItemData * data, bool currently_advanced ) : + PrefsItemData * data ) : QWidget( _parent ), p_intf( _p_intf ) { module_config_t *p_item; @@ -464,9 +463,8 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, control = ConfigControl::createControl( VLC_OBJECT( p_intf ), p_item, NULL, boxlayout, i_boxline ); if( !control ) - { continue; - } + if( box ) i_boxline++; else i_line++; controls.append( control ); @@ -495,34 +493,12 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, void PrefsPanel::apply() { - /* todo */ QList::Iterator i; for( i = controls.begin() ; i != controls.end() ; i++ ) { ConfigControl *c = qobject_cast(*i); - switch( c->getType() ) - { - case 1: - { - VIntConfigControl *vicc = qobject_cast(*i); - config_PutInt( p_intf, vicc->getName(), vicc->getValue() ); - break; - } - case 2: - { - VFloatConfigControl *vfcc = qobject_cast(*i); - config_PutFloat( p_intf, vfcc->getName(), vfcc->getValue() ); - break; - } - case 3: - { - VStringConfigControl *vscc = - qobject_cast(*i); - config_PutPsz( p_intf, vscc->getName(), qta( vscc->getValue() ) ); - } - } + c->doApply( p_intf ); } } - void PrefsPanel::clean() {} diff --git a/modules/gui/qt4/components/preferences.hpp b/modules/gui/qt4/components/preferences.hpp index 85687b0aaf..217a8052c4 100644 --- a/modules/gui/qt4/components/preferences.hpp +++ b/modules/gui/qt4/components/preferences.hpp @@ -78,7 +78,7 @@ class PrefsPanel : public QWidget { Q_OBJECT public: - PrefsPanel( intf_thread_t *, QWidget *, PrefsItemData *, bool ); + PrefsPanel( intf_thread_t *, QWidget *, PrefsItemData * ); PrefsPanel( QWidget *); virtual ~PrefsPanel() {}; void apply(); @@ -87,15 +87,6 @@ private: intf_thread_t *p_intf; QList controls; QVBoxLayout *global_layout; -#if 0 - QLabel *some_hidden_text; - bool advanced; -#endif -public slots: -#if 0 - void setAdvanced( bool, bool ); - void setAdvanced( bool a ) { return setAdvanced( a, false ); } -#endif }; #endif diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index 836582817c..ca5a100236 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -105,6 +105,32 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this, return p_control; } +void ConfigControl::doApply( intf_thread_t *p_intf ) +{ + switch( getType() ) + { + case 1: + { + VIntConfigControl *vicc = qobject_cast(this); + config_PutInt( p_intf, vicc->getName(), vicc->getValue() ); + break; + } + case 2: + { + VFloatConfigControl *vfcc = + qobject_cast(this); + config_PutFloat( p_intf, vfcc->getName(), vfcc->getValue() ); + break; + } + case 3: + { + VStringConfigControl *vscc = + qobject_cast(this); + config_PutPsz( p_intf, vscc->getName(), qta( vscc->getValue() ) ); + } + } +} + /************************************************************************** * String-based controls *************************************************************************/ diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp index f21f79d6be..12f2d66d59 100644 --- a/modules/gui/qt4/components/preferences_widgets.hpp +++ b/modules/gui/qt4/components/preferences_widgets.hpp @@ -62,6 +62,7 @@ public: static ConfigControl * createControl( vlc_object_t*, module_config_t*,QWidget*, QGridLayout *, int); + void doApply( intf_thread_t *); protected: vlc_object_t *p_this; module_config_t *p_item; @@ -196,18 +197,6 @@ public: private: void finish(); }; -#if 0 -class FloatConfigControl : public VFloatConfigControl -{ -public: - FloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) : - ConfigControl(a,b,c) {}; - virtual ~FloatConfigControl() {}; - virtual float getValue(); -private: - QDoubleSpinBox *spin; -}; -#endif /******************************************************* * String-based controls diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp index 13a270d6a0..e0b6c40392 100644 --- a/modules/gui/qt4/components/simple_preferences.cpp +++ b/modules/gui/qt4/components/simple_preferences.cpp @@ -22,15 +22,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +#include +#include +#include +#include + #include "components/simple_preferences.hpp" #include "components/preferences_widgets.hpp" #include "qt4.hpp" + #include #include -#include -#include -#include -#include #include "pixmaps/advanced_50x50.xpm" #include "pixmaps/audio_50x50.xpm" @@ -58,50 +60,23 @@ SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) : setIconSize( QSize( ITEM_HEIGHT,ITEM_HEIGHT ) ); setAlternatingRowColors( true ); -#ifndef WIN32 - // Fixme - A bit UGLY - QFont f = font(); - int pSize = f.pointSize(); - if( pSize > 0 ) - f.setPointSize( pSize + 1 ); - else - f.setPixelSize( f.pixelSize() + 1 ); - setFont( f ); -#endif - #define ADD_CATEGORY( id, label, icon ) \ addItem( label ); \ item( id )->setIcon( QIcon( QPixmap( icon ) ) ); \ item( id )->setData( Qt::UserRole, qVariantFromValue( (int)id ) ); - ADD_CATEGORY( SPrefsVideo, "Video", video_50x50_xpm ); - ADD_CATEGORY( SPrefsAudio, "Audio", audio_50x50_xpm ); - ADD_CATEGORY( SPrefsInputAndCodecs, "Input and Codecs", + ADD_CATEGORY( SPrefsVideo, qtr("Video"), video_50x50_xpm ); + ADD_CATEGORY( SPrefsAudio, qtr("Audio"), audio_50x50_xpm ); + ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input and Codecs"), input_and_codecs_50x50_xpm ); - ADD_CATEGORY( SPrefsPlaylist, "Playlist", playlist_50x50_xpm ); - ADD_CATEGORY( SPrefsInterface, "Interface", interface_50x50_xpm ); - ADD_CATEGORY( SPrefsSubtitles, "Subtitles", subtitles_50x50_xpm ); - ADD_CATEGORY( SPrefsAdvanced, "Advanced", advanced_50x50_xpm ); + ADD_CATEGORY( SPrefsPlaylist, qtr("Playlist"), playlist_50x50_xpm ); + ADD_CATEGORY( SPrefsInterface, qtr("Interface"), interface_50x50_xpm ); + ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles"), subtitles_50x50_xpm ); + ADD_CATEGORY( SPrefsAdvanced, qtr("Advanced"), advanced_50x50_xpm ); setCurrentRow( SPrefsInterface ); } -void SPrefsCatList::applyAll() -{ - doAll( false ); -} - -void SPrefsCatList::cleanAll() -{ - doAll( true ); -} - -/// \todo When cleaning, we should remove the panel ? -void SPrefsCatList::doAll( bool doclean ) -{ - /* Todo */ -} - /********************************************************************* * The Panels *********************************************************************/ @@ -187,33 +162,15 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, } } -void SPrefsPanel::Apply() +void SPrefsPanel::apply() { - /* todo: factorize with PrefsPanel */ QList::Iterator i; for( i = controls.begin() ; i != controls.end() ; i++ ) { - VIntConfigControl *vicc = qobject_cast(*i); - if( !vicc ) - { - VFloatConfigControl *vfcc = qobject_cast(*i); - if( !vfcc) - { - VStringConfigControl *vscc = - qobject_cast(*i); - assert( vscc ); - config_PutPsz( p_intf, vscc->getName(), - vscc->getValue().toAscii().data() ); - continue; - } - config_PutFloat( p_intf, vfcc->getName(), - vfcc->getValue() ); - continue; - } - config_PutInt( p_intf, vicc->getName(), - vicc->getValue() ); + ConfigControl *c = qobject_cast(*i); + c->doApply( p_intf ); } } -void SPrefsPanel::Clean() +void SPrefsPanel::clean() {} diff --git a/modules/gui/qt4/components/simple_preferences.hpp b/modules/gui/qt4/components/simple_preferences.hpp index 0c43f13b4c..a5b39a7914 100644 --- a/modules/gui/qt4/components/simple_preferences.hpp +++ b/modules/gui/qt4/components/simple_preferences.hpp @@ -29,13 +29,14 @@ #include enum { - SPrefsVideo, + SPrefsVideo = 0, SPrefsAudio, SPrefsInputAndCodecs, SPrefsPlaylist, SPrefsInterface, SPrefsSubtitles, - SPrefsAdvanced + SPrefsAdvanced, + SPrefsMax }; #define SPrefsDefaultCat SPrefsInterface @@ -47,12 +48,7 @@ class SPrefsCatList : public QListWidget public: SPrefsCatList( intf_thread_t *, QWidget *); virtual ~SPrefsCatList() {}; - - void applyAll(); - void cleanAll(); - private: - void doAll( bool ); intf_thread_t *p_intf; }; @@ -62,8 +58,8 @@ class SPrefsPanel : public QWidget public: SPrefsPanel( intf_thread_t *, QWidget *, int ); virtual ~SPrefsPanel() {}; - void Apply(); - void Clean(); + void apply(); + void clean(); private: intf_thread_t *p_intf; QList controls; diff --git a/modules/gui/qt4/dialogs/messages.cpp b/modules/gui/qt4/dialogs/messages.cpp index 1ae22b0b16..58925e4744 100644 --- a/modules/gui/qt4/dialogs/messages.cpp +++ b/modules/gui/qt4/dialogs/messages.cpp @@ -64,14 +64,10 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf) : QVLCFrame( _p_intf ) layout->addWidget(clearButton, 1, 4 ); layout->addWidget(closeButton, 1, 5 ); - connect( closeButton, SIGNAL( clicked() ) , - this, SLOT( onCloseButton())); - connect( clearButton, SIGNAL( clicked() ) , - this, SLOT( onClearButton())); - connect( saveLogButton, SIGNAL( clicked() ) , - this, SLOT( onSaveButton())); - connect( DialogsProvider::getInstance(NULL)->fixed_timer, - SIGNAL( timeout() ), this, SLOT(updateLog() ) ); + CONNECT( closeButton, clicked(), this, close() ); + CONNECT( clearButton, clicked(), this, clear() ); + CONNECT( saveLogButton, clicked(), this, save() ); + CONNECT( THEDP->fixed_timer, timeout(), this, updateLog() ); } MessagesDialog::~MessagesDialog() @@ -153,25 +149,24 @@ void MessagesDialog::updateLog() } } -void MessagesDialog::onCloseButton() +void MessagesDialog::close() { this->toggleVisible(); } -void MessagesDialog::onClearButton() +void MessagesDialog::clear() { messages->clear(); } -bool MessagesDialog::onSaveButton() +bool MessagesDialog::save() { QString saveLogFileName = QFileDialog::getSaveFileName( - this, - "Choose a filename to save the logs under...", + this, qtr("Choose a filename to save the logs under..."), p_intf->p_vlc->psz_homedir, "Texts / Logs (*.log *.txt);; All (*.*) "); - if (saveLogFileName != NULL) + if( saveLogFileName != NULL ) { QFile file(saveLogFileName); if (!file.open(QFile::WriteOnly | QFile::Text)) { diff --git a/modules/gui/qt4/dialogs/messages.hpp b/modules/gui/qt4/dialogs/messages.hpp index 5425324bc6..b07c8045bd 100644 --- a/modules/gui/qt4/dialogs/messages.hpp +++ b/modules/gui/qt4/dialogs/messages.hpp @@ -50,9 +50,9 @@ private: QTextEdit *messages; public slots: void updateLog(); - void onCloseButton(); - void onClearButton(); - bool onSaveButton(); + void close(); + void clear(); + bool save(); }; #endif diff --git a/modules/gui/qt4/dialogs/prefs_dialog.cpp b/modules/gui/qt4/dialogs/prefs_dialog.cpp index 4c1c99d403..67ed860724 100644 --- a/modules/gui/qt4/dialogs/prefs_dialog.cpp +++ b/modules/gui/qt4/dialogs/prefs_dialog.cpp @@ -34,6 +34,7 @@ #include #include #include + PrefsDialog *PrefsDialog::instance = NULL; PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) @@ -74,18 +75,19 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) setSmall(); QPushButton *save, *cancel; - QHBoxLayout *buttonsLayout = - QVLCFrame::doButtons( this, NULL, &save, _("Save"), - &cancel, _("Cancel"), - NULL, NULL ); - connect( save, SIGNAL( clicked() ), this, SLOT( save() ) ); - connect( cancel, SIGNAL( clicked() ), this, SLOT( cancel() ) ); + QHBoxLayout *buttonsLayout = QVLCFrame::doButtons( this, NULL, + &save, _("Save"), + &cancel, _("Cancel"), + NULL, NULL ); main_layout->addLayout( buttonsLayout, 2,0, 1 ,3 ); - setLayout( main_layout ); - connect( small, SIGNAL( clicked() ), this, SLOT( setSmall()) ); - connect( all, SIGNAL( clicked() ), this, SLOT( setAll()) ); + CONNECT( save, clicked(), this, save() ); + CONNECT( cancel, clicked(), this, cancel() ); + CONNECT( small, clicked(), this, setSmall() ); + CONNECT( all, clicked(), this, setAll() ); + + for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL; } void PrefsDialog::setAll() @@ -127,9 +129,9 @@ void PrefsDialog::setSmall() if( !simple_tree ) { simple_tree = new SPrefsCatList( p_intf, tree_panel ); - connect( simple_tree, - SIGNAL( currentItemChanged( QListWidgetItem *, QListWidgetItem *) ), - this, SLOT( changeSimplePanel( QListWidgetItem * ) ) ); + CONNECT( simple_tree, + currentItemChanged( QListWidgetItem *, QListWidgetItem *), + this, changeSimplePanel( QListWidgetItem * ) ); } tree_panel_l->addWidget( simple_tree ); simple_tree->show(); @@ -145,10 +147,6 @@ void PrefsDialog::setSmall() simple_panel->show(); } -PrefsDialog::~PrefsDialog() -{ -} - void PrefsDialog::changeSimplePanel( QListWidgetItem *item ) { int number = item->data( Qt::UserRole ).toInt(); @@ -156,10 +154,10 @@ void PrefsDialog::changeSimplePanel( QListWidgetItem *item ) { main_panel_l->removeWidget( simple_panel ); simple_panel->hide(); - /* Don't do this once it works, you would loose all changes */ - delete simple_panel; } - simple_panel = new SPrefsPanel( p_intf, main_panel, number ); + if( !simple_panels[number] ) + simple_panel = new SPrefsPanel( p_intf, main_panel, number ); + simple_panels[number] = simple_panel; main_panel_l->addWidget( simple_panel ); simple_panel->show(); } @@ -174,7 +172,7 @@ void PrefsDialog::changePanel( QTreeWidgetItem *item ) advanced_panel->hide(); } if( !data->panel ) - data->panel = new PrefsPanel( p_intf, main_panel , data, true ); + data->panel = new PrefsPanel( p_intf, main_panel , data ); advanced_panel = data->panel; main_panel_l->addWidget( advanced_panel ); @@ -184,7 +182,10 @@ void PrefsDialog::changePanel( QTreeWidgetItem *item ) void PrefsDialog::save() { if( small->isChecked() && simple_tree ) - simple_tree->applyAll(); + { + for( int i = 0 ; i< SPrefsMax; i++ ) + if( simple_panels[i] ) simple_panels[i]->apply(); + } else if( all->isChecked() && advanced_tree ) advanced_tree->applyAll(); config_SaveConfigFile( p_intf, NULL ); @@ -195,8 +196,8 @@ void PrefsDialog::cancel() { if( small->isChecked() && simple_tree ) { - simple_tree->cleanAll(); - simple_panel = NULL; + for( int i = 0 ; i< SPrefsMax; i++ ) + if( simple_panels[i] ) simple_panels[i]->clean(); } else if( all->isChecked() && advanced_tree ) { diff --git a/modules/gui/qt4/dialogs/prefs_dialog.hpp b/modules/gui/qt4/dialogs/prefs_dialog.hpp index 8a11c362de..06ab224c8b 100644 --- a/modules/gui/qt4/dialogs/prefs_dialog.hpp +++ b/modules/gui/qt4/dialogs/prefs_dialog.hpp @@ -25,6 +25,7 @@ #define _PREFS_DIALOG_H_ #include "util/qvlcframe.hpp" +#include "components/simple_preferences.hpp" class PrefsTree; class SPrefsCatList; @@ -51,7 +52,7 @@ public: instance = new PrefsDialog( _p_intf ); return instance; } - virtual ~PrefsDialog(); + virtual ~PrefsDialog() {}; private: PrefsDialog( intf_thread_t * ); @@ -59,6 +60,7 @@ private: QHBoxLayout *main_panel_l; PrefsPanel *advanced_panel; SPrefsPanel *simple_panel; + SPrefsPanel *simple_panels[SPrefsMax]; QWidget *tree_panel; QHBoxLayout *tree_panel_l; @@ -67,9 +69,6 @@ private: QGroupBox *types; QRadioButton *small,*all; -#if 0 - QCheckBox *adv_chk; -#endif QGridLayout *main_layout; @@ -81,9 +80,6 @@ private slots: void setSmall(); void save(); void cancel(); -#if 0 - void setAdvanced( bool ); -#endif }; #endif diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp index 49546eeb17..7cd53e1b66 100644 --- a/modules/gui/qt4/dialogs_provider.cpp +++ b/modules/gui/qt4/dialogs_provider.cpp @@ -19,18 +19,22 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#include "qt4.hpp" + #include +#include +#include +#include + +#include "qt4.hpp" #include "dialogs_provider.hpp" +#include "menus.hpp" +#include + +/* The dialogs */ #include "dialogs/playlist.hpp" #include "dialogs/prefs_dialog.hpp" #include "dialogs/streaminfo.hpp" #include "dialogs/messages.hpp" -#include -#include -#include "menus.hpp" -#include -#include DialogsProvider* DialogsProvider::instance = NULL; @@ -41,12 +45,11 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) : fixed_timer->start( 150 /* milliseconds */ ); menusMapper = new QSignalMapper(); - connect( menusMapper, SIGNAL( mapped(QObject *) ), this, - SLOT(menuAction( QObject *)) ); + CONNECT( menusMapper, mapped(QObject *), this, menuAction( QObject *) ); menusUpdateMapper = new QSignalMapper(); - connect( menusUpdateMapper, SIGNAL( mapped(QObject *) ), this, - SLOT(menuUpdateAction( QObject *)) ); + CONNECT( menusUpdateMapper, mapped(QObject *), + this, menuUpdateAction( QObject *) ); } void DialogsProvider::customEvent( QEvent *event ) diff --git a/modules/gui/qt4/dialogs_provider.hpp b/modules/gui/qt4/dialogs_provider.hpp index 73b7e77527..4ef23629bc 100644 --- a/modules/gui/qt4/dialogs_provider.hpp +++ b/modules/gui/qt4/dialogs_provider.hpp @@ -26,10 +26,12 @@ #include #include #include -#include -#include + #include "dialogs/interaction.hpp" + #include +#include +#include class QEvent; class QSignalMapper; @@ -87,5 +89,4 @@ public slots: void quit(); }; - #endif diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp index 195a10f3d7..32e4186850 100644 --- a/modules/gui/qt4/input_manager.cpp +++ b/modules/gui/qt4/input_manager.cpp @@ -23,9 +23,9 @@ #include +#include "qt4.hpp" #include "input_manager.hpp" #include "dialogs_provider.hpp" -#include "qt4.hpp" static int ChangeVideo( vlc_object_t *p_this, const char *var, vlc_value_t o, vlc_value_t n, void *param ); @@ -41,8 +41,7 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) : { i_old_playing_status = END_S; p_input = NULL; - /* Subscribe to updates */ - connect( THEDP->fixed_timer, SIGNAL( timeout() ), this, SLOT( update() ) ); + CONNECT( THEDP->fixed_timer, timeout(), this, update() ); } InputManager::~InputManager() @@ -174,11 +173,10 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) : QObject(NULL), p_input = NULL; im = new InputManager( this, p_intf ); /* Get timer updates */ - connect( DialogsProvider::getInstance(p_intf)->fixed_timer, - SIGNAL(timeout() ), this, SLOT( updateInput() ) ); + CONNECT( THEDP->fixed_timer, timeout(), this, updateInput() ); /* Warn our embedded IM about input changes */ - connect( this, SIGNAL( inputChanged( input_thread_t * ) ), - im, SLOT( setInput( input_thread_t * ) ) ); + CONNECT( this, inputChanged( input_thread_t * ), + im, setInput( input_thread_t * ) ); } MainInputManager::~MainInputManager() @@ -232,6 +230,7 @@ static int ChangeAudio( vlc_object_t *p_this, const char *var, vlc_value_t o, InputManager *im = (InputManager*)param; im->b_has_audio = true; } + static int ChangeVideo( vlc_object_t *p_this, const char *var, vlc_value_t o, vlc_value_t n, void *param ) { diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp index 163696bb08..f055d9b485 100644 --- a/modules/gui/qt4/menus.cpp +++ b/modules/gui/qt4/menus.cpp @@ -21,15 +21,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#include "menus.hpp" -#include "dialogs_provider.hpp" -#include "input_manager.hpp" #include #include #include #include #include +#include "menus.hpp" +#include "dialogs_provider.hpp" +#include "input_manager.hpp" + enum { ITEM_NORMAL, @@ -167,8 +168,7 @@ QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current ) objects.push_back( p_intf->i_object_id ); QMenu *menu = Populate( p_intf, current, varnames, objects ); - connect( menu, SIGNAL( aboutToShow() ), - THEDP->menusUpdateMapper, SLOT(map()) ); + CONNECT( menu, aboutToShow(), THEDP->menusUpdateMapper, map() ); THEDP->menusUpdateMapper->setMapping( menu, 4 ); return menu; @@ -695,7 +695,7 @@ void QVLCMenu::CreateAndConnect( QMenu *menu, const char *psz_var, } MenuItemData *itemData = new MenuItemData( i_object_id, i_val_type, val, psz_var ); - connect( action, SIGNAL(triggered()), THEDP->menusMapper, SLOT(map()) ); + CONNECT( action, triggered(), THEDP->menusMapper, map() ); THEDP->menusMapper->setMapping( action, itemData ); menu->addAction( action ); } diff --git a/modules/gui/qt4/playlist_model.cpp b/modules/gui/qt4/playlist_model.cpp index 58d84412aa..3223b17f2c 100644 --- a/modules/gui/qt4/playlist_model.cpp +++ b/modules/gui/qt4/playlist_model.cpp @@ -21,13 +21,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +#include #include #include -#include "qt4.hpp" +#include #include + +#include "qt4.hpp" #include "playlist_model.hpp" -#include -#include #include #include "pixmaps/type_unknown.xpm" diff --git a/modules/gui/qt4/playlist_model.hpp b/modules/gui/qt4/playlist_model.hpp index 849e0facff..bb7b0bf45a 100644 --- a/modules/gui/qt4/playlist_model.hpp +++ b/modules/gui/qt4/playlist_model.hpp @@ -27,6 +27,7 @@ #include #include #include + #include #include #include diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp index df73c81dfa..824283b4af 100644 --- a/modules/gui/qt4/qt4.cpp +++ b/modules/gui/qt4/qt4.cpp @@ -21,10 +21,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #include + #include "qt4.hpp" #include "dialogs_provider.hpp" #include "input_manager.hpp" #include "main_interface.hpp" + #include "../../../share/vlc32x32.xpm" /***************************************************************************** diff --git a/modules/gui/qt4/qt4.hpp b/modules/gui/qt4/qt4.hpp index af8234388a..cf84e50c15 100644 --- a/modules/gui/qt4/qt4.hpp +++ b/modules/gui/qt4/qt4.hpp @@ -55,6 +55,8 @@ struct intf_sys_t #define qtu( i ) i.toUtf8().data() #define qta( i ) i.toAscii().data() +#define CONNECT( a, b, c, d ) connect( a, SIGNAL( b ), c, SLOT(d) ) + static int DialogEvent_Type = QEvent::User + 1; class DialogEvent : public QEvent -- 2.39.2