📄 simple_preferences.cpp
字号:
this, updateAudioOptions( int ) ); /* File output exists on all platforms */ CONFIG_GENERIC_FILE( "audiofile-file" , File , ui.fileLabel, ui.fileName, ui.fileBrowseButton ); optionWidgets.append( ui.fileControl ); optionWidgets.append( ui.outputModule ); optionWidgets.append( ui.volNormBox ); /*Little mofification of ui.volumeValue to compile with Qt < 4.3 */#if HAS_QT43 ui.volumeValue->setButtonSymbols(QAbstractSpinBox::NoButtons);#endif optionWidgets.append( ui.volumeValue ); updateAudioOptions( ui.outputModule->currentIndex() ); /* LastFM */ if( module_Exists( p_intf, "audioscrobbler" ) ) { CONFIG_GENERIC( "lastfm-username", String, ui.lastfm_user_label, lastfm_user_edit ); CONFIG_GENERIC( "lastfm-password", String, ui.lastfm_pass_label, lastfm_pass_edit ); if( config_ExistIntf( VLC_OBJECT( p_intf ), "audioscrobbler" ) ) ui.lastfm->setChecked( true ); else ui.lastfm->setChecked( false ); CONNECT( ui.lastfm, stateChanged( int ), this , lastfm_Changed( int ) ); } else ui.lastfm->hide(); /* Normalizer */ CONNECT( ui.volNormBox, toggled( bool ), ui.volNormSpin, setEnabled( bool ) ); char* psz = config_GetPsz( p_intf, "audio-filter" ); qs_filter = qfu( psz ); free( psz ); bool b_normalizer = ( qs_filter.contains( "volnorm" ) ); { ui.volNormBox->setChecked( b_normalizer ); ui.volNormSpin->setEnabled( b_normalizer ); } /* Volume Label */ updateAudioVolume( ui.defaultVolume->value() ); // First time init END_SPREFS_CAT; /* Input and Codecs Panel Implementation */ START_SPREFS_CAT( InputAndCodecs, qtr("Input & Codecs Settings") ); /* Disk Devices */ { ui.DVDDevice->setToolTip( qtr( "If this property is blank, different values\n" "for DVD, VCD, and CDDA are set.\n" "You can define a unique one or configure them \n" "individually in the advanced preferences." ) ); char *psz_dvddiscpath = config_GetPsz( p_intf, "dvd" ); char *psz_vcddiscpath = config_GetPsz( p_intf, "vcd" ); char *psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" ); if( psz_dvddiscpath && psz_vcddiscpath && psz_cddadiscpath ) if( !strcmp( psz_cddadiscpath, psz_dvddiscpath ) && !strcmp( psz_dvddiscpath, psz_vcddiscpath ) ) { ui.DVDDevice->setText( qfu( psz_dvddiscpath ) ); } free( psz_cddadiscpath ); free( psz_dvddiscpath ); free( psz_vcddiscpath ); } CONFIG_GENERIC_NO_BOOL( "server-port", Integer, NULL, UDPPort ); CONFIG_GENERIC( "http-proxy", String , NULL, proxy ); CONFIG_GENERIC_NO_BOOL( "ffmpeg-pp-q", Integer, NULL, PostProcLevel ); CONFIG_GENERIC( "avi-index", IntegerList, NULL, AviRepair ); CONFIG_GENERIC( "rtsp-tcp", Bool, NULL, RTSP_TCPBox );#ifdef WIN32 CONFIG_GENERIC( "prefer-system-codecs", Bool, NULL, systemCodecBox );#else ui.systemCodecBox->hide();#endif /* Access Filters */ char* psz = config_GetPsz( p_intf, "access-filter" ); qs_filter = qfu( psz ); free( psz ); ui.timeshiftBox->setChecked( qs_filter.contains( "timeshift" ) ); ui.dumpBox->setChecked( qs_filter.contains( "dump" ) ); ui.recordBox->setChecked( qs_filter.contains( "record" ) ); ui.bandwidthBox->setChecked( qs_filter.contains( "bandwidth" ) ); optionWidgets.append( ui.recordBox ); optionWidgets.append( ui.dumpBox ); optionWidgets.append( ui.bandwidthBox ); optionWidgets.append( ui.timeshiftBox ); optionWidgets.append( ui.DVDDevice ); optionWidgets.append( ui.cachingCombo ); /* Caching */ /* Add the things to the ComboBox */ #define addToCachingBox( str, cachingNumber ) \ ui.cachingCombo->addItem( str, QVariant( cachingNumber ) ); addToCachingBox( "Custom", CachingCustom ); addToCachingBox( "Lowest latency", CachingLowest ); addToCachingBox( "Low latency", CachingLow ); addToCachingBox( "Normal", CachingNormal ); addToCachingBox( "High latency", CachingHigh ); addToCachingBox( "Higher latency", CachingHigher );#define TestCaC( name ) \ b_cache_equal = b_cache_equal && \ ( i_cache == config_GetInt( p_intf, name ) )#define TestCaCi( name, int ) \ b_cache_equal = b_cache_equal && \ ( ( i_cache * int ) == config_GetInt( p_intf, name ) ) /* Select the accurate value of the ComboBox */ bool b_cache_equal = true; int i_cache = config_GetInt( p_intf, "file-caching"); TestCaC( "udp-caching" ); if (module_Exists (p_intf, "dvdread")) TestCaC( "dvdread-caching" ); if (module_Exists (p_intf, "dvdnav")) TestCaC( "dvdnav-caching" ); TestCaC( "tcp-caching" ); TestCaC( "fake-caching" ); TestCaC( "cdda-caching" ); TestCaC( "screen-caching" ); TestCaC( "vcd-caching" ); #ifdef WIN32 TestCaC( "dshow-caching" ); #else if (module_Exists (p_intf, "v4l")) TestCaC( "v4l-caching" ); if (module_Exists (p_intf, "access_jack")) TestCaC( "jack-input-caching" ); if (module_Exists (p_intf, "v4l2")) TestCaC( "v4l2-caching" ); if (module_Exists (p_intf, "pvr")) TestCaC( "pvr-caching" ); #endif TestCaCi( "rtsp-caching", 4 ); TestCaCi( "ftp-caching", 2 ); TestCaCi( "http-caching", 4 ); if (module_Exists (p_intf, "access_realrtsp")) TestCaCi( "realrtsp-caching", 10 ); TestCaCi( "mms-caching", 19 ); if( b_cache_equal ) ui.cachingCombo->setCurrentIndex( ui.cachingCombo->findData( QVariant( i_cache ) ) ); END_SPREFS_CAT; /******************* * Interface Panel * *******************/ START_SPREFS_CAT( Interface, qtr("Interface Settings") ); ui.defaultLabel->setFont( italicFont ); ui.skinsLabel->setFont( italicFont );#if defined( WIN32 ) CONFIG_GENERIC( "language", StringList, NULL, language ); BUTTONACT( ui.assoButton, assoDialog() );#else ui.language->hide(); ui.languageLabel->hide(); ui.assoName->hide(); ui.assoButton->hide();#endif /* interface */ char *psz_intf = config_GetPsz( p_intf, "intf" ); if( psz_intf ) { if( strstr( psz_intf, "skin" ) ) ui.skins->setChecked( true ); else if( strstr( psz_intf, "qt" ) ) ui.qt4->setChecked( true ); } free( psz_intf ); optionWidgets.append( ui.skins ); optionWidgets.append( ui.qt4 ); CONFIG_GENERIC( "qt-display-mode", IntegerList, NULL, displayModeBox ); CONFIG_GENERIC( "embedded-video", Bool, NULL, embedVideo ); CONFIG_GENERIC( "qt-fs-controller", Bool, NULL, fsController ); CONFIG_GENERIC_FILE( "skins2-last", File, NULL, ui.fileSkin, ui.skinBrowse ); CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel, artFetcher ); /* UPDATE options */#ifdef UPDATE_CHECK CONFIG_GENERIC( "qt-updates-notif", Bool, NULL, updatesBox ); CONFIG_GENERIC_NO_BOOL( "qt-updates-days", Integer, NULL, updatesDays ); CONNECT( ui.updatesBox, toggled( bool ), ui.updatesDays, setEnabled( bool ) );#else ui.updatesBox->hide(); ui.updatesDays->hide();#endif /* ONE INSTANCE options */#if defined( WIN32 ) || defined( HAVE_DBUS ) || defined(__APPLE__) CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode ); CONFIG_GENERIC( "playlist-enqueue", Bool, NULL, EnqueueOneInterfaceMode );#else ui.OneInterfaceBox->hide();#endif END_SPREFS_CAT; START_SPREFS_CAT( Subtitles, qtr("Subtitles & On Screen Display Settings") ); CONFIG_GENERIC( "osd", Bool, NULL, OSDBox); CONFIG_GENERIC( "subsdec-encoding", StringList, NULL, encoding ); CONFIG_GENERIC( "sub-language", String, NULL, preferredLanguage ); CONFIG_GENERIC_FILE( "freetype-font", File, NULL, ui.font, ui.fontBrowse ); CONFIG_GENERIC( "freetype-color", IntegerList, NULL, fontColor ); CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList, NULL, fontSize ); CONFIG_GENERIC( "freetype-effect", IntegerList, NULL, effect ); END_SPREFS_CAT; case SPrefsHotkeys: { p_config = config_FindConfig( VLC_OBJECT(p_intf), "key-fullscreen" ); QGridLayout *gLayout = new QGridLayout; panel->setLayout( gLayout ); int line = 0; control = new KeySelectorControl( VLC_OBJECT(p_intf), p_config , this, gLayout, line ); panel_label->setText( qtr( "Configure Hotkeys" ) ); controls.append( control ); break; } } panel_layout->addWidget( panel_label ); panel_layout->addWidget( title_line ); panel_layout->addWidget( panel ); if( number != SPrefsHotkeys ) panel_layout->addStretch( 2 ); setLayout( panel_layout );}void SPrefsPanel::updateAudioOptions( int number){ QString value = qobject_cast<QComboBox *>(optionWidgets[audioOutCoB]) ->itemData( number ).toString();#ifdef WIN32 optionWidgets[directxW]->setVisible( ( value == "directx" ) );#else /* optionWidgets[ossW] can be NULL */ if( optionWidgets[ossW] ) optionWidgets[ossW]->setVisible( ( value == "oss" ) ); /* optionWidgets[alsaW] can be NULL */ if( optionWidgets[alsaW] ) optionWidgets[alsaW]->setVisible( ( value == "alsa" ) );#endif optionWidgets[fileW]->setVisible( ( value == "aout_file" ) );}SPrefsPanel::~SPrefsPanel(){ qDeleteAll( controls ); controls.clear();}void SPrefsPanel::updateAudioVolume( int volume ){ qobject_cast<QSpinBox *>(optionWidgets[volLW]) ->setValue( volume * 100 / 256 );}/* Function called from the main Preferences dialog on each SPrefs Panel */void SPrefsPanel::apply(){ /* Generic save for ever panel */ QList<ConfigControl *>::Iterator i; for( i = controls.begin() ; i != controls.end() ; i++ ) { ConfigControl *c = qobject_cast<ConfigControl *>(*i); c->doApply( p_intf ); } switch( number ) { case SPrefsInputAndCodecs:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -