void MainWindow::readSettings() { QSettings s; s.beginGroup("Display"); QFont defaultFont = s.value("divelist_font", qApp->font()).value<QFont>(); defaultFont.setPointSizeF(s.value("font_size", qApp->font().pointSizeF()).toFloat()); qApp->setFont(defaultFont); s.endGroup(); s.beginGroup("TecDetails"); TOOLBOX_PREF_BUTTON(calc_all_tissues, calcalltissues, profCalcAllTissues); TOOLBOX_PREF_BUTTON(profile_calc_ceiling, calcceiling, profCalcCeiling); TOOLBOX_PREF_BUTTON(profile_dc_ceiling, dcceiling, profDcCeiling); TOOLBOX_PREF_BUTTON(ead, ead, profEad); TOOLBOX_PREF_BUTTON(calc_ceiling_3m_incr, calcceiling3m, profIncrement3m); TOOLBOX_PREF_BUTTON(mod, mod, profMod); TOOLBOX_PREF_BUTTON(calc_ndl_tts, calcndltts, profNdl_tts); TOOLBOX_PREF_BUTTON(pp_graphs.phe, phegraph, profPhe); TOOLBOX_PREF_BUTTON(pp_graphs.pn2, pn2graph, profPn2); TOOLBOX_PREF_BUTTON(pp_graphs.po2, po2graph, profPO2); ui.profRuler->setChecked(s.value("rulergraph").toBool()); TOOLBOX_PREF_BUTTON(show_sac, show_sac, profSAC); }
void MainWindow::readSettings() { static bool firstRun = true; QSettings s; // the static object for preferences already reads in the settings // and sets up the font, so just get what we need for the toolbox and other widgets here s.beginGroup("TecDetails"); TOOLBOX_PREF_BUTTON(calcalltissues, calcalltissues, profCalcAllTissues); TOOLBOX_PREF_BUTTON(calcceiling, calcceiling, profCalcCeiling); TOOLBOX_PREF_BUTTON(dcceiling, dcceiling, profDcCeiling); TOOLBOX_PREF_BUTTON(ead, ead, profEad); TOOLBOX_PREF_BUTTON(calcceiling3m, calcceiling3m, profIncrement3m); TOOLBOX_PREF_BUTTON(mod, mod, profMod); TOOLBOX_PREF_BUTTON(calcndltts, calcndltts, profNdl_tts); TOOLBOX_PREF_BUTTON(pp_graphs.phe, phegraph, profPhe); TOOLBOX_PREF_BUTTON(pp_graphs.pn2, pn2graph, profPn2); TOOLBOX_PREF_BUTTON(pp_graphs.po2, po2graph, profPO2); TOOLBOX_PREF_BUTTON(hrgraph, hrgraph, profHR); TOOLBOX_PREF_BUTTON(rulergraph, rulergraph, profRuler); TOOLBOX_PREF_BUTTON(show_sac, show_sac, profSAC); TOOLBOX_PREF_BUTTON(show_pictures_in_profile, show_pictures_in_profile, profTogglePicture); TOOLBOX_PREF_BUTTON(tankbar, tankbar, profTankbar); TOOLBOX_PREF_BUTTON(percentagegraph, percentagegraph, profTissues); s.endGroup(); s.beginGroup("DiveComputer"); default_dive_computer_vendor = getSetting(s, "dive_computer_vendor"); default_dive_computer_product = getSetting(s, "dive_computer_product"); default_dive_computer_device = getSetting(s, "dive_computer_device"); s.endGroup(); QNetworkProxy proxy; proxy.setType(QNetworkProxy::ProxyType(prefs.proxy_type)); proxy.setHostName(prefs.proxy_host); proxy.setPort(prefs.proxy_port); if (prefs.proxy_auth) { proxy.setUser(prefs.proxy_user); proxy.setPassword(prefs.proxy_pass); } QNetworkProxy::setApplicationProxy(proxy); loadRecentFiles(&s); if (firstRun) { checkSurvey(&s); firstRun = false; } }