diff --git a/client/renderSDL/ScreenHandler.cpp b/client/renderSDL/ScreenHandler.cpp index 7c700bad8..ed0e73e1a 100644 --- a/client/renderSDL/ScreenHandler.cpp +++ b/client/renderSDL/ScreenHandler.cpp @@ -212,6 +212,11 @@ ScreenHandler::ScreenHandler() else SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight"); +#ifdef VCMI_IOS + if(!settings["general"]["ignoreMuteSwitch"].Bool()) + SDL_SetHint(SDL_HINT_AUDIO_CATEGORY, "AVAudioSessionCategoryAmbient"); +#endif + if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_GAMECONTROLLER)) { logGlobal->error("Something was wrong: %s", SDL_GetError()); diff --git a/config/schemas/settings.json b/config/schemas/settings.json index 48f54b315..f89d64dc4 100644 --- a/config/schemas/settings.json +++ b/config/schemas/settings.json @@ -45,7 +45,8 @@ "audioMuteFocus", "enableOverlay", "lastKindomInterface", - "enableSubtitle" + "enableSubtitle", + "ignoreMuteSwitch" ], "properties" : { "playerName" : { @@ -161,6 +162,10 @@ "enableSubtitle" : { "type": "boolean", "default": true + }, + "ignoreMuteSwitch" : { + "type": "boolean", + "default": true } } }, diff --git a/launcher/settingsView/csettingsview_moc.cpp b/launcher/settingsView/csettingsview_moc.cpp index c1cb1cbb5..f921f73fb 100644 --- a/launcher/settingsView/csettingsview_moc.cpp +++ b/launcher/settingsView/csettingsview_moc.cpp @@ -130,6 +130,10 @@ void CSettingsView::loadSettings() ui->labelHandleBackRightMouseButton->hide(); ui->buttonAllowPortrait->hide(); ui->labelAllowPortrait->hide(); +#endif +#ifndef VCMI_IOS + ui->labelIgnoreMuteSwitch->hide(); + ui->buttonIgnoreMuteSwitch->hide(); #endif fillValidScalingRange(); @@ -224,6 +228,8 @@ void CSettingsView::loadToggleButtonSettings() setCheckbuttonState(ui->buttonHandleBackRightMouseButton, settings["input"]["handleBackRightMouseButton"].Bool()); + setCheckbuttonState(ui->buttonIgnoreMuteSwitch, settings["general"]["ignoreMuteSwitch"].Bool()); + std::string cursorType = settings["video"]["cursor"].String(); int cursorTypeIndex = vstd::find_pos(cursorTypesList, cursorType); setCheckbuttonState(ui->buttonCursorType, cursorTypeIndex); @@ -866,3 +872,9 @@ void CSettingsView::on_buttonHandleBackRightMouseButton_toggled(bool checked) updateCheckbuttonText(ui->buttonHandleBackRightMouseButton); } +void CSettingsView::on_buttonIgnoreMuteSwitch_toggled(bool checked) +{ + Settings node = settings.write["general"]["ignoreMuteSwitch"]; + node->Bool() = checked; + updateCheckbuttonText(ui->buttonIgnoreMuteSwitch); +} diff --git a/launcher/settingsView/csettingsview_moc.h b/launcher/settingsView/csettingsview_moc.h index a8cebead3..866a67886 100644 --- a/launcher/settingsView/csettingsview_moc.h +++ b/launcher/settingsView/csettingsview_moc.h @@ -91,18 +91,13 @@ private slots: void on_buttonFontScalable_clicked(bool checked); void on_buttonFontOriginal_clicked(bool checked); - void on_buttonValidationOff_clicked(bool checked); - void on_buttonValidationBasic_clicked(bool checked); - void on_buttonValidationFull_clicked(bool checked); - void on_sliderScalingCursor_valueChanged(int value); - void on_buttonScalingAuto_toggled(bool checked); - void on_buttonHandleBackRightMouseButton_toggled(bool checked); + void on_buttonIgnoreMuteSwitch_toggled(bool checked); private: Ui::CSettingsView * ui; diff --git a/launcher/settingsView/csettingsview_moc.ui b/launcher/settingsView/csettingsview_moc.ui index 590ed4515..a7a918973 100644 --- a/launcher/settingsView/csettingsview_moc.ui +++ b/launcher/settingsView/csettingsview_moc.ui @@ -69,7 +69,7 @@ - + Mods Validation @@ -105,7 +105,7 @@ - + 500 @@ -133,7 +133,7 @@ - + Reset @@ -147,7 +147,7 @@ - + 500 @@ -172,7 +172,7 @@ - + true @@ -239,7 +239,7 @@ - + true @@ -268,14 +268,14 @@ - + Haptic Feedback - + Touch Tap Tolerance @@ -288,7 +288,7 @@ - + 1024 @@ -301,7 +301,7 @@ - + true @@ -326,7 +326,7 @@ - + @@ -379,7 +379,7 @@ - + VCAI @@ -396,7 +396,7 @@ - + @@ -406,7 +406,7 @@ - + VCAI @@ -430,7 +430,7 @@ - + @@ -445,7 +445,7 @@ - + Default repository @@ -471,7 +471,7 @@ - + Relative Pointer Speed @@ -485,7 +485,7 @@ - + true @@ -588,7 +588,7 @@ - + @@ -607,21 +607,21 @@ - + Refresh now - + Adventure Map Allies - + Neutral AI in battles @@ -659,7 +659,7 @@ - + @@ -673,7 +673,7 @@ - + Use Relative Pointer Mode @@ -683,14 +683,14 @@ - + Autocombat AI in battles - + true @@ -715,7 +715,7 @@ - + @@ -737,7 +737,7 @@ - + @@ -768,7 +768,7 @@ - + Additional repository @@ -791,7 +791,7 @@ - + Adventure Map Enemies @@ -819,7 +819,7 @@ - + @@ -853,7 +853,7 @@ - + @@ -876,28 +876,28 @@ - + Online Lobby address - + Online Lobby port - + Controller Click Tolerance - + BattleAI @@ -933,7 +933,7 @@ - + Ignore SSL errors @@ -943,14 +943,14 @@ - + Show Tutorial again - + Sticks Acceleration @@ -972,7 +972,7 @@ - + false @@ -1006,21 +1006,21 @@ - + Mouse Click Tolerance - + Handle back as right mouse button - + @@ -1036,7 +1036,7 @@ - + Enemy AI in battles @@ -1050,7 +1050,7 @@ - + 0 @@ -1092,7 +1092,7 @@ - + false @@ -1112,7 +1112,7 @@ - + @@ -1164,7 +1164,7 @@ - + @@ -1179,7 +1179,7 @@ - + @@ -1194,7 +1194,7 @@ - + 100 @@ -1266,21 +1266,21 @@ Fullscreen Exclusive Mode - the game will cover the entirety of your screen and - + Long Touch Duration - + Check on startup - + 0 @@ -1324,7 +1324,7 @@ Fullscreen Exclusive Mode - the game will cover the entirety of your screen and - + 100 @@ -1366,7 +1366,7 @@ Fullscreen Exclusive Mode - the game will cover the entirety of your screen and - + 0 @@ -1439,7 +1439,7 @@ Fullscreen Exclusive Mode - the game will cover the entirety of your screen and - + Sticks Sensitivity @@ -1470,7 +1470,7 @@ Fullscreen Exclusive Mode - the game will cover the entirety of your screen and - + true @@ -1495,6 +1495,26 @@ Fullscreen Exclusive Mode - the game will cover the entirety of your screen and + + + + Ignore mute switch + + + + + + + + 0 + 0 + + + + true + + +