mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-28 14:53:58 +00:00
Move TableEditModes enum inside a class scope.
(cherry picked from commit 107ccd84d4f411a825c2f095bae7f84e65f8609d) Conflicts: apps/opencs/model/world/refidadapterimp.cpp
This commit is contained in:
parent
0ec4af4210
commit
245357c9b2
@ -12,15 +12,15 @@
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
enum TableEditModes
|
||||
{
|
||||
TableEdit_None, // no editing
|
||||
TableEdit_Full, // edit cells and add/remove rows
|
||||
TableEdit_FixedRows // edit cells only
|
||||
};
|
||||
|
||||
struct ColumnBase
|
||||
{
|
||||
enum TableEditModes
|
||||
{
|
||||
TableEdit_None, // no editing
|
||||
TableEdit_Full, // edit cells and add/remove rows
|
||||
TableEdit_FixedRows // edit cells only
|
||||
};
|
||||
|
||||
enum Roles
|
||||
{
|
||||
Role_Flags = Qt::UserRole,
|
||||
@ -211,9 +211,9 @@ namespace CSMWorld
|
||||
{
|
||||
// by default editable; also see IdTree::hasChildren()
|
||||
if (mFixedRows)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_FixedRows);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_FixedRows);
|
||||
else
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
@ -237,6 +237,6 @@ namespace CSMWorld
|
||||
};
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(CSMWorld::TableEditModes)
|
||||
Q_DECLARE_METATYPE(CSMWorld::ColumnBase::TableEditModes)
|
||||
|
||||
#endif
|
||||
|
@ -6,7 +6,9 @@
|
||||
|
||||
#include <components/esm/loadcont.hpp>
|
||||
#include <components/esm/attr.hpp>
|
||||
#include <components/esm/loadmgef.hpp>
|
||||
|
||||
#include "columnbase.hpp"
|
||||
#include "nestedtablewrapper.hpp"
|
||||
#include "usertype.hpp"
|
||||
#include "idtree.hpp"
|
||||
@ -32,7 +34,7 @@ QVariant CSMWorld::PotionRefIdAdapter::getData (const RefIdColumn *column, const
|
||||
|
||||
// to show nested tables in dialogue subview, see IdTree::hasChildren()
|
||||
if (column==mColumns.mEffects)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
return InventoryRefIdAdapter<ESM::Potion>::getData (column, data, index);
|
||||
}
|
||||
@ -69,11 +71,8 @@ CSMWorld::IngredientRefIdAdapter::IngredientRefIdAdapter (const IngredientColumn
|
||||
QVariant CSMWorld::IngredientRefIdAdapter::getData (const RefIdColumn *column, const RefIdData& data,
|
||||
int index) const
|
||||
{
|
||||
const Record<ESM::Ingredient>& record = static_cast<const Record<ESM::Ingredient>&> (
|
||||
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Ingredient)));
|
||||
|
||||
if (column==mColumns.mEffects)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_FixedRows);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_FixedRows);
|
||||
|
||||
return InventoryRefIdAdapter<ESM::Ingredient>::getData (column, data, index);
|
||||
}
|
||||
@ -277,7 +276,7 @@ QVariant CSMWorld::ArmorRefIdAdapter::getData (const RefIdColumn *column,
|
||||
return record.get().mData.mArmor;
|
||||
|
||||
if (column==mPartRef)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
return EnchantableRefIdAdapter<ESM::Armor>::getData (column, data, index);
|
||||
}
|
||||
@ -365,7 +364,7 @@ QVariant CSMWorld::ClothingRefIdAdapter::getData (const RefIdColumn *column,
|
||||
return record.get().mData.mType;
|
||||
|
||||
if (column==mPartRef)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
return EnchantableRefIdAdapter<ESM::Clothing>::getData (column, data, index);
|
||||
}
|
||||
@ -413,7 +412,7 @@ QVariant CSMWorld::ContainerRefIdAdapter::getData (const RefIdColumn *column,
|
||||
return (record.get().mFlags & ESM::Container::Respawn)!=0;
|
||||
|
||||
if (column==mContent)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
return NameRefIdAdapter<ESM::Container>::getData (column, data, index);
|
||||
}
|
||||
@ -482,13 +481,13 @@ QVariant CSMWorld::CreatureRefIdAdapter::getData (const RefIdColumn *column, con
|
||||
return QString::fromUtf8 (record.get().mOriginal.c_str());
|
||||
|
||||
if (column==mColumns.mAttributes)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_FixedRows);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_FixedRows);
|
||||
|
||||
if (column==mColumns.mAttacks)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_FixedRows);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_FixedRows);
|
||||
|
||||
if (column==mColumns.mMisc)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
std::map<const RefIdColumn *, unsigned int>::const_iterator iter =
|
||||
mColumns.mFlags.find (column);
|
||||
@ -728,13 +727,13 @@ QVariant CSMWorld::NpcRefIdAdapter::getData (const RefIdColumn *column, const Re
|
||||
if (column==mColumns.mAttributes || column==mColumns.mSkills)
|
||||
{
|
||||
if ((record.get().mFlags & ESM::NPC::Autocalc) != 0)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_None);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_None);
|
||||
else
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_FixedRows);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_FixedRows);
|
||||
}
|
||||
|
||||
if (column==mColumns.mMisc)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
std::map<const RefIdColumn *, unsigned int>::const_iterator iter =
|
||||
mColumns.mFlags.find (column);
|
||||
@ -1614,21 +1613,21 @@ QVariant ActorRefIdAdapter<ESM::NPC>::getData (const RefIdColumn *column, const
|
||||
return record.get().mAiData.mAlarm;
|
||||
|
||||
if (column==mActors.mInventory)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
if (column==mActors.mSpells)
|
||||
{
|
||||
if ((record.get().mFlags & ESM::NPC::Autocalc) != 0)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_None);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_None);
|
||||
else
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
}
|
||||
|
||||
if (column==mActors.mDestinations)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
if (column==mActors.mAiPackages)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
std::map<const RefIdColumn *, unsigned int>::const_iterator iter =
|
||||
mActors.mServices.find (column);
|
||||
@ -1795,16 +1794,16 @@ QVariant ActorRefIdAdapter<ESM::Creature>::getData (const RefIdColumn *column, c
|
||||
return record.get().mAiData.mAlarm;
|
||||
|
||||
if (column==mActors.mInventory)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
if (column==mActors.mSpells)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
if (column==mActors.mDestinations)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
if (column==mActors.mAiPackages)
|
||||
return QVariant::fromValue(TableEditModes::TableEdit_Full);
|
||||
return QVariant::fromValue(ColumnBase::TableEdit_Full);
|
||||
|
||||
std::map<const RefIdColumn *, unsigned int>::const_iterator iter =
|
||||
mActors.mServices.find (column);
|
||||
|
@ -567,13 +567,13 @@ void CSVWorld::EditWidget::remake(int row)
|
||||
bool editable = true;
|
||||
bool fixedRows = false;
|
||||
QVariant v = mTable->index(row, i).data();
|
||||
if (v.canConvert<CSMWorld::TableEditModes>())
|
||||
if (v.canConvert<CSMWorld::ColumnBase::TableEditModes>())
|
||||
{
|
||||
assert (QString(v.typeName()) == "CSMWorld::TableEditModes");
|
||||
assert (QString(v.typeName()) == "CSMWorld::ColumnBase::TableEditModes");
|
||||
|
||||
if (v.value<CSMWorld::TableEditModes>() == CSMWorld::TableEditModes::TableEdit_None)
|
||||
if (v.value<CSMWorld::ColumnBase::TableEditModes>() == CSMWorld::ColumnBase::TableEdit_None)
|
||||
editable = false;
|
||||
else if (v.value<CSMWorld::TableEditModes>() == CSMWorld::TableEditModes::TableEdit_FixedRows)
|
||||
else if (v.value<CSMWorld::ColumnBase::TableEditModes>() == CSMWorld::ColumnBase::TableEdit_FixedRows)
|
||||
fixedRows = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user