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
|
|
|
|
2015-06-12 13:10:12 +00:00
|
|
|
#include <QEvent>
|
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"
|
2014-09-17 03:03:02 +00:00
|
|
|
#include "../../model/world/universalid.hpp"
|
2014-04-29 09:19:19 +00:00
|
|
|
#include "dragrecordtable.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;
|
2012-12-03 20:44:16 +00:00
|
|
|
class IdTableProxyModel;
|
2014-07-04 11:24:35 +00:00
|
|
|
class IdTableBase;
|
2014-06-06 10:43:21 +00:00
|
|
|
class CommandDispatcher;
|
2012-11-29 18:09:06 +00:00
|
|
|
}
|
|
|
|
|
2015-12-12 13:49:16 +00:00
|
|
|
namespace CSMPrefs
|
|
|
|
{
|
|
|
|
class Setting;
|
|
|
|
}
|
|
|
|
|
2012-11-29 18:09:06 +00:00
|
|
|
namespace CSVWorld
|
|
|
|
{
|
2012-11-30 12:58:10 +00:00
|
|
|
class CommandDelegate;
|
2015-07-04 15:51:39 +00:00
|
|
|
class TableEditIdAction;
|
2012-11-30 12:58:10 +00:00
|
|
|
|
2012-11-29 18:09:06 +00:00
|
|
|
///< Table widget
|
2014-04-29 09:19:19 +00:00
|
|
|
class Table : public DragRecordTable
|
2012-11-29 18:09:06 +00:00
|
|
|
{
|
2012-12-03 20:44:16 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2014-10-25 14:27:36 +00:00
|
|
|
enum DoubleClickAction
|
|
|
|
{
|
|
|
|
Action_None,
|
|
|
|
Action_InPlaceEdit,
|
|
|
|
Action_EditRecord,
|
|
|
|
Action_View,
|
|
|
|
Action_Revert,
|
|
|
|
Action_Delete,
|
|
|
|
Action_EditRecordAndClose,
|
|
|
|
Action_ViewAndClose
|
|
|
|
};
|
|
|
|
|
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;
|
2014-03-10 11:44:34 +00:00
|
|
|
QAction *mPreviewAction;
|
2014-06-11 09:43:38 +00:00
|
|
|
QAction *mExtendedDeleteAction;
|
|
|
|
QAction *mExtendedRevertAction;
|
2015-07-04 15:51:39 +00:00
|
|
|
TableEditIdAction *mEditIdAction;
|
2012-12-06 13:56:04 +00:00
|
|
|
CSMWorld::IdTableProxyModel *mProxyModel;
|
2014-07-04 11:24:35 +00:00
|
|
|
CSMWorld::IdTableBase *mModel;
|
2013-06-15 11:40:18 +00:00
|
|
|
int mRecordStatusDisplay;
|
2014-06-06 10:43:21 +00:00
|
|
|
CSMWorld::CommandDispatcher *mDispatcher;
|
2014-10-25 14:27:36 +00:00
|
|
|
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
|
2015-05-15 02:32:29 +00:00
|
|
|
bool mJumpToAddedRecord;
|
|
|
|
bool mUnselectAfterJump;
|
2014-09-15 17:15:32 +00:00
|
|
|
|
2012-12-03 20:44:16 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
void contextMenuEvent (QContextMenuEvent *event);
|
2012-11-30 12:58:10 +00:00
|
|
|
|
2014-02-04 10:40:48 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent *event);
|
|
|
|
|
2014-10-23 09:28:58 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void mouseDoubleClickEvent (QMouseEvent *event);
|
|
|
|
|
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
|
|
|
|
2014-04-29 17:43:58 +00:00
|
|
|
virtual 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;
|
|
|
|
|
2014-02-19 15:15:51 +00:00
|
|
|
std::vector<std::string> getColumnsWithDisplay(CSMWorld::ColumnBase::Display display) const;
|
|
|
|
|
2015-07-02 17:44:59 +00:00
|
|
|
std::vector<std::string> getSelectedIds() const;
|
|
|
|
|
2014-05-01 10:34:54 +00:00
|
|
|
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const;
|
2014-04-29 09:19:19 +00:00
|
|
|
|
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-04-30 11:32:54 +00:00
|
|
|
|
2014-01-21 07:27:29 +00:00
|
|
|
void cloneRequest(const CSMWorld::UniversalId&);
|
2013-07-26 16:22:31 +00:00
|
|
|
|
2014-10-25 14:27:36 +00:00
|
|
|
void closeRequest();
|
|
|
|
|
2015-07-02 17:44:59 +00:00
|
|
|
void extendedDeleteConfigRequest(const std::vector<std::string> &selectedIds);
|
|
|
|
|
|
|
|
void extendedRevertConfigRequest(const std::vector<std::string> &selectedIds);
|
|
|
|
|
2012-12-03 20:44:16 +00:00
|
|
|
private slots:
|
|
|
|
|
2014-09-17 03:03:02 +00:00
|
|
|
void editCell();
|
2014-09-15 17:15:32 +00:00
|
|
|
|
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();
|
|
|
|
|
2014-03-10 11:44:34 +00:00
|
|
|
void previewRecord();
|
|
|
|
|
2015-07-02 17:44:59 +00:00
|
|
|
void executeExtendedDelete();
|
|
|
|
|
|
|
|
void executeExtendedRevert();
|
|
|
|
|
2013-07-25 12:29:56 +00:00
|
|
|
public slots:
|
|
|
|
|
2015-12-12 13:49:16 +00:00
|
|
|
void settingChanged (const CSMPrefs::Setting *setting);
|
|
|
|
|
2013-07-25 12:29:56 +00:00
|
|
|
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);
|
2014-04-24 17:50:10 +00:00
|
|
|
|
2015-07-26 17:09:31 +00:00
|
|
|
void rowAdded(const std::string &id);
|
2012-11-29 18:09:06 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|