?? configdialog.cpp
字號:
m_pageList << page; KConfigDialog::addPage( page, itemName, pixmapName, header, manage );}/** Show page by object name */void AmarokConfigDialog::showPageByName( const QCString& page ){ for( uint index = 0; index < m_pageList.count(); index++ ) { if ( m_pageList[index]->name() == page ) { KConfigDialog::showPage( index ); return; } }}//////////////////////////////////////////////////////////////////////////////////////////// PROTECTED SLOTS///////////////////////////////////////////////////////////////////////////////////////////** * Update the buttons. * REIMPLEMENTED */void AmarokConfigDialog::updateButtons(){ KConfigDialog::updateButtons();}/** * Update the settings from the dialog. * Example use: User clicks Ok or Apply button in a configure dialog. * REIMPLEMENTED */void AmarokConfigDialog::updateSettings(){#ifdef Q_WS_X11 OSDPreviewWidget *osd = static_cast<OSDPreviewWidget*>( child( "osdpreview" ) ); AmarokConfig::setOsdAlignment( osd->alignment() ); AmarokConfig::setOsdYOffset( osd->y() ); Amarok::OSD::instance()->applySettings();#endif static_cast<CollectionSetup*>(child("CollectionSetup"))->writeConfig(); if ( m_engineConfig ) m_engineConfig->save(); AmarokConfig::setExternalBrowser( externalBrowser() ); // When sound system has changed, update engine config page if ( m_soundSystem->currentText() != m_pluginAmarokName[AmarokConfig::soundSystem()] ) { AmarokConfig::setSoundSystem( m_pluginName[m_soundSystem->currentText()] ); emit settingsChanged(); soundSystemChanged(); } if ( m_opt2->styleComboBox->currentText() != AmarokConfig::contextBrowserStyleSheet() ) { //can't use kconfigxt for the style comboxbox's since we need the string, not the index AmarokConfig::setContextBrowserStyleSheet( m_opt2->styleComboBox->currentText() ); ContextBrowser::instance()->reloadStyleSheet(); } int dbType = Amarok::databaseTypeCode( m_opt7->dbSetupFrame->databaseEngine->currentText() ); if ( dbType != AmarokConfig::databaseEngine().toInt() ) { AmarokConfig::setDatabaseEngine( QString::number( dbType ) ); emit settingsChanged(); } m_deviceManager->finished(); if( MediaBrowser::isAvailable() ) { PlaylistWindow::self()->addBrowser( "MediaBrowser", MediaBrowser::instance(), i18n( "Media Device" ), Amarok::icon( "device" ) ); //to re-enable mediabrowser hiding, uncomment this: //connect( MediaBrowser::instance(), SIGNAL( availabilityChanged( bool ) ), // PlaylistWindow::self(), SLOT( mbAvailabilityChanged( bool ) ) ); } Amarok::setUseScores( m_opt1->kcfg_UseScores->isChecked() ); Amarok::setUseRatings( m_opt1->kcfg_UseRatings->isChecked() ); // The following makes everything with a moodbar redraw itself. Amarok::setMoodbarPrefs( m_opt1->kcfg_ShowMoodbar->isChecked(), m_opt1->kcfg_MakeMoodier->isChecked(), m_opt1->kcfg_AlterMood->currentItem(), m_opt1->kcfg_MoodsWithMusic->isChecked() );}/** * Update the configuration-widgets in the dialog based on Amarok's current settings. * Example use: Initialisation of dialog. * Example use: User clicks Reset button in a configure dialog. * REIMPLEMENTED */void AmarokConfigDialog::updateWidgets(){ m_soundSystem->setCurrentText( m_pluginAmarokName[AmarokConfig::soundSystem()] ); soundSystemChanged();}/** * Update the configuration-widgets in the dialog based on the default values for Amarok's settings. * Example use: User clicks Defaults button in a configure dialog. * REIMPLEMENTED */void AmarokConfigDialog::updateWidgetsDefault(){ m_soundSystem->setCurrentItem( 0 );}//////////////////////////////////////////////////////////////////////////////////////////// PROTECTED///////////////////////////////////////////////////////////////////////////////////////////** * @return true if any configuration items we are managing changed from Amarok's stored settings * We manage the engine combo box and some of the OSD settings * REIMPLEMENTED */bool AmarokConfigDialog::hasChanged(){#ifdef Q_WS_X11 OSDPreviewWidget *osd = static_cast<OSDPreviewWidget*>( child( "osdpreview" ) );#endif return m_soundSystem->currentText() != m_pluginAmarokName[AmarokConfig::soundSystem()] ||#ifdef Q_WS_X11 osd->alignment() != AmarokConfig::osdAlignment() || osd->alignment() != OSDWidget::Center && osd->y() != AmarokConfig::osdYOffset() ||#endif m_opt2->styleComboBox->currentText() != AmarokConfig::contextBrowserStyleSheet() || Amarok::databaseTypeCode( m_opt7->dbSetupFrame->databaseEngine->currentText() ) != AmarokConfig::databaseEngine().toInt() || m_engineConfig && m_engineConfig->hasChanged() || m_deviceManager && m_deviceManager->hasChanged() || externalBrowser() != AmarokConfig::externalBrowser();}/** REIMPLEMENTED */bool AmarokConfigDialog::isDefault(){ AMAROK_NOTIMPLEMENTED //TODO hard to implement - what are default settings for OSD etc? return false;}//////////////////////////////////////////////////////////////////////////////////////////// PRIVATE SLOTS//////////////////////////////////////////////////////////////////////////////////////////void AmarokConfigDialog::aboutEngine() //SLOT{ PluginManager::showAbout( QString( "Name == '%1'" ).arg( m_soundSystem->currentText() ) );}//////////////////////////////////////////////////////////////////////////////////////////// PRIVATE//////////////////////////////////////////////////////////////////////////////////////////void AmarokConfigDialog::soundSystemChanged(){ ///A new sound system has been LOADED ///If only the sound system widget has been changed don't call this! // remove old engine config widget // will delete the view if implementation is done correctly delete m_engineConfig; if( EngineController::hasEngineProperty( "HasConfigure" ) ) { m_engineConfig = EngineController::engine()->configure(); m_engineConfig->view()->reparent( m_engineConfigFrame, QPoint() ); m_engineConfig->view()->show(); m_engineConfigFrame->setTitle( i18n( "to change settings", "Configure %1" ).arg( m_soundSystem->currentText() ) ); m_engineConfigFrame->show(); connect( m_engineConfig, SIGNAL(viewChanged()), SLOT(updateButtons()) ); } else { m_engineConfig = 0; m_engineConfigFrame->hide(); } const bool hasCrossfade = EngineController::hasEngineProperty( "HasCrossfade" ); const bool crossfadeOn = m_opt4->kcfg_Crossfade->isOn(); // Enable crossfading option when available m_opt4->kcfg_Crossfade->setEnabled( hasCrossfade ); m_opt4->kcfg_CrossfadeLength->setEnabled( hasCrossfade && crossfadeOn ); m_opt4->crossfadeLengthLabel->setEnabled( hasCrossfade && crossfadeOn ); m_opt4->kcfg_CrossfadeType->setEnabled( hasCrossfade && crossfadeOn ); if (!hasCrossfade) { m_opt4->radioButtonNormalPlayback->setChecked( true ); }}QString AmarokConfigDialog::externalBrowser() const{ return m_opt1->kComboBox_browser->isEnabled() ?#ifdef Q_WS_MAC m_opt1->kComboBox_browser->currentText() == i18n( "Default Browser" ) ? "open" :#else m_opt1->kComboBox_browser->currentText() == i18n( "Default KDE Browser" ) ? "kfmclient openURL" :#endif m_opt1->kComboBox_browser->currentText().lower() : m_opt1->kLineEdit_customBrowser->text().lower();}#include "configdialog.moc"
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -