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.
This commit is contained in:
Stefan Hacker 2015-06-13 04:13:59 +02:00
parent c431d376f8
commit d08336e59b
3 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -404,6 +404,8 @@ Settings::Settings() {
#endif
dPacketLoss = 0;
dMaxPacketDelay = 0.0f;
requireRestartToApply = false;
iMaxLogBlocks = 0;

View File

@ -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;