Merge branch 'charactername' into 'master'
Some checks failed
Build and test / Ubuntu (push) Has been cancelled
Build and test / MacOS (push) Has been cancelled
Build and test / Read .env file and expose it as output (push) Has been cancelled
Build and test / Windows (2019) (push) Has been cancelled
Build and test / Windows (2022) (push) Has been cancelled

Revise saved game dialog save info layout (#8313)

Closes #8313

See merge request OpenMW/openmw!4545
This commit is contained in:
Alexei Kotov 2025-04-24 19:10:46 +03:00
commit 4262426d9f
3 changed files with 28 additions and 13 deletions

View file

@ -43,6 +43,7 @@ namespace MWGui
{
getWidget(mScreenshot, "Screenshot");
getWidget(mCharacterSelection, "SelectCharacter");
getWidget(mCellName, "CellName");
getWidget(mInfoText, "InfoText");
getWidget(mOkButton, "OkButton");
getWidget(mCancelButton, "CancelButton");
@ -196,7 +197,8 @@ namespace MWGui
title << " (#{OMWEngine:Level} " << signature.mPlayerLevel << " "
<< MyGUI::TextIterator::toTagsString(MyGUI::UString(className)) << ")";
mCharacterSelection->addItem(MyGUI::LanguageManager::getInstance().replaceTags(title.str()));
const MyGUI::UString playerDesc = MyGUI::LanguageManager::getInstance().replaceTags(title.str());
mCharacterSelection->addItem(playerDesc, signature.mPlayerName);
if (mCurrentCharacter == &*it
|| (!mCurrentCharacter && !mSaving
@ -390,6 +392,7 @@ namespace MWGui
if (pos == MyGUI::ITEM_NONE || !mCurrentCharacter)
{
mCurrentSlot = nullptr;
mCellName->setCaption({});
mInfoText->setCaption({});
mScreenshot->setImageTexture({});
return;
@ -411,15 +414,21 @@ namespace MWGui
std::stringstream text;
text << Misc::fileTimeToString(mCurrentSlot->mTimeStamp, "%Y.%m.%d %T") << "\n";
const size_t profileIndex = mCharacterSelection->getIndexSelected();
const std::string& slotPlayerName = mCurrentSlot->mProfile.mPlayerName;
const std::string& profilePlayerName = *mCharacterSelection->getItemDataAt<std::string>(profileIndex);
if (slotPlayerName != profilePlayerName)
text << slotPlayerName << "\n";
text << "#{OMWEngine:Level} " << mCurrentSlot->mProfile.mPlayerLevel << "\n";
if (mCurrentSlot->mProfile.mCurrentDay > 0)
text << "#{Calendar:day} " << mCurrentSlot->mProfile.mCurrentDay << "\n";
if (mCurrentSlot->mProfile.mMaximumHealth > 0)
text << "#{OMWEngine:Health} " << static_cast<int>(mCurrentSlot->mProfile.mCurrentHealth) << "/"
<< static_cast<int>(mCurrentSlot->mProfile.mMaximumHealth) << "\n";
text << "#{OMWEngine:Level} " << mCurrentSlot->mProfile.mPlayerLevel << "\n";
text << "#{sCell=" << mCurrentSlot->mProfile.mPlayerCellName << "}\n";
int hour = int(mCurrentSlot->mProfile.mInGameTime.mGameHour);
bool pm = hour >= 12;
if (hour >= 13)
@ -427,20 +436,19 @@ namespace MWGui
if (hour == 0)
hour = 12;
if (mCurrentSlot->mProfile.mCurrentDay > 0)
text << "#{Calendar:day} " << mCurrentSlot->mProfile.mCurrentDay << "\n";
text << mCurrentSlot->mProfile.mInGameTime.mDay << " "
<< MWBase::Environment::get().getWorld()->getTimeManager()->getMonthName(
mCurrentSlot->mProfile.mInGameTime.mMonth)
<< " " << hour << " " << (pm ? "#{Calendar:pm}" : "#{Calendar:am}");
<< " " << hour << " " << (pm ? "#{Calendar:pm}" : "#{Calendar:am}") << "\n";
if (mCurrentSlot->mProfile.mTimePlayed > 0)
{
text << "\n"
<< "#{OMWEngine:TimePlayed}: " << formatTimeplayed(mCurrentSlot->mProfile.mTimePlayed);
text << "#{OMWEngine:TimePlayed}: " << formatTimeplayed(mCurrentSlot->mProfile.mTimePlayed) << "\n";
}
text << Misc::fileTimeToString(mCurrentSlot->mTimeStamp, "%Y.%m.%d %T") << "\n";
mCellName->setCaptionWithReplacing("#{sCell=" + mCurrentSlot->mProfile.mPlayerCellName + "}");
mInfoText->setCaptionWithReplacing(text.str());
// Reset the image for the case we're unable to recover a screenshot

View file

@ -57,6 +57,7 @@ namespace MWGui
bool mSaving;
MyGUI::ComboBox* mCharacterSelection;
MyGUI::EditBox* mCellName;
MyGUI::EditBox* mInfoText;
MyGUI::Button* mOkButton;
MyGUI::Button* mCancelButton;

View file

@ -37,14 +37,20 @@
<Widget type="ImageBox" skin="ImageBox" position="2 2 259 133" name="Screenshot"/>
</Widget>
<Widget type="AutoSizedEditBox" skin="NormalText" position="0 0 263 0" name="CellName">
<Property key="Static" value="true"/>
<Property key="MultiLine" value="true"/>
<Property key="WordWrap" value="true"/>
<Property key="NeedKey" value="false"/>
<Property key="TextAlign" value="Center"/>
</Widget>
<Widget type="AutoSizedEditBox" skin="SandText" position="0 0 263 0" name="InfoText">
<Property key="Static" value="true"/>
<Property key="MultiLine" value="true"/>
<Property key="WordWrap" value="true"/>
<Property key="NeedKey" value="false"/>
</Widget>
</Widget>
</Widget>