mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Merge pull request #3291 from Laserlicht/audio_mute_setting
audio mute on focus lost setting
This commit is contained in:
@@ -114,6 +114,8 @@
|
|||||||
"vcmi.systemOptions.enableUiEnhancementsButton.help" : "{Interface Enhancements}\n\nToggle various quality of life interface improvements. Such as a backpack button etc. Disable to have a more classic experience.",
|
"vcmi.systemOptions.enableUiEnhancementsButton.help" : "{Interface Enhancements}\n\nToggle various quality of life interface improvements. Such as a backpack button etc. Disable to have a more classic experience.",
|
||||||
"vcmi.systemOptions.enableLargeSpellbookButton.hover" : "Large Spell Book",
|
"vcmi.systemOptions.enableLargeSpellbookButton.hover" : "Large Spell Book",
|
||||||
"vcmi.systemOptions.enableLargeSpellbookButton.help" : "{Large Spell Book}\n\nEnables larger spell book that fits more spells per page. Spell book page change animation does not work with this setting enabled.",
|
"vcmi.systemOptions.enableLargeSpellbookButton.help" : "{Large Spell Book}\n\nEnables larger spell book that fits more spells per page. Spell book page change animation does not work with this setting enabled.",
|
||||||
|
"vcmi.systemOptions.audioMuteFocus.hover" : "Mute on inactivity",
|
||||||
|
"vcmi.systemOptions.audioMuteFocus.help" : "{Mute on inactivity}\n\nMute audio on inactive window focus. Exceptions are ingame messages and new turn sound.",
|
||||||
|
|
||||||
"vcmi.adventureOptions.infoBarPick.hover" : "Show Messages in Info Panel",
|
"vcmi.adventureOptions.infoBarPick.hover" : "Show Messages in Info Panel",
|
||||||
"vcmi.adventureOptions.infoBarPick.help" : "{Show Messages in Info Panel}\n\nWhenever possible, game messages from visiting map objects will be shown in the info panel, instead of popping up in a separate window.",
|
"vcmi.adventureOptions.infoBarPick.help" : "{Show Messages in Info Panel}\n\nWhenever possible, game messages from visiting map objects will be shown in the info panel, instead of popping up in a separate window.",
|
||||||
|
@@ -114,6 +114,8 @@
|
|||||||
"vcmi.systemOptions.enableUiEnhancementsButton.help" : "{Interface Verbesserungen}\n\nSchaltet verschiedene Interface Verbesserungen um. Wie z.B. ein Rucksack-Button, etc. Deaktivieren, um ein klassischeres Erlebnis zu haben.",
|
"vcmi.systemOptions.enableUiEnhancementsButton.help" : "{Interface Verbesserungen}\n\nSchaltet verschiedene Interface Verbesserungen um. Wie z.B. ein Rucksack-Button, etc. Deaktivieren, um ein klassischeres Erlebnis zu haben.",
|
||||||
"vcmi.systemOptions.enableLargeSpellbookButton.hover" : "Großes Zauberbuch",
|
"vcmi.systemOptions.enableLargeSpellbookButton.hover" : "Großes Zauberbuch",
|
||||||
"vcmi.systemOptions.enableLargeSpellbookButton.help" : "{Großes Zauberbuch}\n\nErmöglicht ein größeres Zauberbuch, in das mehr Zaubersprüche pro Seite passen. Die Animation des Seitenwechsels im Zauberbuch funktioniert nicht, wenn diese Einstellung aktiviert ist.",
|
"vcmi.systemOptions.enableLargeSpellbookButton.help" : "{Großes Zauberbuch}\n\nErmöglicht ein größeres Zauberbuch, in das mehr Zaubersprüche pro Seite passen. Die Animation des Seitenwechsels im Zauberbuch funktioniert nicht, wenn diese Einstellung aktiviert ist.",
|
||||||
|
"vcmi.systemOptions.audioMuteFocus.hover" : "Stumm bei Inaktivität",
|
||||||
|
"vcmi.systemOptions.audioMuteFocus.help" : "{Stumm bei Inaktivität}\n\nSchaltet Audio bei inaktiven Fenster-Fokus stumm. Ausnahmen sind Ingame-Nachrichten und der Neuer-Zug-Sound.",
|
||||||
|
|
||||||
"vcmi.adventureOptions.infoBarPick.hover" : "Meldungen im Infobereich anzeigen",
|
"vcmi.adventureOptions.infoBarPick.hover" : "Meldungen im Infobereich anzeigen",
|
||||||
"vcmi.adventureOptions.infoBarPick.help" : "{Meldungen im Infobereich anzeigen}\n\nWann immer möglich, werden Spielnachrichten von besuchten Kartenobjekten in der Infoleiste angezeigt, anstatt als Popup-Fenster zu erscheinen",
|
"vcmi.adventureOptions.infoBarPick.help" : "{Meldungen im Infobereich anzeigen}\n\nWann immer möglich, werden Spielnachrichten von besuchten Kartenobjekten in der Infoleiste angezeigt, anstatt als Popup-Fenster zu erscheinen",
|
||||||
|
@@ -170,7 +170,7 @@ void InputHandler::preprocessEvent(const SDL_Event & ev)
|
|||||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
|
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
|
||||||
if(settings["general"]["enableUiEnhancements"].Bool()) {
|
if(settings["general"]["audioMuteFocus"].Bool()) {
|
||||||
CCS->musich->setVolume(settings["general"]["music"].Integer());
|
CCS->musich->setVolume(settings["general"]["music"].Integer());
|
||||||
CCS->soundh->setVolume(settings["general"]["sound"].Integer());
|
CCS->soundh->setVolume(settings["general"]["sound"].Integer());
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,7 @@ void InputHandler::preprocessEvent(const SDL_Event & ev)
|
|||||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
|
boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
|
||||||
if(settings["general"]["enableUiEnhancements"].Bool()) {
|
if(settings["general"]["audioMuteFocus"].Bool()) {
|
||||||
CCS->musich->setVolume(0);
|
CCS->musich->setVolume(0);
|
||||||
CCS->soundh->setVolume(0);
|
CCS->soundh->setVolume(0);
|
||||||
}
|
}
|
||||||
|
@@ -167,6 +167,11 @@ GeneralOptionsTab::GeneralOptionsTab()
|
|||||||
setBoolSetting("gameTweaks", "enableLargeSpellbook", value);
|
setBoolSetting("gameTweaks", "enableLargeSpellbook", value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addCallback("audioMuteFocusChanged", [](bool value)
|
||||||
|
{
|
||||||
|
setBoolSetting("general", "audioMuteFocus", value);
|
||||||
|
});
|
||||||
|
|
||||||
//moved from "other" tab that is disabled for now to avoid excessible tabs with barely any content
|
//moved from "other" tab that is disabled for now to avoid excessible tabs with barely any content
|
||||||
addCallback("availableCreaturesAsDwellingChanged", [=](int value)
|
addCallback("availableCreaturesAsDwellingChanged", [=](int value)
|
||||||
{
|
{
|
||||||
@@ -215,6 +220,10 @@ GeneralOptionsTab::GeneralOptionsTab()
|
|||||||
if (enableLargeSpellbookCheckbox)
|
if (enableLargeSpellbookCheckbox)
|
||||||
enableLargeSpellbookCheckbox->setSelected(settings["gameTweaks"]["enableLargeSpellbook"].Bool());
|
enableLargeSpellbookCheckbox->setSelected(settings["gameTweaks"]["enableLargeSpellbook"].Bool());
|
||||||
|
|
||||||
|
std::shared_ptr<CToggleButton> audioMuteFocusCheckbox = widget<CToggleButton>("audioMuteFocusCheckbox");
|
||||||
|
if (audioMuteFocusCheckbox)
|
||||||
|
audioMuteFocusCheckbox->setSelected(settings["general"]["audioMuteFocus"].Bool());
|
||||||
|
|
||||||
std::shared_ptr<CSlider> musicSlider = widget<CSlider>("musicSlider");
|
std::shared_ptr<CSlider> musicSlider = widget<CSlider>("musicSlider");
|
||||||
musicSlider->scrollTo(CCS->musich->getVolume());
|
musicSlider->scrollTo(CCS->musich->getVolume());
|
||||||
|
|
||||||
|
@@ -39,7 +39,8 @@
|
|||||||
"useSavePrefix",
|
"useSavePrefix",
|
||||||
"savePrefix",
|
"savePrefix",
|
||||||
"startTurnAutosave",
|
"startTurnAutosave",
|
||||||
"enableUiEnhancements"
|
"enableUiEnhancements",
|
||||||
|
"audioMuteFocus"
|
||||||
],
|
],
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"playerName" : {
|
"playerName" : {
|
||||||
@@ -131,6 +132,10 @@
|
|||||||
"enableUiEnhancements" : {
|
"enableUiEnhancements" : {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
|
},
|
||||||
|
"audioMuteFocus" : {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -180,6 +180,28 @@
|
|||||||
"type": "labelCentered",
|
"type": "labelCentered",
|
||||||
"position": {"x": 565, "y": 158}
|
"position": {"x": 565, "y": 158}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type" : "verticalLayout",
|
||||||
|
"customType" : "labelDescription",
|
||||||
|
"position" : {"x": 415, "y": 202},
|
||||||
|
"items" : [
|
||||||
|
{
|
||||||
|
"text": "vcmi.systemOptions.audioMuteFocus.hover"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type" : "verticalLayout",
|
||||||
|
"customType" : "checkbox",
|
||||||
|
"position" : {"x": 380, "y": 200},
|
||||||
|
"items" : [
|
||||||
|
{
|
||||||
|
"name": "audioMuteFocusCheckbox",
|
||||||
|
"help": "vcmi.systemOptions.audioMuteFocus",
|
||||||
|
"callback": "audioMuteFocusChanged"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
/////////////////////////////////////// Bottom section - Towns Settings
|
/////////////////////////////////////// Bottom section - Towns Settings
|
||||||
{
|
{
|
||||||
"type" : "verticalLayout",
|
"type" : "verticalLayout",
|
||||||
|
Reference in New Issue
Block a user