Add config options for disabling specific overlay helpers.

This adds hidden config options for disabling arch-specific
overlay helpers.

This is useful for people that only want the overlay for a
specific architecture, and also for debugging and troubleshooting
arch-specific overlay problems.
This commit is contained in:
Mikkel Krautz 2015-02-22 11:07:12 +01:00
parent bb0ccc4629
commit b1880294df
4 changed files with 31 additions and 6 deletions

View File

@ -72,7 +72,6 @@ static bool canRun64BitPrograms() {
}
OverlayPrivateWin::OverlayPrivateWin(QObject *p) : OverlayPrivate(p) {
m_allow64bit = canRun64BitPrograms();
m_active = false;
m_helper_exe_path = QString::fromLatin1("%1/mumble_ol.exe").arg(qApp->applicationDirPath());
@ -92,6 +91,11 @@ OverlayPrivateWin::OverlayPrivateWin(QObject *p) : OverlayPrivate(p) {
m_helper_restart_timer->setSingleShot(true);
connect(m_helper_restart_timer, SIGNAL(timeout()), this, SLOT(onDelayedRestartTimerTriggered()));
if (!g.s.bOverlayWinHelperX86Enable) {
qWarning("OverlayPrivateWin: mumble_ol.exe (32-bit overlay helper) disabled via 'overlay_win/enable_x86_helper' config option.");
m_helper_enabled = false;
}
m_helper64_exe_path = QString::fromLatin1("%1/mumble_ol_x64.exe").arg(qApp->applicationDirPath());
m_helper64_exe_args = m_helper_exe_args;
m_helper64_process = new QProcess(this);
@ -108,6 +112,14 @@ OverlayPrivateWin::OverlayPrivateWin(QObject *p) : OverlayPrivate(p) {
m_helper64_restart_timer = new QTimer(this);
m_helper64_restart_timer->setSingleShot(true);
connect(m_helper64_restart_timer, SIGNAL(timeout()), this, SLOT(onDelayedRestartTimerTriggered()));
if (!canRun64BitPrograms()) {
qWarning("OverlayPrivateWin: mumble_ol_x64.exe (64-bit overlay helper) disabled because the host is not x64 capable.");
m_helper64_enabled = false;
} else if (!g.s.bOverlayWinHelperX64Enable) {
qWarning("OverlayPrivateWin: mumble_ol_x64.exe (64-bit overlay helper) disabled via 'overlay_win/enable_x64_helper' config option.");
m_helper64_enabled = false;
}
}
OverlayPrivateWin::~OverlayPrivateWin() {
@ -133,13 +145,17 @@ void OverlayPrivateWin::setActive(bool active) {
m_active = active;
if (m_active) {
startHelper(m_helper_process);
if (m_allow64bit) {
if (m_helper_enabled) {
startHelper(m_helper_process);
}
if (m_helper64_enabled) {
startHelper(m_helper64_process);
}
} else {
m_helper_process->terminate();
if (m_allow64bit) {
if (m_helper_enabled) {
m_helper_process->terminate();
}
if (m_helper64_enabled) {
m_helper64_process->terminate();
}
}

View File

@ -62,15 +62,16 @@ class OverlayPrivateWin : public OverlayPrivate {
QStringList m_helper_exe_args;
QElapsedTimer m_helper_start_time;
QTimer *m_helper_restart_timer;
bool m_helper_enabled;
QProcess *m_helper64_process;
QString m_helper64_exe_path;
QStringList m_helper64_exe_args;
QElapsedTimer m_helper64_start_time;
QTimer *m_helper64_restart_timer;
bool m_helper64_enabled;
bool m_active;
bool m_allow64bit;
void startHelper(QProcess *helper);
};

View File

@ -347,6 +347,8 @@ Settings::Settings() {
// OverlayPrivateWin
iOverlayWinHelperRestartCooldownMsec = 10000;
bOverlayWinHelperX86Enable = true;
bOverlayWinHelperX64Enable = true;
iLCDUserViewMinColWidth = 50;
iLCDUserViewSplitterWidth = 2;
@ -702,6 +704,8 @@ void Settings::load(QSettings* settings_ptr) {
// OverlayPrivateWin
SAVELOAD(iOverlayWinHelperRestartCooldownMsec, "overlay_win/helper/restart_cooldown_msec");
SAVELOAD(bOverlayWinHelperX86Enable, "overlay_win/helper/x86/enable");
SAVELOAD(bOverlayWinHelperX64Enable, "overlay_win/helper/x64/enable");
// LCD
SAVELOAD(iLCDUserViewMinColWidth, "lcd/userview/mincolwidth");
@ -997,6 +1001,8 @@ void Settings::save() {
// OverlayPrivateWin
SAVELOAD(iOverlayWinHelperRestartCooldownMsec, "overlay_win/helper/restart_cooldown_msec");
SAVELOAD(bOverlayWinHelperX86Enable, "overlay_win/helper/x86/enable");
SAVELOAD(bOverlayWinHelperX64Enable, "overlay_win/helper/x64/enable");
// LCD
SAVELOAD(iLCDUserViewMinColWidth, "lcd/userview/mincolwidth");

View File

@ -231,6 +231,8 @@ struct Settings {
OverlaySettings os;
int iOverlayWinHelperRestartCooldownMsec;
bool bOverlayWinHelperX86Enable;
bool bOverlayWinHelperX64Enable;
int iLCDUserViewMinColWidth;
int iLCDUserViewSplitterWidth;