1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 15:23:58 +00:00
openmw/apps/opencs/view/world/table.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

185 lines
4.4 KiB
C++
Raw Normal View History

#ifndef CSV_WORLD_TABLE_H
#define CSV_WORLD_TABLE_H
2022-10-19 17:02:00 +00:00
#include <map>
#include <memory>
#include <string>
2012-11-30 12:58:10 +00:00
#include <vector>
#include "../../model/world/columnbase.hpp"
2014-09-17 03:03:02 +00:00
#include "../../model/world/universalid.hpp"
#include "dragrecordtable.hpp"
class QAction;
2022-10-19 17:02:00 +00:00
class QContextMenuEvent;
class QDropEvent;
class QModelIndex;
class QMouseEvent;
class QObject;
namespace CSMFilter
{
class Node;
}
2014-03-06 12:51:21 +00:00
namespace CSMDoc
{
class Document;
}
namespace CSMWorld
{
class IdTableProxyModel;
class IdTableBase;
class CommandDispatcher;
}
namespace CSMPrefs
{
class Setting;
}
namespace CSVWorld
{
2012-11-30 12:58:10 +00:00
class CommandDelegate;
class TableEditIdAction;
2012-11-30 12:58:10 +00:00
///< Table widget
class Table : public DragRecordTable
{
2012-12-06 13:56:04 +00:00
Q_OBJECT
enum DoubleClickAction
2022-09-22 18:26:05 +00:00
{
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;
QAction* mEditAction;
QAction* mCreateAction;
2014-01-14 14:44:04 +00:00
QAction* mCloneAction;
QAction* mTouchAction;
QAction* mRevertAction;
2012-12-06 14:18:41 +00:00
QAction* mDeleteAction;
QAction* mMoveUpAction;
QAction* mMoveDownAction;
QAction* mViewAction;
QAction* mPreviewAction;
QAction* mExtendedDeleteAction;
QAction* mExtendedRevertAction;
QAction* mHelpAction;
TableEditIdAction* mEditIdAction;
2012-12-06 13:56:04 +00:00
CSMWorld::IdTableProxyModel* mProxyModel;
CSMWorld::IdTableBase* mModel;
int mRecordStatusDisplay;
CSMWorld::CommandDispatcher* mDispatcher;
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
bool mJumpToAddedRecord;
bool mUnselectAfterJump;
2021-07-24 20:00:25 +00:00
bool mAutoJump;
2014-02-04 10:40:48 +00:00
private:
void contextMenuEvent(QContextMenuEvent* event) override;
void mouseMoveEvent(QMouseEvent* event) override;
protected:
void mouseDoubleClickEvent(QMouseEvent* event) override;
2022-09-22 18:26:05 +00:00
public:
2014-03-06 12:51:21 +00:00
Table(const CSMWorld::UniversalId& id, bool createAndDelete, bool sorting, CSMDoc::Document& document);
///< \param createAndDelete Allow creation and deletion of records.
/// \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);
CSMWorld::UniversalId getUniversalId(int row) const;
std::vector<std::string> getColumnsWithDisplay(CSMWorld::ColumnBase::Display display) const;
std::vector<std::string> getSelectedIds() const;
std::vector<CSMWorld::UniversalId> getDraggedRecords() const override;
signals:
void editRequest(const CSMWorld::UniversalId& id, const std::string& hint);
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
void createRequest();
void createRecordsDirectlyRequest(const std::string& id);
2014-01-21 07:27:29 +00:00
void cloneRequest(const CSMWorld::UniversalId&);
void touchRequest(const std::vector<CSMWorld::UniversalId>& ids);
void closeRequest();
void extendedDeleteConfigRequest(const std::vector<std::string>& selectedIds);
void extendedRevertConfigRequest(const std::vector<std::string>& selectedIds);
private slots:
2014-09-17 03:03:02 +00:00
void editCell();
static void openHelp();
void editRecord();
2013-07-25 12:29:56 +00:00
2014-01-14 14:44:04 +00:00
void cloneRecord();
void touchRecord();
void moveUpRecord();
void moveDownRecord();
void moveRecords(QDropEvent* event);
void viewRecord();
void previewRecord();
void executeExtendedDelete();
void executeExtendedRevert();
2013-07-25 12:29:56 +00:00
public slots:
void settingChanged(const CSMPrefs::Setting* setting);
2013-07-25 12:29:56 +00:00
void tableSizeUpdate();
void selectionSizeUpdate();
void requestFocus(const std::string& id);
void recordFilterChanged(std::shared_ptr<CSMFilter::Node> filter);
void rowAdded(const std::string& id);
2021-07-24 20:00:25 +00:00
void dataChangedEvent(const QModelIndex& topLeft, const QModelIndex& bottomRight);
void jumpAfterModChanged(int state);
void queuedScrollTo(int state);
};
}
#endif