OpenMW
apps/opencs/view/world/table.hpp
Go to the documentation of this file.
00001 #ifndef CSV_WORLD_TABLE_H
00002 #define CSV_WORLD_TABLE_H
00003 
00004 #include <vector>
00005 #include <string>
00006 
00007 #include <QTableView>
00008 
00009 #include "../../model/filter/node.hpp"
00010 
00011 class QUndoStack;
00012 class QAction;
00013 
00014 namespace CSMWorld
00015 {
00016     class Data;
00017     class UniversalId;
00018     class IdTableProxyModel;
00019     class IdTable;
00020 }
00021 
00022 namespace CSVWorld
00023 {
00024     class CommandDelegate;
00025 
00027     class Table : public QTableView
00028     {
00029             Q_OBJECT
00030 
00031             std::vector<CommandDelegate *> mDelegates;
00032             QUndoStack& mUndoStack;
00033             QAction *mEditAction;
00034             QAction *mCreateAction;
00035             QAction *mRevertAction;
00036             QAction *mDeleteAction;
00037             QAction *mMoveUpAction;
00038             QAction *mMoveDownAction;
00039             CSMWorld::IdTableProxyModel *mProxyModel;
00040             CSMWorld::IdTable *mModel;
00041             bool mEditLock;
00042             int mRecordStatusDisplay;
00043 
00044         private:
00045 
00046             void contextMenuEvent (QContextMenuEvent *event);
00047 
00048             std::vector<std::string> listRevertableSelectedIds() const;
00049 
00050             std::vector<std::string> listDeletableSelectedIds() const;
00051 
00052         public:
00053 
00054             Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack, bool createAndDelete, bool sorting);
00057 
00058             void setEditLock (bool locked);
00059 
00060             CSMWorld::UniversalId getUniversalId (int row) const;
00061 
00062             void updateEditorSetting (const QString &settingName, const QString &settingValue);
00063 
00064         signals:
00065 
00066             void editRequest (int row);
00067 
00068             void selectionSizeChanged (int size);
00069 
00070             void tableSizeChanged (int size, int deleted, int modified);
00074 
00075             void createRequest();
00076 
00077         private slots:
00078 
00079             void revertRecord();
00080 
00081             void deleteRecord();
00082 
00083             void editRecord();
00084 
00085             void moveUpRecord();
00086 
00087             void moveDownRecord();
00088 
00089         public slots:
00090 
00091             void tableSizeUpdate();
00092 
00093             void selectionSizeUpdate();
00094 
00095             void requestFocus (const std::string& id);
00096 
00097             void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter);
00098     };
00099 }
00100 
00101 #endif