void SettingsDialog::accept()
{
    SettingsManager* settings = SettingsManager::instance();

    const QAbstractButton* regionBtn = ui->regionBtnGrp->checkedButton();
    if (regionBtn == ui->ntscURB)
        settings->setDefaultRegion(Region::NTSCU);
    else if (regionBtn == ui->ntscKRB)
        settings->setDefaultRegion(Region::NTSCK);
    else if (regionBtn == ui->ntscJRB)
        settings->setDefaultRegion(Region::NTSCJ);
    else if (regionBtn == ui->palRB)
        settings->setDefaultRegion(Region::PAL);

    if (ui->ntscUNameLE->isModified() && !ui->ntscUNameLE->text().isEmpty())
        settings->setDefaultPlayerNameForRegion(Region::NTSCU, ui->ntscUNameLE->text());
    if (ui->ntscKNameLE->isModified() && !ui->ntscKNameLE->text().isEmpty())
        settings->setDefaultPlayerNameForRegion(Region::NTSCK, ui->ntscKNameLE->text());
    if (ui->ntscJNameLE->isModified() && !ui->ntscJNameLE->text().isEmpty())
        settings->setDefaultPlayerNameForRegion(Region::NTSCJ, ui->ntscJNameLE->text());
    if (ui->palNameLE->isModified() && !ui->palNameLE->text().isEmpty())
        settings->setDefaultPlayerNameForRegion(Region::PAL, ui->palNameLE->text());
    if (ui->updateUrlLineEdit->isModified() && !ui->updateUrlLineEdit->text().isEmpty())
        settings->setUpdateUrl(ui->updateUrlLineEdit->text());
    settings->setUpdateCheckOnStart(ui->checkOnStart->isChecked());
    SkipDatabaseWidget* sdw = qobject_cast<SkipDatabaseWidget*>(ui->skipDatabaseTab);
    sdw->saveDatabase();
    settings->saveSettings();
    QDialog::accept();
}
void Harness::onSettingsChanged()
{
	qDebug() << "Harness::onSettingsChanged()";
	settingsManager.updateSettings(gui->getSettingsWidget());
	settingsManager.saveSettings();
	windDataAnalyzer->setAverageSpeedCalculationTimeRange(settingsManager.getSettings().averageSpeedCalculationTimeRange);
	windDataAnalyzer->setGustSpeedCalculationTimeRange(settingsManager.getSettings().gustSpeedCalculationTimeRange);
	dataLogger->enableAutomaticSaving(settingsManager.getSettings().automaticLogSavingEnabled);
	dataLogger->setAutomaticSavingInterval(settingsManager.getSettings().automaticLogSavingIntervalS);
	dataLogger->setAutomaticSavingFolderPath(settingsManager.getSettings().automaticLogSavingFolderPath);
	compassOffset = settingsManager.getSettings().compassOffset;
}