mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Implementing delegate for referenceables table Type column
Added delegate skeleton class Added delegate creation code in ViewManager Added Display_RefRecordType enum to columnbase.hpp Changed Type column'sDisplay type to Display_RefRecordType in refidcollection.cpp modified OpenCS CMakeLists.txt to incorporate RefRecordTypeDelegate class
This commit is contained in:
parent
6deddf7229
commit
9d95a38934
5 changed files with 84 additions and 2 deletions
|
@ -61,7 +61,9 @@ opencs_units (view/world
|
|||
)
|
||||
|
||||
opencs_units_noqt (view/world
|
||||
dialoguesubview subviews enumdelegate vartypedelegate scripthighlighter recordstatusdelegate
|
||||
dialoguesubview subviews
|
||||
enumdelegate vartypedelegate recordstatusdelegate refrecordtypedelegate
|
||||
scripthighlighter
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ namespace CSMWorld
|
|||
Display_ClothingType,
|
||||
Display_CreatureType,
|
||||
Display_WeaponType,
|
||||
Display_RecordState
|
||||
Display_RecordState,
|
||||
Display_RefRecordType
|
||||
};
|
||||
|
||||
std::string mTitle;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "../world/enumdelegate.hpp"
|
||||
#include "../world/vartypedelegate.hpp"
|
||||
#include "../world/recordstatusdelegate.hpp"
|
||||
#include "../world/refrecordtypedelegate.hpp"
|
||||
#include "../settings/usersettingsdialog.hpp"
|
||||
|
||||
#include "view.hpp"
|
||||
|
@ -122,6 +123,9 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
|||
mDelegateFactories->add (CSMWorld::ColumnBase::Display_RecordState,
|
||||
new CSVWorld::RecordStatusDelegateFactory() );
|
||||
|
||||
mDelegateFactories->add (CSMWorld::ColumnBase::Display_RefRecordType,
|
||||
new CSVWorld::RefRecordTypeDelegateFactory() );
|
||||
|
||||
connect (&CSMSettings::UserSettings::instance(), SIGNAL (signalUpdateEditorSetting (const QString &, const QString &)),
|
||||
this, SLOT (slotUpdateEditorSetting (const QString &, const QString &)));
|
||||
}
|
||||
|
|
17
apps/opencs/view/world/refrecordtypedelegate.cpp
Normal file
17
apps/opencs/view/world/refrecordtypedelegate.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "refrecordtypedelegate.hpp"
|
||||
|
||||
CSVWorld::RefRecordTypeDelegate::RefRecordTypeDelegate
|
||||
(const std::vector<std::pair<int, QString> > &values, QUndoStack& undoStack, QObject *parent)
|
||||
: EnumDelegate (values, undoStack, parent)
|
||||
{}
|
||||
|
||||
CSVWorld::RefRecordTypeDelegateFactory::RefRecordTypeDelegateFactory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CSVWorld::CommandDelegate *CSVWorld::RefRecordTypeDelegateFactory::makeDelegate (QUndoStack& undoStack,
|
||||
QObject *parent) const
|
||||
{
|
||||
return new RefRecordTypeDelegate (mValues, undoStack, parent);
|
||||
}
|
58
apps/opencs/view/world/refrecordtypedelegate.hpp
Normal file
58
apps/opencs/view/world/refrecordtypedelegate.hpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
#ifndef REFRECORDTYPEDELEGATE_HPP
|
||||
#define REFRECORDTYPEDELEGATE_HPP
|
||||
|
||||
#include "enumdelegate.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
class RefRecordTypeDelegate : public EnumDelegate
|
||||
{
|
||||
public:
|
||||
RefRecordTypeDelegate (const std::vector<std::pair<int, QString> > &mValues, QUndoStack& undoStack, QObject *parent);
|
||||
};
|
||||
|
||||
class RefRecordTypeDelegateFactory : public CommandDelegateFactory
|
||||
{
|
||||
|
||||
std::vector<std::pair<int, QString> > mValues;
|
||||
|
||||
public:
|
||||
RefRecordTypeDelegateFactory();
|
||||
|
||||
virtual CommandDelegate *makeDelegate (QUndoStack& undoStack, QObject *parent) const;
|
||||
///< The ownership of the returned CommandDelegate is transferred to the caller.
|
||||
};
|
||||
}
|
||||
/*
|
||||
class VarTypeDelegate : public EnumDelegate
|
||||
{
|
||||
private:
|
||||
|
||||
virtual void addCommands (QAbstractItemModel *model,
|
||||
const QModelIndex& index, int type) const;
|
||||
|
||||
public:
|
||||
|
||||
VarTypeDelegate (const std::vector<std::pair<int, QString> >& values,
|
||||
QUndoStack& undoStack, QObject *parent);
|
||||
};
|
||||
|
||||
class VarTypeDelegateFactory : public CommandDelegateFactory
|
||||
{
|
||||
std::vector<std::pair<int, QString> > mValues;
|
||||
|
||||
public:
|
||||
|
||||
VarTypeDelegateFactory (ESM::VarType type0 = ESM::VT_Unknown,
|
||||
ESM::VarType type1 = ESM::VT_Unknown, ESM::VarType type2 = ESM::VT_Unknown,
|
||||
ESM::VarType type3 = ESM::VT_Unknown);
|
||||
|
||||
virtual CommandDelegate *makeDelegate (QUndoStack& undoStack, QObject *parent) const;
|
||||
///< The ownership of the returned CommandDelegate is transferred to the caller.
|
||||
|
||||
void add (ESM::VarType type);
|
||||
};
|
||||
*/
|
||||
|
||||
#endif // REFRECORDTYPEDELEGATE_HPP
|
Loading…
Reference in a new issue