mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-02 00:15:48 +00:00
added value column to gmst table
This commit is contained in:
parent
cce2d63433
commit
828695f295
4 changed files with 47 additions and 3 deletions
|
@ -28,7 +28,8 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
Display_String,
|
Display_String,
|
||||||
Display_Integer,
|
Display_Integer,
|
||||||
Display_Float
|
Display_Float,
|
||||||
|
Display_Var
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string mTitle;
|
std::string mTitle;
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace CSMWorld
|
||||||
template<typename ESXRecordT>
|
template<typename ESXRecordT>
|
||||||
struct VarTypeColumn : public Column<ESXRecordT>
|
struct VarTypeColumn : public Column<ESXRecordT>
|
||||||
{
|
{
|
||||||
VarTypeColumn() : Column<ESXRecordT> ("Type", ColumnBase::Display_Float) {}
|
VarTypeColumn() : Column<ESXRecordT> ("Type", ColumnBase::Display_Integer) {}
|
||||||
|
|
||||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||||
{
|
{
|
||||||
|
@ -114,6 +114,45 @@ namespace CSMWorld
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename ESXRecordT>
|
||||||
|
struct VarValueColumn : public Column<ESXRecordT>
|
||||||
|
{
|
||||||
|
VarValueColumn() : Column<ESXRecordT> ("Value", ColumnBase::Display_Var) {}
|
||||||
|
|
||||||
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||||
|
{
|
||||||
|
switch (record.get().mType)
|
||||||
|
{
|
||||||
|
case ESM::VT_String: return record.get().mStr.c_str(); break;
|
||||||
|
case ESM::VT_Int: return record.get().mI; break;
|
||||||
|
case ESM::VT_Float: return record.get().mF; break;
|
||||||
|
|
||||||
|
default: return QVariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||||
|
{
|
||||||
|
ESXRecordT base = record.getBase();
|
||||||
|
|
||||||
|
switch (record.get().mType)
|
||||||
|
{
|
||||||
|
case ESM::VT_String: base.mStr = data.toString().toUtf8().constData(); break;
|
||||||
|
case ESM::VT_Int: base.mI = data.toInt(); break;
|
||||||
|
case ESM::VT_Float: base.mF = data.toFloat(); break;
|
||||||
|
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
record.setModified (base);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool isEditable() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -32,7 +32,7 @@ CSMWorld::Data::Data()
|
||||||
mGmsts.addColumn (new RecordStateColumn<ESM::GameSetting>);
|
mGmsts.addColumn (new RecordStateColumn<ESM::GameSetting>);
|
||||||
mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst));
|
mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst));
|
||||||
mGmsts.addColumn (new VarTypeColumn<ESM::GameSetting>);
|
mGmsts.addColumn (new VarTypeColumn<ESM::GameSetting>);
|
||||||
///< \todo add value
|
mGmsts.addColumn (new VarValueColumn<ESM::GameSetting>);
|
||||||
|
|
||||||
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
|
addModel (new IdTable (&mGlobals), UniversalId::Type_Globals, UniversalId::Type_Global);
|
||||||
addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst);
|
addModel (new IdTable (&mGmsts), UniversalId::Type_Gmsts, UniversalId::Type_Gmst);
|
||||||
|
|
|
@ -64,6 +64,8 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
||||||
/// \todo configure widget properly (range, format?)
|
/// \todo configure widget properly (range, format?)
|
||||||
layout->addWidget (widget = new QDoubleSpinBox, i, 1);
|
layout->addWidget (widget = new QDoubleSpinBox, i, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default: break; // silence warnings for other times for now
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -76,6 +78,8 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
||||||
|
|
||||||
layout->addWidget (widget = new QLabel, i, 1);
|
layout->addWidget (widget = new QLabel, i, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default: break; // silence warnings for other times for now
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue