X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fcomponents%2Fsimple_preferences.cpp;h=0d781096628de22ee50b4b61beb463de6387155e;hb=39e4fad1bc929bb35a5353380b456e36f23ea1c4;hp=2ae81a03b061c84e67e6aa898caa7906f58dd524;hpb=2f353e1801c97f7045e744ac2b0b501ed48ed34b;p=vlc diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp index 2ae81a03b0..0d78109662 100644 --- a/modules/gui/qt4/components/simple_preferences.cpp +++ b/modules/gui/qt4/components/simple_preferences.cpp @@ -44,9 +44,10 @@ #include #include #include +#include #include -#define ICON_HEIGHT 64 +#define ICON_HEIGHT 48 #ifdef _WIN32 # include @@ -207,7 +208,7 @@ static int getDefaultAudioVolume(vlc_object_t *obj, const char *aout) return -1; else #ifdef __APPLE__ - if (!strcmp("auhal") && module_exists("auhal")) + if (!strcmp(aout, "auhal") && module_exists("auhal")) return (config_GetFloat(obj, "auhal-volume") * 100.f + .5f) / AOUT_VOLUME_DEFAULT; else @@ -239,10 +240,10 @@ static int getDefaultAudioVolume(vlc_object_t *obj, const char *aout) /********************************************************************* * The List of categories *********************************************************************/ -SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent, bool small ) : +SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) : QWidget( _parent ), p_intf( _p_intf ) { - QVBoxLayout *layout = new QVBoxLayout(); + QHBoxLayout *layout = new QHBoxLayout(); /* Use autoExclusive buttons and a mapper as QButtonGroup can't set focus (keys) when it manages the buttons's exclusivity. @@ -250,7 +251,7 @@ SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent, bool sma QSignalMapper *mapper = new QSignalMapper( layout ); CONNECT( mapper, mapped(int), this, switchPanel(int) ); - short icon_height = small ? ICON_HEIGHT /2 : ICON_HEIGHT; + short icon_height = ICON_HEIGHT; #define ADD_CATEGORY( button, label, ltooltip, icon, numb ) \ QToolButton * button = new QToolButton( this ); \ @@ -258,9 +259,8 @@ SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent, bool sma button->setText( label ); \ button->setToolTip( ltooltip ); \ button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); \ - button->setIconSize( QSize( icon_height, icon_height ) ); \ - button->resize( icon_height + 6 , icon_height + 6 ); \ - button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding) ; \ + button->setIconSize( QSize( icon_height + 40 , icon_height ) ); \ + button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); \ button->setAutoRaise( true ); \ button->setCheckable( true ); \ button->setAutoExclusive( true ); \ @@ -287,10 +287,9 @@ SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent, bool sma layout->setMargin( 0 ); layout->setSpacing( 1 ); - setMinimumWidth( 140 ); - setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); + setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Preferred); + setMinimumWidth( ICON_HEIGHT * 6 + 10 ); setLayout( layout ); - } void SPrefsCatList::switchPanel( int i ) @@ -302,12 +301,13 @@ void SPrefsCatList::switchPanel( int i ) * The Panels *********************************************************************/ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, - int _number, bool small ) : QWidget( _parent ), p_intf( _p_intf ) + int _number ) : QWidget( _parent ), p_intf( _p_intf ) { module_config_t *p_config; ConfigControl *control; number = _number; lang = NULL; + radioGroup = NULL; #define CONFIG_GENERIC( option, type, label, qcontrol ) \ p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \ @@ -467,10 +467,13 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, #define audioControl2( name) \ audioCommon( name ) \ + QHBoxLayout * name ## hboxLayout = new QHBoxLayout; \ QLineEdit * name ## Device = new QLineEdit; \ name ## Label->setBuddy( name ## Device ); \ + name ## hboxLayout->addWidget( name ## Device ); \ QPushButton * name ## Browse = new QPushButton( qtr( "Browse..." ) ); \ - outputAudioLayout->addWidget( name ## Device, outputAudioLayout->rowCount() - 1, 0, 1, -1, Qt::AlignLeft ); + name ## hboxLayout->addWidget( name ## Browse ); \ + outputAudioLayout->addLayout( name ## hboxLayout, outputAudioLayout->rowCount() - 1, 1, 1, 1, Qt::AlignLeft ); /* Build if necessary */ QGridLayout * outputAudioLayout = qobject_cast(ui.outputAudioBox->layout()); @@ -508,7 +511,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, optionWidgets["ossL"] = OSSLabel; optionWidgets["ossW"] = OSSDevice; optionWidgets["ossB"] = OSSBrowse; - CONFIG_GENERIC_FILE( "oss-audio-device" , File, NULL, OSSDevice, + CONFIG_GENERIC_FILE( "oss-audio-device" , File, OSSLabel, OSSDevice, OSSBrowse ); } #endif @@ -810,8 +813,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, CONFIG_GENERIC_FILE( "skins2-last", File, ui.skinFileLabel, ui.fileSkin, ui.skinBrowse ); - CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel, - artFetcher ); + CONFIG_BOOL( "metadata-network-access", MetadataNetworkAccessMode ); /* UPDATE options */ #ifdef UPDATE_CHECK @@ -909,7 +911,15 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, line++; - p_config = config_FindConfig( VLC_OBJECT(p_intf), "hotkeys-mousewheel-mode" ); + p_config = config_FindConfig( VLC_OBJECT(p_intf), "hotkeys-y-wheel-mode" ); + control = new IntegerListConfigControl( VLC_OBJECT(p_intf), + p_config, this, false ); + control->insertIntoExistingGrid( gLayout, line ); + controls.append( control ); + + line++; + + p_config = config_FindConfig( VLC_OBJECT(p_intf), "hotkeys-x-wheel-mode" ); control = new IntegerListConfigControl( VLC_OBJECT(p_intf), p_config, this, false ); control->insertIntoExistingGrid( gLayout, line ); @@ -931,19 +941,11 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, panel_layout->addWidget( panel_label ); panel_layout->addWidget( title_line ); - if( small ) - { - QScrollArea *scroller= new QScrollArea; - scroller->setWidget( panel ); - scroller->setWidgetResizable( true ); - scroller->setFrameStyle( QFrame::NoFrame ); - panel_layout->addWidget( scroller ); - } - else - { - panel_layout->addWidget( panel ); - if( number != SPrefsHotkeys ) panel_layout->addStretch( 2 ); - } + QScrollArea *scroller= new QScrollArea; + scroller->setWidget( panel ); + scroller->setWidgetResizable( true ); + scroller->setFrameStyle( QFrame::NoFrame ); + panel_layout->addWidget( scroller ); setLayout( panel_layout ); @@ -1097,9 +1099,7 @@ void SPrefsPanel::apply() qobject_cast(optionWidgets["defaultVolume"])->value(); bool b_reset_volume = qobject_cast(optionWidgets["resetVolumeCheckbox"])->isChecked(); - module_config_t *p_config = config_FindConfig( VLC_OBJECT(p_intf), "aout" ); - char *psz_aout = p_config->value.psz; - + char *psz_aout = config_GetPsz( p_intf, "aout" ); float f_gain = powf( i_volume / 100.f, 3 ); @@ -1128,6 +1128,7 @@ void SPrefsPanel::apply() config_PutFloat( p_intf, "jack-gain", f_gain ); #endif #undef save_vol_aout + free( psz_aout ); config_PutInt( p_intf, "volume-save", !b_reset_volume ); @@ -1239,37 +1240,42 @@ bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current, return b_temp; } -void SPrefsPanel::assoDialog() -{ #if !defined(__IApplicationAssociationRegistrationUI_INTERFACE_DEFINED__) #define __IApplicationAssociationRegistrationUI_INTERFACE_DEFINED__ const GUID IID_IApplicationAssociationRegistrationUI = {0x1f76a169,0xf994,0x40ac, {0x8f,0xc8,0x09,0x59,0xe8,0x87,0x47,0x10}}; const GUID CLSID_ApplicationAssociationRegistrationUI = { 0x1968106d,0xf3b5,0x44cf,{0x89,0x0e,0x11,0x6f,0xcb,0x9e,0xce,0xf1}}; -#ifdef __cplusplus interface IApplicationAssociationRegistrationUI : public IUnknown { virtual HRESULT STDMETHODCALLTYPE LaunchAdvancedAssociationUI( LPCWSTR pszAppRegName) = 0; }; -#endif /* __cplusplus */ #endif /* __IApplicationAssociationRegistrationUI_INTERFACE_DEFINED__ */ - IApplicationAssociationRegistrationUI *p_appassoc; - CoInitializeEx( NULL, COINIT_MULTITHREADED ); +void SPrefsPanel::assoDialog() +{ + HRESULT hr; - if( S_OK == CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI, - NULL, CLSCTX_INPROC_SERVER, - IID_IApplicationAssociationRegistrationUI, - (void **)&p_appassoc) ) + hr = CoInitializeEx( NULL, COINIT_MULTITHREADED ); + if( SUCCEEDED(hr) ) { - if(S_OK == p_appassoc->LaunchAdvancedAssociationUI(L"VLC" ) ) + void *p; + + hr = CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI, + NULL, CLSCTX_INPROC_SERVER, + IID_IApplicationAssociationRegistrationUI, &p); + if( SUCCEEDED(hr) ) { - CoUninitialize(); - return; + IApplicationAssociationRegistrationUI *p_regui = + (IApplicationAssociationRegistrationUI *)p; + + hr = p_regui->LaunchAdvancedAssociationUI(L"VLC" ); + p_regui->Release(); } + CoUninitialize(); } - CoUninitialize(); + if( SUCCEEDED(hr) ) + return; QDialog *d = new QDialog( this ); d->setWindowTitle( qtr( "File associations" ) );