From d08336e59b971094c467d4e64efc265dbefdf5a5 Mon Sep 17 00:00:00 2001 From: Stefan Hacker Date: Sat, 13 Jun 2015 04:13:59 +0200 Subject: [PATCH] Add capability to trigger restart to ConfigDialog With this patch ConfigWidgets can set the new requireRestartToApply variable to true to cause the ConfigDialog to ask the user wheter he wants to restart to apply the settings immediatly. If the user agrees we exit the event loop with the special MUMBLE_EXIT_CODE_RESTART causing a relaunch of the client and safe application of the new settings. --- src/mumble/ConfigDialog.cpp | 9 +++++++++ src/mumble/Settings.cpp | 2 ++ src/mumble/Settings.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/mumble/ConfigDialog.cpp b/src/mumble/ConfigDialog.cpp index 698bce12f..216882be6 100644 --- a/src/mumble/ConfigDialog.cpp +++ b/src/mumble/ConfigDialog.cpp @@ -215,6 +215,15 @@ void ConfigDialog::apply() { foreach(ConfigWidget *cw, qmWidgets) cw->accept(); + + if (g.s.requireRestartToApply && QMessageBox::question( + this, + tr("Restart Mumble?"), + tr("Some settings will only apply after a restart of Mumble. Restart Mumble now?"), + QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { + + qApp->exit(MUMBLE_EXIT_CODE_RESTART); + } if (!g.s.bAttenuateOthersOnTalk) g.bAttenuateOthers = false; diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp index e1b96ff4e..2c0c43b85 100644 --- a/src/mumble/Settings.cpp +++ b/src/mumble/Settings.cpp @@ -404,6 +404,8 @@ Settings::Settings() { #endif dPacketLoss = 0; dMaxPacketDelay = 0.0f; + + requireRestartToApply = false; iMaxLogBlocks = 0; diff --git a/src/mumble/Settings.h b/src/mumble/Settings.h index e09be2caf..56ee43822 100644 --- a/src/mumble/Settings.h +++ b/src/mumble/Settings.h @@ -338,6 +338,8 @@ struct Settings { LoopMode lmLoopMode; float dPacketLoss; float dMaxPacketDelay; + /// If true settings in this structure require a client restart to apply fully + bool requireRestartToApply; bool doEcho() const; bool doPositionalAudio() const;