mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Preferences: random fixes
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d9595ad266
commit
8a54a46779
6 changed files with 24 additions and 32 deletions
|
@ -25,7 +25,6 @@ void PreferencesDefaults::on_chooseFile_clicked()
|
|||
ui->defaultfilename->setText(choosenFileName);
|
||||
}
|
||||
|
||||
|
||||
void PreferencesDefaults::on_btnUseDefaultFile_toggled(bool toggle)
|
||||
{
|
||||
if (toggle) {
|
||||
|
@ -36,22 +35,11 @@ void PreferencesDefaults::on_btnUseDefaultFile_toggled(bool toggle)
|
|||
}
|
||||
}
|
||||
|
||||
void PreferencesDefaults::on_noDefaultFile_toggled(bool toggle)
|
||||
{
|
||||
prefs.default_file_behavior = NO_DEFAULT_FILE;
|
||||
}
|
||||
|
||||
void PreferencesDefaults::on_localDefaultFile_toggled(bool toggle)
|
||||
{
|
||||
ui->defaultfilename->setEnabled(toggle);
|
||||
ui->btnUseDefaultFile->setEnabled(toggle);
|
||||
ui->chooseFile->setEnabled(toggle);
|
||||
prefs.default_file_behavior = LOCAL_DEFAULT_FILE;
|
||||
}
|
||||
|
||||
void PreferencesDefaults::on_cloudDefaultFile_toggled(bool toggle)
|
||||
{
|
||||
prefs.default_file_behavior = CLOUD_DEFAULT_FILE;
|
||||
}
|
||||
|
||||
void PreferencesDefaults::refreshSettings()
|
||||
|
|
|
@ -18,9 +18,7 @@ public:
|
|||
public slots:
|
||||
void on_chooseFile_clicked();
|
||||
void on_btnUseDefaultFile_toggled(bool toggled);
|
||||
void on_noDefaultFile_toggled(bool toggled);
|
||||
void on_localDefaultFile_toggled(bool toggled);
|
||||
void on_cloudDefaultFile_toggled(bool toggled);
|
||||
|
||||
private:
|
||||
Ui::PreferencesDefaults *ui;
|
||||
|
|
|
@ -49,7 +49,6 @@ void PreferencesGraph::syncSettings()
|
|||
s.setValue("pscr_ratio", rint(1000.0 / ui->pscrfactor->value()));
|
||||
s.endGroup();
|
||||
|
||||
// Graph
|
||||
s.beginGroup("TecDetails");
|
||||
SAVE_OR_REMOVE("phethreshold", default_prefs.pp_graphs.phe_threshold, ui->pheThreshold->value());
|
||||
SAVE_OR_REMOVE("po2threshold", default_prefs.pp_graphs.po2_threshold, ui->po2Threshold->value());
|
||||
|
|
|
@ -16,23 +16,6 @@ PreferencesUnits::~PreferencesUnits()
|
|||
}
|
||||
|
||||
void PreferencesUnits::refreshSettings()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("Units");
|
||||
QString unitSystem[] = {"metric", "imperial", "personal"};
|
||||
short unitValue = ui->metric->isChecked() ? METRIC : (ui->imperial->isChecked() ? IMPERIAL : PERSONALIZE);
|
||||
SAVE_OR_REMOVE_SPECIAL("unit_system", default_prefs.unit_system, unitValue, unitSystem[unitValue]);
|
||||
s.setValue("temperature", ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS);
|
||||
s.setValue("length", ui->feet->isChecked() ? units::FEET : units::METERS);
|
||||
s.setValue("pressure", ui->psi->isChecked() ? units::PSI : units::BAR);
|
||||
s.setValue("volume", ui->cuft->isChecked() ? units::CUFT : units::LITER);
|
||||
s.setValue("weight", ui->lbs->isChecked() ? units::LBS : units::KG);
|
||||
s.setValue("vertical_speed_time", ui->vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS);
|
||||
s.setValue("coordinates", ui->gpsTraditional->isChecked());
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
void PreferencesUnits::syncSettings()
|
||||
{
|
||||
switch(prefs.unit_system) {
|
||||
case METRIC: ui->metric->setChecked(true); break;
|
||||
|
@ -58,3 +41,20 @@ void PreferencesUnits::syncSettings()
|
|||
ui->vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
|
||||
ui->vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
|
||||
}
|
||||
|
||||
void PreferencesUnits::syncSettings()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("Units");
|
||||
QString unitSystem[] = {"metric", "imperial", "personal"};
|
||||
short unitValue = ui->metric->isChecked() ? METRIC : (ui->imperial->isChecked() ? IMPERIAL : PERSONALIZE);
|
||||
SAVE_OR_REMOVE_SPECIAL("unit_system", default_prefs.unit_system, unitValue, unitSystem[unitValue]);
|
||||
s.setValue("temperature", ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS);
|
||||
s.setValue("length", ui->feet->isChecked() ? units::FEET : units::METERS);
|
||||
s.setValue("pressure", ui->psi->isChecked() ? units::PSI : units::BAR);
|
||||
s.setValue("volume", ui->cuft->isChecked() ? units::CUFT : units::LITER);
|
||||
s.setValue("weight", ui->lbs->isChecked() ? units::LBS : units::KG);
|
||||
s.setValue("vertical_speed_time", ui->vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS);
|
||||
s.setValue("coordinates", ui->gpsTraditional->isChecked());
|
||||
s.endGroup();
|
||||
}
|
||||
|
|
|
@ -100,6 +100,8 @@ void PreferencesDialogV2::applyRequested()
|
|||
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
|
||||
page->syncSettings();
|
||||
}
|
||||
emit settingsChanged();
|
||||
accept();
|
||||
}
|
||||
|
||||
void PreferencesDialogV2::cancelRequested()
|
||||
|
@ -107,6 +109,7 @@ void PreferencesDialogV2::cancelRequested()
|
|||
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
|
||||
page->refreshSettings();
|
||||
}
|
||||
reject();
|
||||
}
|
||||
|
||||
void PreferencesDialogV2::defaultsRequested()
|
||||
|
@ -115,4 +118,6 @@ void PreferencesDialogV2::defaultsRequested()
|
|||
Q_FOREACH(AbstractPreferencesWidget *page, pages) {
|
||||
page->refreshSettings();
|
||||
}
|
||||
emit settingsChanged();
|
||||
accept();
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ public:
|
|||
virtual ~PreferencesDialogV2();
|
||||
void addPreferencePage(AbstractPreferencesWidget *page);
|
||||
void refreshPages();
|
||||
signals:
|
||||
void settingsChanged();
|
||||
private:
|
||||
void cancelRequested();
|
||||
void applyRequested();
|
||||
|
|
Loading…
Reference in a new issue