UI: Add option to disable aero on windows vista/7

On windows vista/7, you cannot really use display capture efficiently
without disabling aero, so this will add an option to settings to allow
it to be disabled and cause it to be disabled on startup.
This commit is contained in:
jp9000
2015-05-25 01:37:13 -07:00
parent 0c631db046
commit e7eaa268e5
4 changed files with 76 additions and 3 deletions

View File

@@ -187,6 +187,13 @@ static CodecDesc GetDefaultCodecDesc(const ff_format_desc *formatDesc,
id);
}
#ifdef _WIN32
void OBSBasicSettings::ToggleDisableAero(bool checked)
{
SetAeroEnabled(!checked);
}
#endif
void OBSBasicSettings::HookWidget(QWidget *widget, const char *signal,
const char *slot)
{
@@ -308,6 +315,22 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->colorSpace, COMBO_CHANGED, ADV_CHANGED);
HookWidget(ui->colorRange, COMBO_CHANGED, ADV_CHANGED);
#ifdef _WIN32
uint32_t winVer = GetWindowsVersion();
if (winVer > 0 && winVer < 0x602) {
toggleAero = new QCheckBox(
QTStr("Basic.Settings.Video.DisableAero"),
this);
QFormLayout *videoLayout =
reinterpret_cast<QFormLayout*>(ui->videoPage->layout());
videoLayout->addRow(nullptr, toggleAero);
HookWidget(toggleAero, CHECK_CHANGED, VIDEO_CHANGED);
connect(toggleAero, &QAbstractButton::toggled,
this, &OBSBasicSettings::ToggleDisableAero);
}
#endif
//Apply button disabled until change.
EnableApplyButton(false);
@@ -871,6 +894,16 @@ void OBSBasicSettings::LoadVideoSettings()
LoadFPSData();
LoadDownscaleFilters();
#ifdef _WIN32
if (toggleAero) {
bool disableAero = config_get_bool(main->Config(), "Video",
"DisableAero");
toggleAero->setChecked(disableAero);
aeroWasDisabled = disableAero;
}
#endif
loading = false;
}
@@ -1827,6 +1860,13 @@ void OBSBasicSettings::SaveVideoSettings()
SaveSpinBox(ui->fpsNumerator, "Video", "FPSNum");
SaveSpinBox(ui->fpsDenominator, "Video", "FPSDen");
SaveComboData(ui->downscaleFilter, "Video", "ScaleType");
#ifdef _WIN32
if (toggleAero) {
SaveCheckBox(toggleAero, "Video", "DisableAero");
aeroWasDisabled = toggleAero->isChecked();
}
#endif
}
void OBSBasicSettings::SaveAdvancedSettings()
@@ -2098,12 +2138,17 @@ bool OBSBasicSettings::QueryChanges()
QMessageBox::Yes | QMessageBox::No |
QMessageBox::Cancel);
if (button == QMessageBox::Cancel)
if (button == QMessageBox::Cancel) {
return false;
else if (button == QMessageBox::Yes)
} else if (button == QMessageBox::Yes) {
SaveSettings();
else
} else {
LoadSettings(true);
#ifdef _WIN32
if (toggleAero)
SetAeroEnabled(!aeroWasDisabled);
#endif
}
ClearChanged();
return true;