forked from teamnwah/openmw-tes3coop
Adjust plug-in order to match profile loading.
Also marks plug-ins with load order problems in red and changes tool tip to describe error.openmw-35
parent
a62e15d93d
commit
dfbd470613
@ -0,0 +1,22 @@
|
||||
#include "loadordererror.hpp"
|
||||
#include <assert.h>
|
||||
|
||||
QString ContentSelectorModel::LoadOrderError::sErrorToolTips[ErrorCode_LoadOrder] =
|
||||
{
|
||||
QString("Unable to find dependant file: %1"),
|
||||
QString("Dependent file needs to be active: %1"),
|
||||
QString("This file needs to load after %1"),
|
||||
};
|
||||
|
||||
ContentSelectorModel::LoadOrderError ContentSelectorModel::LoadOrderError::sNoError = ContentSelectorModel::LoadOrderError();
|
||||
|
||||
QString ContentSelectorModel::LoadOrderError::toolTip() const
|
||||
{
|
||||
assert(mErrorCode);
|
||||
return sErrorToolTips[mErrorCode - 1].arg(mFileName);
|
||||
}
|
||||
|
||||
bool ContentSelectorModel::LoadOrderError::operator== (const ContentSelectorModel::LoadOrderError& rhs) const
|
||||
{
|
||||
return (mErrorCode == rhs.mErrorCode) && ((mErrorCode == ErrorCode_None) || (mFileName == rhs.mFileName));
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
#ifndef LOADORDERERROR_HPP
|
||||
#define LOADORDERERROR_HPP
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace ContentSelectorModel
|
||||
{
|
||||
/// \Details of a suspected Load Order problem a plug-in will have. This is basically a POD
|
||||
class LoadOrderError
|
||||
{
|
||||
public:
|
||||
enum ErrorCode
|
||||
{
|
||||
ErrorCode_None = 0,
|
||||
ErrorCode_MissingDependency = 1,
|
||||
ErrorCode_InactiveDependency = 2,
|
||||
ErrorCode_LoadOrder = 3,
|
||||
};
|
||||
|
||||
inline LoadOrderError() : mErrorCode(ErrorCode_None) {};
|
||||
inline LoadOrderError(ErrorCode errorCode, QString fileName)
|
||||
{
|
||||
mErrorCode = errorCode;
|
||||
mFileName = fileName;
|
||||
}
|
||||
inline ErrorCode errorCode() const { return mErrorCode; }
|
||||
inline QString fileName() const { return mFileName; }
|
||||
bool operator==(const LoadOrderError& rhs) const;
|
||||
QString toolTip() const;
|
||||
|
||||
/// \Sentinal to represent a "No Load Order Error" condition
|
||||
static LoadOrderError sNoError;
|
||||
|
||||
private:
|
||||
ErrorCode mErrorCode;
|
||||
QString mFileName;
|
||||
static QString sErrorToolTips[ErrorCode_LoadOrder];
|
||||
};
|
||||
}
|
||||
|
||||
#endif // LOADORDERERROR_HPP
|
Loading…
Reference in New Issue