Fix High Resolution Control File Location. Now in Oscar Data Folder, was outside.

This commit is contained in:
LoudSnorer 2024-03-07 16:50:36 -05:00
parent 98403d4dc3
commit 9d78bab20c
3 changed files with 10 additions and 9 deletions

View File

@ -44,7 +44,7 @@ namespace HighResolution {
} }
HiResolutionMode setHiResolutionMode(HiResolutionMode value) { HiResolutionMode setHiResolutionMode(HiResolutionMode value) {
QString filename = GetAppData() + HI_RES_FILENAME; QString filename = GetAppData() + QDir::separator() + HI_RES_FILENAME;
if (value == HRM_ENABLED ) { if (value == HRM_ENABLED ) {
writeMode( filename , HRM_ENABLED ,"HiResolutionMode Enabled"); writeMode( filename , HRM_ENABLED ,"HiResolutionMode Enabled");
return HRM_ENABLED; return HRM_ENABLED;
@ -55,22 +55,22 @@ namespace HighResolution {
} }
HiResolutionMode getHiResolutionMode() { HiResolutionMode getHiResolutionMode() {
QString filename = GetAppData() + HI_RES_FILENAME; QString filename = GetAppData() + QDir::separator() + HI_RES_FILENAME;
int hiResMode= readMode( filename ); int hiResMode= readMode( filename );
return (hiResMode == HRM_ENABLED ) ? HRM_ENABLED : HRM_DISABLED ; return (hiResMode == HRM_ENABLED ) ? HRM_ENABLED : HRM_DISABLED ;
} }
// this function is used to control the text name of the high resolution preference checkbox. // this function is used to control the text name of the high resolution preference checkbox.
void checkBox(bool set,QCheckBox* button) { bool checkBox(bool set,QCheckBox* button) {
if (set) { if (set) {
hiResolutionNextSessionMode = button->isChecked()? HRM_ENABLED : HRM_DISABLED ; hiResolutionNextSessionMode = button->isChecked()? HRM_ENABLED : HRM_DISABLED ;
setHiResolutionMode(hiResolutionNextSessionMode); setHiResolutionMode(hiResolutionNextSessionMode);
if ( hiResolutionOperaingMode != hiResolutionNextSessionMode ) { if ( hiResolutionOperaingMode != hiResolutionNextSessionMode ) {
QMessageBox::information(nullptr, QString msg = QString("%1\n%2").arg(QObject::tr("High Resolution Mode change will take effect when OSCAR is restarted."))
STR_MessageBox_Information, .arg(QObject::tr("Restart Oscar now?") );
QObject::tr("High Resolution Mode change will take effect when OSCAR is restarted.")); return QMessageBox::question(nullptr, STR_MessageBox_Question, msg, QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes;
} }
return; return false;
} }
QString label; QString label;
if (hiResolutionNextSessionMode == HRM_ENABLED ) { if (hiResolutionNextSessionMode == HRM_ENABLED ) {
@ -89,6 +89,7 @@ namespace HighResolution {
button->setChecked(false); button->setChecked(false);
} }
button->setText(label); button->setText(label);
return false;
} }
// These functions are for main.cpp // These functions are for main.cpp

View File

@ -19,7 +19,7 @@ namespace HighResolution {
void display(bool); void display(bool);
// used by preferences // used by preferences
void checkBox(bool set,QCheckBox* button); bool checkBox(bool set,QCheckBox* button);
} }
#endif // HIGHRESOLUTION_H #endif // HIGHRESOLUTION_H

View File

@ -865,7 +865,7 @@ bool PreferencesDialog::Save()
bool clicicalModeChanged = profile->cpap->clinicalMode() != ui->clinicalMode->isChecked() ; bool clicicalModeChanged = profile->cpap->clinicalMode() != ui->clinicalMode->isChecked() ;
p_profile->cpap->setClinicalMode(ui->clinicalMode->isChecked()); p_profile->cpap->setClinicalMode(ui->clinicalMode->isChecked());
HighResolution::checkBox(true,ui->highResolution); needs_restart |= HighResolution::checkBox(true,ui->highResolution);
if (ui->alternatingColorsCombo->currentIndex() != AppSetting->alternatingColorsCombo()) { if (ui->alternatingColorsCombo->currentIndex() != AppSetting->alternatingColorsCombo()) {
AppSetting->setAlternatingColorsCombo(ui->alternatingColorsCombo->currentIndex()); AppSetting->setAlternatingColorsCombo(ui->alternatingColorsCombo->currentIndex());