Esempio n. 1
0
SettingsDialog::~SettingsDialog()
{
    qDebug() << Q_FUNC_INFO;

    if ( !m_rejected )
    {
        TomahawkSettings* s = TomahawkSettings::instance();

        s->setHttpEnabled( ui->checkBoxHttp->checkState() == Qt::Checked );
        s->setPreferStaticHostPort( ui->checkBoxStaticPreferred->checkState() == Qt::Checked );
        s->setExternalAddressMode( ui->checkBoxUpnp->checkState() == Qt::Checked ? TomahawkSettings::Upnp : TomahawkSettings::Lan );

        s->setExternalHostname( ui->staticHostName->text() );
        s->setExternalPort( ui->staticPort->value() );

        s->setScannerPaths( QStringList( ui->lineEditMusicPath_2->text() ) );
        s->setWatchForChanges( ui->checkBoxWatchForChanges->isChecked() );

        s->setScrobblingEnabled( ui->checkBoxEnableLastfm->isChecked() );
        s->setLastFmUsername( ui->lineEditLastfmUsername->text() );
        s->setLastFmPassword( ui->lineEditLastfmPassword->text() );

        s->setAllScriptResolvers( m_resolversModel->allResolvers() );
        s->setEnabledScriptResolvers( m_resolversModel->enabledResolvers() );

        s->applyChanges();
    }
    else
        qDebug() << "Settings dialog cancelled, NOT saving prefs.";

    delete ui;
}
Esempio n. 2
0
void
HostDialog::saveSettings()
{
    TomahawkSettings* s = TomahawkSettings::instance();

    s->setAutoDetectExternalIp( ui->autoDetectIpCheckBox->isChecked() );
    s->setExternalHostname( ui->staticHostName->text() );
    s->setExternalPort( ui->staticPort->value() );

    s->sync();
}