Center progress bar when there are active messageboxes (bug #4691)

pull/1993/head
Andrei Kortunov 6 years ago
parent 9f4892ce92
commit 6e05853478

@ -147,6 +147,7 @@
Bug #4684: Spell Absorption is additive
Bug #4685: Missing sound causes an exception inside Say command
Bug #4689: Default creature soundgen entries are not used
Bug #4691: Loading bar for cell should be moved up when text is still active at bottom of screen
Feature #912: Editor: Add missing icons to UniversalId tables
Feature #1221: Editor: Creature/NPC rendering
Feature #1617: Editor: Enchantment effect record verifier

@ -285,6 +285,8 @@ namespace MWBase
virtual void setEnemy (const MWWorld::Ptr& enemy) = 0;
virtual int getMessagesCount() const = 0;
virtual const Translation::Storage& getTranslationDataStorage() const = 0;
/// Warning: do not use MyGUI::InputManager::setKeyFocusWidget directly. Instead use this.

@ -96,7 +96,7 @@ namespace MWGui
Log(Debug::Warning) << "Warning: no splash screens found!";
}
void LoadingScreen::setLabel(const std::string &label, bool important)
void LoadingScreen::setLabel(const std::string &label, bool important, bool center)
{
mImportantLabel = important;
@ -105,7 +105,11 @@ namespace MWGui
MyGUI::IntSize size(mLoadingText->getTextSize().width+padding, mLoadingBox->getHeight());
size.width = std::max(300, size.width);
mLoadingBox->setSize(size);
mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mLoadingBox->getTop());
if (center)
mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mMainWidget->getHeight()/2 - mLoadingBox->getHeight()/2);
else
mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mMainWidget->getHeight() - mLoadingBox->getHeight() - 8);
}
void LoadingScreen::setVisible(bool visible)

@ -34,7 +34,7 @@ namespace MWGui
virtual ~LoadingScreen();
/// Overridden from Loading::Listener, see the Loading::Listener documentation for usage details
virtual void setLabel (const std::string& label, bool important);
virtual void setLabel (const std::string& label, bool important, bool center);
virtual void loadingOn(bool visible=true);
virtual void loadingOff();
virtual void setProgressRange (size_t range);

@ -35,6 +35,11 @@ namespace MWGui
}
}
int MessageBoxManager::getMessagesCount()
{
return mMessageBoxes.size();
}
void MessageBoxManager::clear()
{
if (mInterMessageBoxe)

@ -28,6 +28,8 @@ namespace MWGui
bool createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons);
bool isInteractiveMessageBox ();
int getMessagesCount();
const InteractiveMessageBox* getInteractiveMessageBox() const { return mInterMessageBoxe; }
/// Remove all message boxes

@ -1670,6 +1670,15 @@ namespace MWGui
mHud->setEnemy(enemy);
}
int WindowManager::getMessagesCount() const
{
int count = 0;
if (mMessageBoxManager)
count = mMessageBoxManager->getMessagesCount();
return count;
}
Loading::Listener* WindowManager::getLoadingScreen()
{
return mLoadingScreen;

@ -316,6 +316,8 @@ namespace MWGui
virtual void setEnemy (const MWWorld::Ptr& enemy);
virtual int getMessagesCount() const;
virtual const Translation::Storage& getTranslationDataStorage() const;
void onSoulgemDialogButtonPressed (int button);

@ -265,9 +265,10 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
writer.save (stream);
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
listener.setProgressRange(MWBase::Environment::get().getWorld()->countSavedGameCells());
listener.setLabel("#{sNotifyMessage4}", true);
listener.setLabel("#{sNotifyMessage4}", true, messagesCount > 0);
Loading::ScopedLoad load(&listener);
@ -389,9 +390,10 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
std::map<int, int> contentFileMap = buildContentFileIndexMap (reader);
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
int messagesCount = MWBase::Environment::get().getWindowManager()->getMessagesCount();
listener.setProgressRange(100);
listener.setLabel("#{sLoadingMessage14}");
listener.setLabel("#{sLoadingMessage14}", false, messagesCount > 0);
Loading::ScopedLoad load(&listener);

@ -360,8 +360,9 @@ namespace MWWorld
Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
Loading::ScopedLoad load(loadingListener);
int messagesCount = MWBase::Environment::get().getWindowManager()->getMessagesCount();
std::string loadingExteriorText = "#{sLoadingMessage3}";
loadingListener->setLabel(loadingExteriorText);
loadingListener->setLabel(loadingExteriorText, false, messagesCount > 0);
CellStoreCollection::iterator active = mActiveCells.begin();
while (active!=mActiveCells.end())
@ -526,8 +527,9 @@ namespace MWWorld
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0.5);
Loading::Listener* loadingListener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
int messagesCount = MWBase::Environment::get().getWindowManager()->getMessagesCount();
std::string loadingInteriorText = "#{sLoadingMessage2}";
loadingListener->setLabel(loadingInteriorText);
loadingListener->setLabel(loadingInteriorText, false, messagesCount > 0);
Loading::ScopedLoad load(loadingListener);
if(!loadcell)

@ -14,7 +14,7 @@ namespace Loading
/// @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
/// will show in a separate message-box if the loading screen was not shown.
virtual void setLabel (const std::string& label, bool important=false) {}
virtual void setLabel (const std::string& label, bool important=false, bool center=false) {}
/// Start a loading sequence. Must call loadingOff() when done.
/// @note To get the loading screen to actually update, you must call setProgress / increaseProgress periodically.

Loading…
Cancel
Save