mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Always center loading screen progress bar by height when there is active message box
To fix all possible situations when active message box overlaps with loading screen progress. The only used condition to center loading screen progress by height is number of message boxes > 0. No need to pass it through interface. LoadingScreen can check it inside setLabel function.
This commit is contained in:
parent
4c4218f70d
commit
3915e5d2cc
5 changed files with 8 additions and 12 deletions
|
@ -100,7 +100,7 @@ namespace MWGui
|
||||||
Log(Debug::Warning) << "Warning: no splash screens found!";
|
Log(Debug::Warning) << "Warning: no splash screens found!";
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadingScreen::setLabel(const std::string &label, bool important, bool center)
|
void LoadingScreen::setLabel(const std::string &label, bool important)
|
||||||
{
|
{
|
||||||
mImportantLabel = important;
|
mImportantLabel = important;
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ namespace MWGui
|
||||||
size.width = std::max(300, size.width);
|
size.width = std::max(300, size.width);
|
||||||
mLoadingBox->setSize(size);
|
mLoadingBox->setSize(size);
|
||||||
|
|
||||||
if (center)
|
if (MWBase::Environment::get().getWindowManager()->getMessagesCount() > 0)
|
||||||
mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mMainWidget->getHeight()/2 - mLoadingBox->getHeight()/2);
|
mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mMainWidget->getHeight()/2 - mLoadingBox->getHeight()/2);
|
||||||
else
|
else
|
||||||
mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mMainWidget->getHeight() - mLoadingBox->getHeight() - 8);
|
mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mMainWidget->getHeight() - mLoadingBox->getHeight() - 8);
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MWGui
|
||||||
virtual ~LoadingScreen();
|
virtual ~LoadingScreen();
|
||||||
|
|
||||||
/// Overridden from Loading::Listener, see the Loading::Listener documentation for usage details
|
/// Overridden from Loading::Listener, see the Loading::Listener documentation for usage details
|
||||||
void setLabel (const std::string& label, bool important, bool center) override;
|
void setLabel (const std::string& label, bool important) override;
|
||||||
void loadingOn(bool visible=true) override;
|
void loadingOn(bool visible=true) override;
|
||||||
void loadingOff() override;
|
void loadingOff() override;
|
||||||
void setProgressRange (size_t range) override;
|
void setProgressRange (size_t range) override;
|
||||||
|
|
|
@ -260,10 +260,9 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
||||||
writer.save (stream);
|
writer.save (stream);
|
||||||
|
|
||||||
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||||
int messagesCount = MWBase::Environment::get().getWindowManager()->getMessagesCount();
|
|
||||||
// Using only Cells for progress information, since they typically have the largest records by far
|
// Using only Cells for progress information, since they typically have the largest records by far
|
||||||
listener.setProgressRange(MWBase::Environment::get().getWorld()->countSavedGameCells());
|
listener.setProgressRange(MWBase::Environment::get().getWorld()->countSavedGameCells());
|
||||||
listener.setLabel("#{sNotifyMessage4}", true, messagesCount > 0);
|
listener.setLabel("#{sNotifyMessage4}", true);
|
||||||
|
|
||||||
Loading::ScopedLoad load(&listener);
|
Loading::ScopedLoad load(&listener);
|
||||||
|
|
||||||
|
@ -385,10 +384,9 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
||||||
std::map<int, int> contentFileMap = buildContentFileIndexMap (reader);
|
std::map<int, int> contentFileMap = buildContentFileIndexMap (reader);
|
||||||
|
|
||||||
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||||
int messagesCount = MWBase::Environment::get().getWindowManager()->getMessagesCount();
|
|
||||||
|
|
||||||
listener.setProgressRange(100);
|
listener.setProgressRange(100);
|
||||||
listener.setLabel("#{sLoadingMessage14}", false, messagesCount > 0);
|
listener.setLabel("#{sLoadingMessage14}");
|
||||||
|
|
||||||
Loading::ScopedLoad load(&listener);
|
Loading::ScopedLoad load(&listener);
|
||||||
|
|
||||||
|
|
|
@ -566,9 +566,8 @@ namespace MWWorld
|
||||||
|
|
||||||
Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||||
Loading::ScopedLoad load(loadingListener);
|
Loading::ScopedLoad load(loadingListener);
|
||||||
int messagesCount = MWBase::Environment::get().getWindowManager()->getMessagesCount();
|
|
||||||
std::string loadingExteriorText = "#{sLoadingMessage3}";
|
std::string loadingExteriorText = "#{sLoadingMessage3}";
|
||||||
loadingListener->setLabel(loadingExteriorText, false, messagesCount > 0);
|
loadingListener->setLabel(loadingExteriorText);
|
||||||
loadingListener->setProgressRange(refsToLoad);
|
loadingListener->setProgressRange(refsToLoad);
|
||||||
|
|
||||||
const auto getDistanceToPlayerCell = [&] (const std::pair<int, int>& cellPosition)
|
const auto getDistanceToPlayerCell = [&] (const std::pair<int, int>& cellPosition)
|
||||||
|
@ -798,9 +797,8 @@ namespace MWWorld
|
||||||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0.5);
|
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0.5);
|
||||||
|
|
||||||
Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||||
int messagesCount = MWBase::Environment::get().getWindowManager()->getMessagesCount();
|
|
||||||
std::string loadingInteriorText = "#{sLoadingMessage2}";
|
std::string loadingInteriorText = "#{sLoadingMessage2}";
|
||||||
loadingListener->setLabel(loadingInteriorText, false, messagesCount > 0);
|
loadingListener->setLabel(loadingInteriorText);
|
||||||
Loading::ScopedLoad load(loadingListener);
|
Loading::ScopedLoad load(loadingListener);
|
||||||
|
|
||||||
if(mCurrentCell != nullptr && *mCurrentCell == *cell)
|
if(mCurrentCell != nullptr && *mCurrentCell == *cell)
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Loading
|
||||||
/// @note "non-important" labels may not show on screen if the loading process went so fast
|
/// @note "non-important" labels may not show on screen if the loading process went so fast
|
||||||
/// that the implementation decided not to show a loading screen at all. "important" labels
|
/// that the implementation decided not to show a loading screen at all. "important" labels
|
||||||
/// will show in a separate message-box if the loading screen was not shown.
|
/// will show in a separate message-box if the loading screen was not shown.
|
||||||
virtual void setLabel (const std::string& label, bool important=false, bool center=false) {}
|
virtual void setLabel (const std::string& label, bool important=false) {}
|
||||||
|
|
||||||
/// Start a loading sequence. Must call loadingOff() when done.
|
/// Start a loading sequence. Must call loadingOff() when done.
|
||||||
/// @note To get the loading screen to actually update, you must call setProgress / increaseProgress periodically.
|
/// @note To get the loading screen to actually update, you must call setProgress / increaseProgress periodically.
|
||||||
|
|
Loading…
Reference in a new issue