1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-25 07:44:08 +00:00

Downgrade Settings GUI mode to a modal (bug #6758)

This commit is contained in:
Alexei Kotov 2024-01-02 21:53:00 +03:00
parent 19a6fd4e1b
commit 7310418984
10 changed files with 20 additions and 8 deletions

View File

@ -39,6 +39,7 @@
Bug #6661: Saved games that have no preview screenshot cause issues or crashes Bug #6661: Saved games that have no preview screenshot cause issues or crashes
Bug #6716: mwscript comparison operator handling is too restrictive Bug #6716: mwscript comparison operator handling is too restrictive
Bug #6754: Beast to Non-beast transformation mod is not working on OpenMW Bug #6754: Beast to Non-beast transformation mod is not working on OpenMW
Bug #6758: Main menu background video can be stopped by opening the options menu
Bug #6807: Ultimate Galleon is not working properly Bug #6807: Ultimate Galleon is not working properly
Bug #6893: Lua: Inconsistent behavior with actors affected by Disable and SetDelete commands Bug #6893: Lua: Inconsistent behavior with actors affected by Disable and SetDelete commands
Bug #6894: Added item combines with equipped stack instead of creating a new unequipped stack Bug #6894: Added item combines with equipped stack instead of creating a new unequipped stack

View File

@ -77,6 +77,7 @@ namespace MWGui
class JailScreen; class JailScreen;
class MessageBox; class MessageBox;
class PostProcessorHud; class PostProcessorHud;
class SettingsWindow;
enum ShowInDialogueMode enum ShowInDialogueMode
{ {
@ -156,6 +157,7 @@ namespace MWBase
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0; virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
virtual MWGui::TradeWindow* getTradeWindow() = 0; virtual MWGui::TradeWindow* getTradeWindow() = 0;
virtual MWGui::PostProcessorHud* getPostProcessorHud() = 0; virtual MWGui::PostProcessorHud* getPostProcessorHud() = 0;
virtual MWGui::SettingsWindow* getSettingsWindow() = 0;
/// Make the player use an item, while updating GUI state accordingly /// Make the player use an item, while updating GUI state accordingly
virtual void useItem(const MWWorld::Ptr& item, bool force = false) = 0; virtual void useItem(const MWWorld::Ptr& item, bool force = false) = 0;

View File

@ -18,6 +18,7 @@
#include "backgroundimage.hpp" #include "backgroundimage.hpp"
#include "confirmationdialog.hpp" #include "confirmationdialog.hpp"
#include "savegamedialog.hpp" #include "savegamedialog.hpp"
#include "settingswindow.hpp"
#include "videowidget.hpp" #include "videowidget.hpp"
namespace MWGui namespace MWGui
@ -97,7 +98,9 @@ namespace MWGui
winMgr->removeGuiMode(GM_MainMenu); winMgr->removeGuiMode(GM_MainMenu);
} }
else if (name == "options") else if (name == "options")
winMgr->pushGuiMode(GM_Settings); {
winMgr->getSettingsWindow()->setVisible(true);
}
else if (name == "credits") else if (name == "credits")
winMgr->playVideo("mw_credits.bik", true); winMgr->playVideo("mw_credits.bik", true);
else if (name == "exitgame") else if (name == "exitgame")

View File

@ -6,7 +6,6 @@ namespace MWGui
enum GuiMode enum GuiMode
{ {
GM_None, GM_None,
GM_Settings, // Settings window
GM_Inventory, // Inventory mode GM_Inventory, // Inventory mode
GM_Container, GM_Container,
GM_Companion, GM_Companion,

View File

@ -240,7 +240,7 @@ namespace MWGui
} }
SettingsWindow::SettingsWindow() SettingsWindow::SettingsWindow()
: WindowBase("openmw_settings_window.layout") : WindowModal("openmw_settings_window.layout")
, mKeyboardMode(true) , mKeyboardMode(true)
, mCurrentPage(-1) , mCurrentPage(-1)
{ {
@ -450,7 +450,7 @@ namespace MWGui
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender) void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
{ {
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Settings); setVisible(false);
} }
void SettingsWindow::onResolutionSelected(MyGUI::ListBox* _sender, size_t index) void SettingsWindow::onResolutionSelected(MyGUI::ListBox* _sender, size_t index)
@ -1041,6 +1041,8 @@ namespace MWGui
void SettingsWindow::onOpen() void SettingsWindow::onOpen()
{ {
WindowModal::onOpen();
highlightCurrentResolution(); highlightCurrentResolution();
updateControlsBox(); updateControlsBox();
updateLightSettings(); updateLightSettings();

View File

@ -7,7 +7,7 @@
namespace MWGui namespace MWGui
{ {
class SettingsWindow : public WindowBase class SettingsWindow : public WindowModal
{ {
public: public:
SettingsWindow(); SettingsWindow();

View File

@ -408,7 +408,6 @@ namespace MWGui
mSettingsWindow = settingsWindow.get(); mSettingsWindow = settingsWindow.get();
mWindows.push_back(std::move(settingsWindow)); mWindows.push_back(std::move(settingsWindow));
trackWindow(mSettingsWindow, makeSettingsWindowSettingValues()); trackWindow(mSettingsWindow, makeSettingsWindowSettingValues());
mGuiModeStates[GM_Settings] = GuiModeState(mSettingsWindow);
auto confirmationDialog = std::make_unique<ConfirmationDialog>(); auto confirmationDialog = std::make_unique<ConfirmationDialog>();
mConfirmationDialog = confirmationDialog.get(); mConfirmationDialog = confirmationDialog.get();
@ -1475,6 +1474,10 @@ namespace MWGui
{ {
return mPostProcessorHud; return mPostProcessorHud;
} }
MWGui::SettingsWindow* WindowManager::getSettingsWindow()
{
return mSettingsWindow;
}
void WindowManager::useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions) void WindowManager::useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions)
{ {

View File

@ -182,6 +182,7 @@ namespace MWGui
MWGui::ConfirmationDialog* getConfirmationDialog() override; MWGui::ConfirmationDialog* getConfirmationDialog() override;
MWGui::TradeWindow* getTradeWindow() override; MWGui::TradeWindow* getTradeWindow() override;
MWGui::PostProcessorHud* getPostProcessorHud() override; MWGui::PostProcessorHud* getPostProcessorHud() override;
MWGui::SettingsWindow* getSettingsWindow() override;
/// Make the player use an item, while updating GUI state accordingly /// Make the player use an item, while updating GUI state accordingly
void useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions = false) override; void useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions = false) override;

View File

@ -13,6 +13,8 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwgui/settingswindow.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "actions.hpp" #include "actions.hpp"
@ -156,7 +158,7 @@ namespace MWInput
// Don't trigger any mouse bindings while in settings menu, otherwise rebinding controls becomes impossible // Don't trigger any mouse bindings while in settings menu, otherwise rebinding controls becomes impossible
// Also do not trigger bindings when input controls are disabled, e.g. during save loading // Also do not trigger bindings when input controls are disabled, e.g. during save loading
if (MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Settings if (!MWBase::Environment::get().getWindowManager()->getSettingsWindow()->isVisible()
&& !input->controlsDisabled()) && !input->controlsDisabled())
mBindingsManager->mousePressed(arg, id); mBindingsManager->mousePressed(arg, id);
} }

View File

@ -47,7 +47,6 @@ namespace MWLua
} }
const std::unordered_map<MWGui::GuiMode, std::string_view> modeToName{ const std::unordered_map<MWGui::GuiMode, std::string_view> modeToName{
{ MWGui::GM_Settings, "SettingsMenu" },
{ MWGui::GM_Inventory, "Interface" }, { MWGui::GM_Inventory, "Interface" },
{ MWGui::GM_Container, "Container" }, { MWGui::GM_Container, "Container" },
{ MWGui::GM_Companion, "Companion" }, { MWGui::GM_Companion, "Companion" },