1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 08:45:33 +00:00

Merge branch 'localizable_errors' into 'master'

Make ContentSelector errors localizable

See merge request OpenMW/openmw!3821
This commit is contained in:
psi29a 2024-01-31 10:51:54 +00:00
commit ee8eb9d36e
4 changed files with 7 additions and 14 deletions

View file

@ -723,8 +723,10 @@ QString ContentSelectorModel::ContentModel::toolTip(const EsmFile* file) const
int index = indexFromItem(item(file->filePath())).row();
for (const LoadOrderError& error : checkForLoadOrderErrors(file, index))
{
assert(error.errorCode() != LoadOrderError::ErrorCode::ErrorCode_None);
text += "<p>";
text += error.toolTip();
text += mErrorToolTips[error.errorCode() - 1].arg(error.fileName());
text += "</p>";
}
text += ("</b>");

View file

@ -93,6 +93,10 @@ namespace ContentSelectorModel
QIcon mWarningIcon;
bool mShowOMWScripts;
QString mErrorToolTips[ContentSelectorModel::LoadOrderError::ErrorCode_LoadOrder]
= { tr("Unable to find dependent file: %1"), tr("Dependent file needs to be active: %1"),
tr("This file needs to load after %1") };
public:
QString mMimeType;
QStringList mMimeTypes;

View file

@ -1,12 +0,0 @@
#include "loadordererror.hpp"
#include <cassert>
QString ContentSelectorModel::LoadOrderError::sErrorToolTips[ErrorCode_LoadOrder]
= { QString("Unable to find dependent file: %1"), QString("Dependent file needs to be active: %1"),
QString("This file needs to load after %1") };
QString ContentSelectorModel::LoadOrderError::toolTip() const
{
assert(mErrorCode);
return sErrorToolTips[mErrorCode - 1].arg(mFileName);
}

View file

@ -28,7 +28,6 @@ namespace ContentSelectorModel
}
inline ErrorCode errorCode() const { return mErrorCode; }
inline QString fileName() const { return mFileName; }
QString toolTip() const;
private:
ErrorCode mErrorCode;