2012-11-29 18:09:06 +00:00
|
|
|
#ifndef CSV_WORLD_TABLE_H
|
|
|
|
#define CSV_WORLD_TABLE_H
|
|
|
|
|
2012-11-30 12:58:10 +00:00
|
|
|
#include <vector>
|
2012-12-06 14:25:31 +00:00
|
|
|
#include <string>
|
2012-11-30 12:58:10 +00:00
|
|
|
|
2012-11-29 18:09:06 +00:00
|
|
|
#include <QTableView>
|
|
|
|
|
|
|
|
class QUndoStack;
|
2012-12-03 20:44:16 +00:00
|
|
|
class QAction;
|
2012-11-29 18:09:06 +00:00
|
|
|
|
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class Data;
|
|
|
|
class UniversalId;
|
2012-12-03 20:44:16 +00:00
|
|
|
class IdTableProxyModel;
|
2012-12-06 13:56:04 +00:00
|
|
|
class IdTable;
|
2012-11-29 18:09:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace CSVWorld
|
|
|
|
{
|
2012-11-30 12:58:10 +00:00
|
|
|
class CommandDelegate;
|
|
|
|
|
2012-11-29 18:09:06 +00:00
|
|
|
///< Table widget
|
|
|
|
class Table : public QTableView
|
|
|
|
{
|
2012-12-03 20:44:16 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-30 12:58:10 +00:00
|
|
|
std::vector<CommandDelegate *> mDelegates;
|
2012-12-03 20:44:16 +00:00
|
|
|
QUndoStack& mUndoStack;
|
|
|
|
QAction *mCreateAction;
|
2012-12-06 13:56:04 +00:00
|
|
|
QAction *mRevertAction;
|
2012-12-06 14:18:41 +00:00
|
|
|
QAction *mDeleteAction;
|
2012-12-06 13:56:04 +00:00
|
|
|
CSMWorld::IdTableProxyModel *mProxyModel;
|
|
|
|
CSMWorld::IdTable *mModel;
|
2012-12-08 17:15:00 +00:00
|
|
|
bool mEditLock;
|
2012-12-03 20:44:16 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void contextMenuEvent (QContextMenuEvent *event);
|
2012-11-30 12:58:10 +00:00
|
|
|
|
2012-12-06 14:25:31 +00:00
|
|
|
std::vector<std::string> listRevertableSelectedIds() const;
|
|
|
|
|
|
|
|
std::vector<std::string> listDeletableSelectedIds() const;
|
|
|
|
|
2012-11-29 18:09:06 +00:00
|
|
|
public:
|
|
|
|
|
2012-12-03 20:44:16 +00:00
|
|
|
Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack, bool createAndDelete);
|
|
|
|
///< \param createAndDelete Allow creation and deletion of records.
|
2012-11-30 12:58:10 +00:00
|
|
|
|
|
|
|
void setEditLock (bool locked);
|
2012-12-03 20:44:16 +00:00
|
|
|
|
2012-12-13 12:35:08 +00:00
|
|
|
CSMWorld::UniversalId getUniversalId (int row) const;
|
|
|
|
|
2012-12-03 20:44:16 +00:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void createRecord();
|
2012-12-06 13:56:04 +00:00
|
|
|
|
|
|
|
void revertRecord();
|
2012-12-06 14:18:41 +00:00
|
|
|
|
|
|
|
void deleteRecord();
|
2012-11-29 18:09:06 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|