@@ -1599,116 +1599,116 @@ void MainWindow::plotKmzOutputs()
15991599
16001600void MainWindow::writeSettings ()
16011601{
1602- writeToConsole (" Saving settings..." );
1603-
1604- QSettings settings (QSettings::UserScope, " Firelab" , " WindNinja" );
1605- settings.setDefaultFormat (QSettings::IniFormat);
1606- // qDebug() << "settings filename =" << settings.fileName();
1607-
1608- // input file path
1609- settings.setValue (" inputFileDir" , ui->elevationInputFileLineEdit ->property (" fullpath" ));
1610-
1611- // momentum flag
1612- settings.setValue (" momentumFlag" , ui->momentumSolverCheckBox ->isChecked ());
1613- // veg choice
1614- settings.setValue (" vegChoice" , ui->vegetationComboBox ->currentIndex ());
1615- // mesh choice
1616- settings.setValue (" meshChoice" , ui->meshResolutionComboBox ->currentIndex ());
1617- // mesh units
1618- settings.setValue (" meshUnits" , ui->meshResolutionUnitsComboBox ->currentIndex ());
1619- // number of processors
1620- settings.setValue (" nProcessors" , ui->numberOfProcessorsSpinBox ->value ());
1621-
1622- // time zone
1623- // settings.setValue("timeZone", ui->timeZoneComboBox->currentIndex());
1624-
1625- // settings.setValue("pointFile", tree->point->stationFileName );
1626-
1627- // if(ui->meshResolutionComboBox->currentIndex() == 3) // custom res
1628- // {
1629- // settings.setValue("customRes", ui->meshResolutionSpinBox->value());
1630- // }
1631- // need to write it every time, the past value will get left there without getting updated otherwise, doesn't delete past settings values
1632- settings.setValue (" customRes" , ui->meshResolutionSpinBox ->value ());
1633-
1634- writeToConsole (" Settings saved." );
1602+ // writeToConsole("Saving settings...");
1603+
1604+ // QSettings settings(QSettings::UserScope, "Firelab", "WindNinja");
1605+ // settings.setDefaultFormat(QSettings::IniFormat);
1606+ // // qDebug() << "settings filename =" << settings.fileName();
1607+
1608+ // // input file path
1609+ // settings.setValue("inputFileDir", ui->elevationInputFileLineEdit->property("fullpath"));
1610+
1611+ // // momentum flag
1612+ // settings.setValue("momentumFlag", ui->momentumSolverCheckBox->isChecked());
1613+ // // veg choice
1614+ // settings.setValue("vegChoice", ui->vegetationComboBox->currentIndex());
1615+ // // mesh choice
1616+ // settings.setValue("meshChoice", ui->meshResolutionComboBox->currentIndex());
1617+ // // mesh units
1618+ // settings.setValue("meshUnits", ui->meshResolutionUnitsComboBox->currentIndex());
1619+ // // number of processors
1620+ // settings.setValue("nProcessors", ui->numberOfProcessorsSpinBox->value());
1621+
1622+ // // time zone
1623+ // // settings.setValue("timeZone", ui->timeZoneComboBox->currentIndex());
1624+
1625+ // // settings.setValue("pointFile", tree->point->stationFileName );
1626+
1627+ // // if(ui->meshResolutionComboBox->currentIndex() == 3) // custom res
1628+ // // {
1629+ // // settings.setValue("customRes", ui->meshResolutionSpinBox->value());
1630+ // // }
1631+ // // need to write it every time, the past value will get left there without getting updated otherwise, doesn't delete past settings values
1632+ // settings.setValue("customRes", ui->meshResolutionSpinBox->value());
1633+
1634+ // writeToConsole("Settings saved.");
16351635}
16361636
16371637void MainWindow::readSettings ()
16381638{
1639- QSettings settings (QSettings::UserScope, " Firelab" , " WindNinja" );
1640- settings.setDefaultFormat (QSettings::IniFormat);
1639+ // QSettings settings(QSettings::UserScope, "Firelab", "WindNinja");
1640+ // settings.setDefaultFormat(QSettings::IniFormat);
16411641
1642- if (settings.contains (" inputFileDir" ))
1643- {
1644- if (QFile::exists (settings.value (" inputFileDir" ).toString ()))
1645- {
1646- ui->elevationInputFileLineEdit ->setText (settings.value (" inputFileDir" ).toString ());
1647- }
1648- }
1649- else
1650- {
1651- // std::string oTmpPath = FindNinjaRootDir();
1652- // inputFileDir = CPLFormFilename(oTmpPath.c_str(), "etc/windninja/example-files", NULL);
1653- }
1642+ // if(settings.contains("inputFileDir"))
1643+ // {
1644+ // if(QFile::exists(settings.value("inputFileDir").toString()))
1645+ // {
1646+ // ui->elevationInputFileLineEdit->setText(settings.value("inputFileDir").toString());
1647+ // }
1648+ // }
1649+ // else
1650+ // {
1651+ // // std::string oTmpPath = FindNinjaRootDir();
1652+ // // inputFileDir = CPLFormFilename(oTmpPath.c_str(), "etc/windninja/example-files", NULL);
1653+ // }
16541654
1655- // TODO: some of the following might be overriding the values computed by inputFileDir, when the other way around might be better
1656- if (settings.contains (" momentumFlag" ))
1657- {
1658- bool momentumFlag = settings.value (" momentumFlag" ).toBool ();
1659- if (momentumFlag == true )
1660- {
1661- ui->momentumSolverCheckBox ->setChecked (true );
1662- emit momentumSolverCheckBoxClicked ();
1663- }
1664- }
1665- if (settings.contains (" vegChoice" ))
1666- {
1667- ui->vegetationComboBox ->setCurrentIndex (settings.value (" vegChoice" ).toInt ());
1668- }
1669- if (settings.contains (" meshUnits" )) // putting this after loading meshChoice results in overwriting the value by an extra set of units
1670- {
1671- ui->meshResolutionUnitsComboBox ->setCurrentIndex (settings.value (" meshUnits" ).toInt ());
1672- }
1673- if (settings.contains (" meshChoice" ))
1674- {
1675- int choice = settings.value (" meshChoice" ).toInt ();
1676- ui->meshResolutionComboBox ->setCurrentIndex (choice);
1677- if (choice == 3 )
1678- {
1679- if (!settings.contains (" customRes" ))
1680- {
1681- qDebug () << " Error. WindNinja settings does not contain \" customRes\" " ;
1682- }
1683- ui->meshResolutionSpinBox ->setValue (settings.value (" customRes" ).toDouble ());
1684- }
1685- }
1686- if (settings.contains (" nProcessors" ))
1687- {
1688- ui->numberOfProcessorsSpinBox ->setValue (settings.value (" nProcessors" ).toInt ());
1689- }
1690- // won't we want the timezone of the dem every time, to avoid accidentally doing a weird combination of time zones?
1691- if (settings.contains (" timeZone" ))
1692- {
1693- // QString v = settings.value("timeZone").toString();
1694- // int index = tree->surface->timeZone->tzComboBox->findText(v);
1695- // if(index == -1)
1696- // tree->surface->timeZone->tzCheckBox->setChecked( true );
1697- // index = tree->surface->timeZone->tzComboBox->findText(v);
1698- // if( index == 0 )
1699- // tree->surface->timeZone->tzComboBox->setCurrentIndex(index + 1);
1700- // true->surface->timeZone->tzComboBox->setCurrentIndex(index);
1701- }
1702- else
1703- {
1704- // tree->surface->timeZone->tzComboBox->setCurrentIndex(2);
1705- // tree->surface->timeZone->tzComboBox->setCurrentIndex(1);
1706- }
1707- if (settings.contains (" pointFile" ))
1708- {
1709- // QString f = settings.value("pointFile").toString();
1710- // tree->point->stationFileName = f;
1711- }
1655+ // // TODO: some of the following might be overriding the values computed by inputFileDir, when the other way around might be better
1656+ // if(settings.contains("momentumFlag"))
1657+ // {
1658+ // bool momentumFlag = settings.value("momentumFlag").toBool();
1659+ // if(momentumFlag == true)
1660+ // {
1661+ // ui->momentumSolverCheckBox->setChecked(true);
1662+ // emit momentumSolverCheckBoxClicked();
1663+ // }
1664+ // }
1665+ // if(settings.contains("vegChoice"))
1666+ // {
1667+ // ui->vegetationComboBox->setCurrentIndex(settings.value("vegChoice").toInt());
1668+ // }
1669+ // if(settings.contains("meshUnits")) // putting this after loading meshChoice results in overwriting the value by an extra set of units
1670+ // {
1671+ // ui->meshResolutionUnitsComboBox->setCurrentIndex(settings.value("meshUnits").toInt());
1672+ // }
1673+ // if(settings.contains("meshChoice"))
1674+ // {
1675+ // int choice = settings.value("meshChoice").toInt();
1676+ // ui->meshResolutionComboBox->setCurrentIndex(choice);
1677+ // if(choice == 3)
1678+ // {
1679+ // if(!settings.contains("customRes"))
1680+ // {
1681+ // qDebug() << "Error. WindNinja settings does not contain \"customRes\"";
1682+ // }
1683+ // ui->meshResolutionSpinBox->setValue(settings.value("customRes").toDouble());
1684+ // }
1685+ // }
1686+ // if(settings.contains("nProcessors"))
1687+ // {
1688+ // ui->numberOfProcessorsSpinBox->setValue(settings.value("nProcessors").toInt());
1689+ // }
1690+ // // won't we want the timezone of the dem every time, to avoid accidentally doing a weird combination of time zones?
1691+ // if(settings.contains("timeZone"))
1692+ // {
1693+ // // QString v = settings.value("timeZone").toString();
1694+ // // int index = tree->surface->timeZone->tzComboBox->findText(v);
1695+ // // if(index == -1)
1696+ // // tree->surface->timeZone->tzCheckBox->setChecked( true );
1697+ // // index = tree->surface->timeZone->tzComboBox->findText(v);
1698+ // // if( index == 0 )
1699+ // // tree->surface->timeZone->tzComboBox->setCurrentIndex(index + 1);
1700+ // // true->surface->timeZone->tzComboBox->setCurrentIndex(index);
1701+ // }
1702+ // else
1703+ // {
1704+ // // tree->surface->timeZone->tzComboBox->setCurrentIndex(2);
1705+ // // tree->surface->timeZone->tzComboBox->setCurrentIndex(1);
1706+ // }
1707+ // if(settings.contains("pointFile"))
1708+ // {
1709+ // // QString f = settings.value("pointFile").toString();
1710+ // // tree->point->stationFileName = f;
1711+ // }
17121712}
17131713
17141714void MainWindow::showEvent (QShowEvent *event)
0 commit comments