Make ContentSelector errors localizable

ini_importer_tests
Andrei Kortunov 11 months ago
parent cdf2459ed8
commit 43307bee28

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

@ -93,6 +93,10 @@ namespace ContentSelectorModel
QIcon mWarningIcon; QIcon mWarningIcon;
bool mShowOMWScripts; 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: public:
QString mMimeType; QString mMimeType;
QStringList mMimeTypes; QStringList mMimeTypes;

@ -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);
}

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

Loading…
Cancel
Save