2012-11-29 19:09:06 +01:00
|
|
|
#ifndef CSV_WORLD_TABLE_H
|
|
|
|
#define CSV_WORLD_TABLE_H
|
|
|
|
|
2012-11-30 13:58:10 +01:00
|
|
|
#include <vector>
|
2012-12-06 15:25:31 +01:00
|
|
|
#include <string>
|
2012-11-30 13:58:10 +01:00
|
|
|
|
2014-02-09 15:33:00 +01:00
|
|
|
#include <QtGui/qevent.h>
|
2012-11-29 19:09:06 +01:00
|
|
|
|
2013-08-18 16:53:28 +02:00
|
|
|
#include "../../model/filter/node.hpp"
|
2014-02-19 16:15:51 +01:00
|
|
|
#include "../../model/world/columnbase.hpp"
|
2014-04-29 11:19:19 +02:00
|
|
|
#include "dragrecordtable.hpp"
|
2013-08-18 16:53:28 +02:00
|
|
|
|
2012-11-29 19:09:06 +01:00
|
|
|
class QUndoStack;
|
2012-12-03 21:44:16 +01:00
|
|
|
class QAction;
|
2012-11-29 19:09:06 +01:00
|
|
|
|
2014-03-06 13:51:21 +01:00
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Document;
|
|
|
|
}
|
|
|
|
|
2012-11-29 19:09:06 +01:00
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class Data;
|
|
|
|
class UniversalId;
|
2012-12-03 21:44:16 +01:00
|
|
|
class IdTableProxyModel;
|
2012-12-06 14:56:04 +01:00
|
|
|
class IdTable;
|
2012-11-29 19:09:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace CSVWorld
|
|
|
|
{
|
2012-11-30 13:58:10 +01:00
|
|
|
class CommandDelegate;
|
|
|
|
|
2012-11-29 19:09:06 +01:00
|
|
|
///< Table widget
|
2014-04-29 11:19:19 +02:00
|
|
|
class Table : public DragRecordTable
|
2012-11-29 19:09:06 +01:00
|
|
|
{
|
2012-12-03 21:44:16 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-30 13:58:10 +01:00
|
|
|
std::vector<CommandDelegate *> mDelegates;
|
2013-07-21 17:53:39 +02:00
|
|
|
QAction *mEditAction;
|
2012-12-03 21:44:16 +01:00
|
|
|
QAction *mCreateAction;
|
2014-01-14 15:44:04 +01:00
|
|
|
QAction *mCloneAction;
|
2012-12-06 14:56:04 +01:00
|
|
|
QAction *mRevertAction;
|
2012-12-06 15:18:41 +01:00
|
|
|
QAction *mDeleteAction;
|
2013-11-14 11:39:14 +01:00
|
|
|
QAction *mMoveUpAction;
|
|
|
|
QAction *mMoveDownAction;
|
2014-03-02 22:43:44 +01:00
|
|
|
QAction *mViewAction;
|
2014-03-10 12:44:34 +01:00
|
|
|
QAction *mPreviewAction;
|
2012-12-06 14:56:04 +01:00
|
|
|
CSMWorld::IdTableProxyModel *mProxyModel;
|
|
|
|
CSMWorld::IdTable *mModel;
|
2013-06-15 06:40:18 -05:00
|
|
|
int mRecordStatusDisplay;
|
2014-02-15 12:22:32 +01:00
|
|
|
|
2012-12-03 21:44:16 +01:00
|
|
|
private:
|
|
|
|
|
|
|
|
void contextMenuEvent (QContextMenuEvent *event);
|
2012-11-30 13:58:10 +01:00
|
|
|
|
2012-12-06 15:25:31 +01:00
|
|
|
std::vector<std::string> listRevertableSelectedIds() const;
|
|
|
|
|
|
|
|
std::vector<std::string> listDeletableSelectedIds() const;
|
|
|
|
|
2014-02-04 11:40:48 +01:00
|
|
|
void mouseMoveEvent(QMouseEvent *event);
|
|
|
|
|
2014-02-21 13:30:52 +01:00
|
|
|
void dropEvent(QDropEvent *event);
|
2014-02-12 11:16:12 +01:00
|
|
|
|
2012-11-29 19:09:06 +01:00
|
|
|
public:
|
|
|
|
|
2014-03-06 13:51:21 +01:00
|
|
|
Table (const CSMWorld::UniversalId& id, bool createAndDelete,
|
|
|
|
bool sorting, CSMDoc::Document& document);
|
2012-12-03 21:44:16 +01:00
|
|
|
///< \param createAndDelete Allow creation and deletion of records.
|
2013-10-31 13:40:14 +01:00
|
|
|
/// \param sorting Allow changing order of rows in the view via column headers.
|
2012-11-30 13:58:10 +01:00
|
|
|
|
2014-04-29 19:43:58 +02:00
|
|
|
virtual void setEditLock (bool locked);
|
2012-12-03 21:44:16 +01:00
|
|
|
|
2012-12-13 13:35:08 +01:00
|
|
|
CSMWorld::UniversalId getUniversalId (int row) const;
|
|
|
|
|
2014-02-19 16:15:51 +01:00
|
|
|
std::vector<std::string> getColumnsWithDisplay(CSMWorld::ColumnBase::Display display) const;
|
|
|
|
|
2014-05-01 12:34:54 +02:00
|
|
|
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const;
|
2014-04-29 11:19:19 +02:00
|
|
|
|
2013-07-21 17:53:39 +02:00
|
|
|
signals:
|
|
|
|
|
2014-03-02 22:34:41 +01:00
|
|
|
void editRequest (const CSMWorld::UniversalId& id, const std::string& hint);
|
2013-07-21 17:53:39 +02:00
|
|
|
|
2013-07-25 14:29:56 +02: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 18:22:31 +02:00
|
|
|
void createRequest();
|
2014-04-30 13:32:54 +02:00
|
|
|
|
2014-01-21 08:27:29 +01:00
|
|
|
void cloneRequest(const CSMWorld::UniversalId&);
|
2013-07-26 18:22:31 +02:00
|
|
|
|
2012-12-03 21:44:16 +01:00
|
|
|
private slots:
|
|
|
|
|
2012-12-06 14:56:04 +01:00
|
|
|
void revertRecord();
|
2012-12-06 15:18:41 +01:00
|
|
|
|
|
|
|
void deleteRecord();
|
2013-07-21 17:53:39 +02:00
|
|
|
|
|
|
|
void editRecord();
|
2013-07-25 14:29:56 +02:00
|
|
|
|
2014-01-14 15:44:04 +01:00
|
|
|
void cloneRecord();
|
|
|
|
|
2013-11-14 11:39:14 +01:00
|
|
|
void moveUpRecord();
|
|
|
|
|
|
|
|
void moveDownRecord();
|
|
|
|
|
2014-03-02 22:43:44 +01:00
|
|
|
void viewRecord();
|
|
|
|
|
2014-03-10 12:44:34 +01:00
|
|
|
void previewRecord();
|
|
|
|
|
2013-07-25 14:29:56 +02:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void tableSizeUpdate();
|
|
|
|
|
|
|
|
void selectionSizeUpdate();
|
2013-07-26 18:22:31 +02:00
|
|
|
|
2013-07-29 15:00:41 +02:00
|
|
|
void requestFocus (const std::string& id);
|
|
|
|
|
2013-08-22 09:17:57 +02:00
|
|
|
void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter);
|
2014-04-24 12:50:10 -05:00
|
|
|
|
|
|
|
void updateUserSetting (const QString &name, const QStringList &list);
|
2012-11-29 19:09:06 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|