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>
|
2014-02-09 14:33:00 +00:00
|
|
|
#include <QtGui/qevent.h>
|
2012-11-29 18:09:06 +00:00
|
|
|
|
2013-08-18 14:53:28 +00:00
|
|
|
#include "../../model/filter/node.hpp"
|
2014-02-19 15:15:51 +00:00
|
|
|
#include "../../model/world/columnbase.hpp"
|
2013-08-18 14:53:28 +00:00
|
|
|
|
2012-11-29 18:09:06 +00:00
|
|
|
class QUndoStack;
|
2012-12-03 20:44:16 +00:00
|
|
|
class QAction;
|
2012-11-29 18:09:06 +00:00
|
|
|
|
2014-03-06 12:51:21 +00:00
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Document;
|
|
|
|
}
|
|
|
|
|
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;
|
2013-07-21 15:53:39 +00:00
|
|
|
QAction *mEditAction;
|
2012-12-03 20:44:16 +00:00
|
|
|
QAction *mCreateAction;
|
2014-01-14 14:44:04 +00:00
|
|
|
QAction *mCloneAction;
|
2012-12-06 13:56:04 +00:00
|
|
|
QAction *mRevertAction;
|
2012-12-06 14:18:41 +00:00
|
|
|
QAction *mDeleteAction;
|
2013-11-14 10:39:14 +00:00
|
|
|
QAction *mMoveUpAction;
|
|
|
|
QAction *mMoveDownAction;
|
2014-03-02 21:43:44 +00:00
|
|
|
QAction *mViewAction;
|
2012-12-06 13:56:04 +00:00
|
|
|
CSMWorld::IdTableProxyModel *mProxyModel;
|
|
|
|
CSMWorld::IdTable *mModel;
|
2012-12-08 17:15:00 +00:00
|
|
|
bool mEditLock;
|
2013-06-15 11:40:18 +00:00
|
|
|
int mRecordStatusDisplay;
|
2014-03-06 12:51:21 +00:00
|
|
|
CSMDoc::Document& mDocument;
|
2014-02-15 11:22:32 +00:00
|
|
|
|
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;
|
|
|
|
|
2014-02-04 10:40:48 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent *event);
|
|
|
|
|
2014-02-10 15:48:04 +00:00
|
|
|
void dragEnterEvent(QDragEnterEvent *event);
|
|
|
|
|
2014-02-12 10:16:12 +00:00
|
|
|
void dragMoveEvent(QDragMoveEvent *event);
|
|
|
|
|
2014-02-21 12:30:52 +00:00
|
|
|
void dropEvent(QDropEvent *event);
|
2014-02-12 10:16:12 +00:00
|
|
|
|
2012-11-29 18:09:06 +00:00
|
|
|
public:
|
|
|
|
|
2014-03-06 12:51:21 +00:00
|
|
|
Table (const CSMWorld::UniversalId& id, bool createAndDelete,
|
|
|
|
bool sorting, CSMDoc::Document& document);
|
2012-12-03 20:44:16 +00:00
|
|
|
///< \param createAndDelete Allow creation and deletion of records.
|
2013-10-31 12:40:14 +00:00
|
|
|
/// \param sorting Allow changing order of rows in the view via column headers.
|
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;
|
|
|
|
|
2013-06-15 11:40:18 +00:00
|
|
|
void updateEditorSetting (const QString &settingName, const QString &settingValue);
|
|
|
|
|
2014-02-19 15:15:51 +00:00
|
|
|
std::vector<std::string> getColumnsWithDisplay(CSMWorld::ColumnBase::Display display) const;
|
|
|
|
|
2013-07-21 15:53:39 +00:00
|
|
|
signals:
|
|
|
|
|
2014-03-02 21:34:41 +00:00
|
|
|
void editRequest (const CSMWorld::UniversalId& id, const std::string& hint);
|
2013-07-21 15:53:39 +00:00
|
|
|
|
2013-07-25 12:29:56 +00:00
|
|
|
void selectionSizeChanged (int size);
|
|
|
|
|
|
|
|
void tableSizeChanged (int size, int deleted, int modified);
|
|
|
|
///< \param size Number of not deleted records
|
|
|
|
/// \param deleted Number of deleted records
|
|
|
|
/// \param modified Number of added and modified records
|
|
|
|
|
2013-07-26 16:22:31 +00:00
|
|
|
void createRequest();
|
2014-01-21 07:27:29 +00:00
|
|
|
void cloneRequest(const CSMWorld::UniversalId&);
|
2013-07-26 16:22:31 +00:00
|
|
|
|
2012-12-03 20:44:16 +00:00
|
|
|
private slots:
|
|
|
|
|
2012-12-06 13:56:04 +00:00
|
|
|
void revertRecord();
|
2012-12-06 14:18:41 +00:00
|
|
|
|
|
|
|
void deleteRecord();
|
2013-07-21 15:53:39 +00:00
|
|
|
|
|
|
|
void editRecord();
|
2013-07-25 12:29:56 +00:00
|
|
|
|
2014-01-14 14:44:04 +00:00
|
|
|
void cloneRecord();
|
|
|
|
|
2013-11-14 10:39:14 +00:00
|
|
|
void moveUpRecord();
|
|
|
|
|
|
|
|
void moveDownRecord();
|
|
|
|
|
2014-03-02 21:43:44 +00:00
|
|
|
void viewRecord();
|
|
|
|
|
2013-07-25 12:29:56 +00:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void tableSizeUpdate();
|
|
|
|
|
|
|
|
void selectionSizeUpdate();
|
2013-07-26 16:22:31 +00:00
|
|
|
|
2013-07-29 13:00:41 +00:00
|
|
|
void requestFocus (const std::string& id);
|
|
|
|
|
2013-08-22 07:17:57 +00:00
|
|
|
void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter);
|
2012-11-29 18:09:06 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|