void radeon_profile::closeEvent(QCloseEvent *e) { if (ui->cb_closeTray->isChecked() && !closeFromTrayMenu) { this->hide(); e->ignore(); return; } timer->stop(); saveConfig(); if (device.features.pwmAvailable) { device.setPwmManualControl(false); saveFanProfiles(); } QCoreApplication::processEvents(QEventLoop::AllEvents, 50); // Wait for the daemon to disable pwm QApplication::quit(); }
void radeon_profile::saveConfig() { { // If settingsPath doesn't exist yet, running QSetting's destructor will create it. // It's important that happens before saving auxstuff later-on. QSettings settings(settingsPath,QSettings::IniFormat); settings.setValue("startMinimized",ui->cb_startMinimized->isChecked()); settings.setValue("minimizeToTray",ui->cb_minimizeTray->isChecked()); settings.setValue("closeToTray",ui->cb_closeTray->isChecked()); settings.setValue("updateInterval",ui->spin_timerInterval->value()); settings.setValue("updateGraphs",ui->cb_graphs->isChecked()); settings.setValue("saveWindowGeometry",ui->cb_saveWindowGeometry->isChecked()); settings.setValue("windowGeometry",this->geometry()); settings.setValue("powerLevelStatistics", ui->cb_stats->isChecked()); settings.setValue("aleternateRowColors",ui->cb_alternateRow->isChecked()); settings.setValue("graphOffset", ui->cb_plotsRightGap->isChecked()); settings.setValue("graphRange",ui->slider_timeRange->value()); settings.setValue("showLegend",ui->cb_showLegends->isChecked()); settings.setValue("plotsBackgroundColor", ui->frame_plotsBackground->palette().background().color().name()); settings.setValue("setCommonPlotsBg", ui->cb_overridePlotsBg->isChecked()); settings.setValue("daemonAutoRefresh",ui->cb_daemonAutoRefresh->isChecked()); settings.setValue("fanSpeedSlider",ui->slider_fanSpeed->value()); settings.setValue("saveSelectedFanMode",ui->cb_saveFanMode->isChecked()); settings.setValue("fanMode",ui->stack_fanModes->currentIndex()); settings.setValue("fanProfileName",ui->l_currentFanProfile->text()); settings.setValue("restorePercentOverclock", ui->cb_restorePercentOc->isChecked()); settings.setValue("overclockValue", ui->slider_ocSclk->value()); settings.setValue("overclockMemValue", ui->slider_ocMclk->value()); settings.setValue("ocProfileName", ui->l_currentOcProfile->text()); settings.setValue("restoreOcProfile", ui->cb_restoreOcProfile->isChecked()); settings.setValue("execDbcAction",ui->cb_execDbcAction->currentIndex()); settings.setValue("appendSysEnv",ui->cb_execSysEnv->isChecked()); settings.setValue("eventsTracking", ui->cb_eventsTracking->isChecked()); settings.setValue("daemonData", ui->cb_daemonData->isChecked()); settings.setValue("temperatureHysteresis", ui->spin_hysteresis->value()); } QString xmlString; QXmlStreamWriter xml(&xmlString); xml.setAutoFormatting(true); xml.writeStartDocument(); xml.writeStartElement("auxStuff"); saveRpevents(xml); saveExecProfiles(xml); saveFanProfiles(xml); savePlotSchemas(xml); saveTopbarItemsSchemas(xml); saveOcProfiles(xml); xml.writeEndElement(); xml.writeEndDocument(); QFile f(auxStuffPath); if (f.open(QIODevice::WriteOnly)) { f.write(xmlString.toLatin1()); f.close(); } if (loadedFromLegacy) { QFile::remove(legacySettingsPath); QFile::remove(legacyAuxStuffPath); loadedFromLegacy = false; } }