void GeneralSettingsWidget::saveSettings() { qDebug() << "has unsaved changes?" << hasUnsavedChanges(); if ( hasUnsavedChanges() ) { int currIndex = ui->languages->currentIndex(); QString currLanguage = ui->languages->itemData( currIndex ).toString(); if ( unicorn::AppSettings().value( "language", "" ) != currLanguage ) { unicorn::AppSettings().setValue( "language", currLanguage ); QMessageBoxBuilder( 0 ) .setIcon( QMessageBox::Information ) .setTitle( tr( "Restart needed" ) ) .setText( tr( "You need to restart the application for the language change to take effect." ) ) .exec(); } unicorn::Settings().setValue( SETTING_SHOW_AS, ui->showAs->isChecked() ); aApp->showAs( ui->showAs->isChecked() ); // setting is for the 'Client' aplication for compatibility with old media player plugins unicorn::AppSettings( "Client" ).setValue( SETTING_LAUNCH_ITUNES, ui->launch->isChecked() ); // unicorn::Settings().setValue( SETTING_NOTIFICATIONS, ui->notifications->isChecked() ); unicorn::Settings().setValue( SETTING_LAST_RADIO, ui->lastRadio->isChecked() ); unicorn::Settings().setValue( SETTING_SEND_CRASH_REPORTS, ui->sendCrashReports->isChecked() ); unicorn::Settings().setValue( SETTING_CHECK_UPDATES, ui->updates->isChecked() ); onSettingsSaved(); } }
void ScrobbleSettingsWidget::saveSettings() { if ( hasUnsavedChanges() ) { qDebug() << "Saving settings..."; aApp->onScrobbleToggled( ui->scrobblingOn->isChecked() ); unicorn::UserSettings userSettings; userSettings.setScrobblePoint( ui->scrobblePoint->value() ); userSettings.setFingerprinting( ui->allowFingerprint->isChecked() ); userSettings.setPodcasts( ui->podcasts->isChecked() ); userSettings.setEnforceScrobbleTimeMax( ui->enfocreScrobbleTimeMax->isChecked() ); QStringList exclusionDirs = ui->exclusionDirs->getExclusions(); exclusionDirs.removeAll( "" ); qDebug() << exclusionDirs; userSettings.setExclusionDirs( exclusionDirs ); userSettings.sync(); ScrobbleService::instance().scrobbleSettingsChanged(); onSettingsSaved(); } }
void IpodSettingsWidget::saveSettings() { if ( hasUnsavedChanges() ) { // save settings qDebug() << "Saving settings..."; unicorn::AppSettings().setAlwaysAsk( ui->alwaysAsk->isChecked() ); // we need to restart iTunes for this setting to take affect bool currentlyEnabled = unicorn::OldeAppSettings().deviceScrobblingEnabled(); #ifndef Q_WS_X11 if ( currentlyEnabled != ui->deviceScrobblingEnabled->isChecked() ) { #ifdef Q_OS_WIN QList<unicorn::IPluginInfo*> plugins; unicorn::ITunesPluginInfo* iTunesPluginInfo = new unicorn::ITunesPluginInfo; plugins << iTunesPluginInfo; unicorn::CloseAppsDialog* closeApps = new unicorn::CloseAppsDialog( plugins, this ); closeApps->setOwnsPlugins( true ); #else unicorn::CloseAppsDialog* closeApps = new unicorn::CloseAppsDialog( this ); #endif if ( closeApps->result() != QDialog::Accepted ) closeApps->exec(); else closeApps->deleteLater(); if ( closeApps->result() == QDialog::Accepted ) { unicorn::OldeAppSettings().setDeviceScrobblingEnabled( ui->deviceScrobblingEnabled->isChecked() ); } else { ui->deviceScrobblingEnabled->setChecked( currentlyEnabled ); // The user didn't close their media players QMessageBoxBuilder( this ).setTitle( tr( "Setting not changed" ) ) .setIcon( QMessageBox::Warning ) .setText( tr( "You did not close iTunes for this setting to change" ) ) .setButtons( QMessageBox::Ok ) .exec(); } } #endif onSettingsSaved(); } }
void ScrobbleSettingsWidget::saveSettings() { if ( hasUnsavedChanges() ) { qDebug() << "Saving settings..."; aApp->onScrobbleToggled( ui->scrobblingOn->isChecked() ); unicorn::UserSettings().setValue( SETTING_SCROBBLE_POINT, ui->scrobblePoint->value() ); unicorn::UserSettings().setValue( SETTING_ALLOW_FINGERPRINTING, ui->allowFingerprint->isChecked() ); unicorn::UserSettings().setValue( SETTING_PODCASTS, ui->podcasts->isChecked() ); ScrobbleService::instance().scrobbleSettingsChanged(); onSettingsSaved(); } }
void GeneralSettingsWidget::saveSettings() { qDebug() << "has unsaved changes?" << hasUnsavedChanges(); if ( hasUnsavedChanges() ) { int currIndex = ui->languages->currentIndex(); QString currLanguage = ui->languages->itemData( currIndex ).toString(); if ( unicorn::AppSettings().value( "language", "" ) != currLanguage ) { if ( currLanguage == "" ) QLocale::setDefault( QLocale::system() ); else QLocale::setDefault( QLocale( currLanguage ) ); unicorn::AppSettings().setValue( "language", currLanguage ); // QMessageBoxBuilder( 0 ) // .setIcon( QMessageBox::Information ) // .setTitle( tr( "Restart needed" ) ) // .setText( tr( "You need to restart the application for the language change to take effect." ) ) // .exec(); } // setting is for the 'Client' aplication for compatibility with old media player plugins unicorn::AppSettings( APP_LAUNCH ).setValue( SETTING_LAUNCH_ITUNES, ui->launch->isChecked() ); unicorn::Settings().setValue( SETTING_NOTIFICATIONS, ui->notifications->isChecked() ); unicorn::Settings().setValue( SETTING_LAST_RADIO, ui->lastRadio->isChecked() ); unicorn::Settings().setValue( SETTING_SEND_CRASH_REPORTS, ui->sendCrashReports->isChecked() ); unicorn::Settings().setValue( SETTING_CHECK_UPDATES, ui->updates->isChecked() ); #ifdef Q_OS_MAC int showWhereIndex = unicorn::Settings().value( SETTING_SHOW_WHERE, -1 ).toInt(); bool showAs = ui->showWhere->currentIndex() != 1; unicorn::Settings().setValue( SETTING_SHOW_WHERE, ui->showWhere->currentIndex() ); unicorn::Settings().setValue( SETTING_SHOW_AS, showAs ); aApp->showAs( showAs ); aApp->hideDockIcon( ui->showWhere->currentIndex() == 2 ); if ( ( showWhereIndex != 2 && ui->showWhere->currentIndex() == 2 ) || (showWhereIndex == 2 && ui->showWhere->currentIndex() != 2) ) { int button = QMessageBoxBuilder( 0 ) .setIcon( QMessageBox::Question ) .setTitle( tr( "Restart now?" ) ) .setText( tr( "Would you like to restart now for the dock setting to take effect?" ) ) .setButtons( QMessageBox::Yes | QMessageBox::No ) .exec(); if ( button == QMessageBox::Yes ) aApp->restart(); } #else unicorn::Settings().setValue( SETTING_SHOW_AS, ui->showAs->isChecked() ); aApp->showAs( ui->showAs->isChecked() ); #endif onSettingsSaved(); } }
void GeneralSettingsWidget::saveSettings() { qDebug() << "has unsaved changes?" << hasUnsavedChanges(); if ( hasUnsavedChanges() ) { bool restartNeeded = false; int currIndex = ui->languages->currentIndex(); QString currLanguage = ui->languages->itemData( currIndex ).toString(); if ( unicorn::AppSettings().value( "language", "" ) != currLanguage ) { if ( currLanguage == "" ) QLocale::setDefault( QLocale::system() ); else QLocale::setDefault( QLocale( currLanguage ) ); unicorn::AppSettings().setValue( "language", currLanguage ); #ifdef Q_OS_MAC aApp->translate(); #endif restartNeeded = true; } // setting is for the 'Client' aplication for compatibility with old media player plugins unicorn::OldeAppSettings().setLaunchWithMediaPlayers( ui->launch->isChecked() ); unicorn::Settings().setNotifications( ui->notifications->isChecked() ); unicorn::Settings().setSendCrashReports( ui->sendCrashReports->isChecked() ); unicorn::Settings().setCheckForUpdates( ui->updates->isChecked() ); unicorn::Settings().setBetaUpdates( ui->beta->isChecked() ); aApp->setBetaUpdates( ui->beta->isChecked() ); #ifdef Q_OS_MAC /// media keys unicorn::Settings().setValue( "mediaKeys", ui->mediaKeys->isChecked() ); aApp->setMediaKeysEnabled( ui->mediaKeys->isChecked() ); /// dock hiding bool showDockOld = unicorn::Settings().showDock(); unicorn::Settings().setShowDock( ui->showDock->isChecked() ); if ( showDockOld != ui->showDock->isChecked() ) { // the setting has changed aApp->showDockIcon( ui->showDock->isChecked() ); // Hiding the dock icon while the app is running is not supported on Snow Leopard if ( QSysInfo::MacintoshVersion <= QSysInfo::MV_10_6 && !ui->showDock->isChecked() ) restartNeeded = true; } #endif unicorn::Settings().setShowAS( ui->showAs->isChecked() ); aApp->showAs( ui->showAs->isChecked() ); onSettingsSaved(); if ( restartNeeded ) { int button = QMessageBoxBuilder( this ) .setIcon( QMessageBox::Question ) .setTitle( tr( "Restart now?" ) ) .setText( tr( "An application restart is required for the change to take effect. Would you like to restart now?" ) ) .setButtons( QMessageBox::Yes | QMessageBox::No ) .exec(); if ( button == QMessageBox::Yes ) aApp->restart(); } } }