Added support for renaming property archetypes. Added support for enums to override the default type name. Added the ability for enums/choices/flags with no values/flags to be edited as ints.

This commit is contained in:
Aruki
2018-10-13 16:33:31 -06:00
parent 0e5355a103
commit cf219cf17a
244 changed files with 942 additions and 460 deletions

View File

@@ -1,4 +1,5 @@
#include "CPropertyNameValidator.h"
#include "UICommon.h"
#include <Common/Hash/CCRC32.h>
CPropertyNameValidator::CPropertyNameValidator(QObject* pParent)
@@ -12,14 +13,23 @@ void CPropertyNameValidator::SetProperty(IProperty* pProp)
emit changed();
}
/** Set the type name override */
void CPropertyNameValidator::SetTypeNameOverride(const QString& kNewTypeName)
{
mTypeNameOverride = kNewTypeName;
emit changed();
}
/** Perform validation */
QValidator::State CPropertyNameValidator::validate(QString& rInput, int&) const
{
if (mpProperty)
{
TString TypeName = (mTypeNameOverride.isEmpty() ? mpProperty->HashableTypeName() : TO_TSTRING(mTypeNameOverride));
CCRC32 Hash;
Hash.Hash( rInput.toStdString().c_str() );
Hash.Hash( mpProperty->HashableTypeName() );
Hash.Hash( *TypeName );
u32 PropertyID = Hash.Digest();
if (PropertyID != mpProperty->ID())