2014-04-10 20:12:09 +00:00
|
|
|
#ifndef CSV_WORLD_REGIONMAP_H
|
|
|
|
#define CSV_WORLD_REGIONMAP_H
|
|
|
|
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <QModelIndexList>
|
|
|
|
|
|
|
|
#include <string>
|
2014-04-29 10:27:26 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "./dragrecordtable.hpp"
|
|
|
|
|
2014-04-10 20:12:09 +00:00
|
|
|
class QAction;
|
2022-10-19 17:02:00 +00:00
|
|
|
class QContextMenuEvent;
|
|
|
|
class QDropEvent;
|
|
|
|
class QMouseEvent;
|
|
|
|
class QObject;
|
|
|
|
class QWidget;
|
2014-04-13 12:17:18 +00:00
|
|
|
|
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Document;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class UniversalId;
|
|
|
|
}
|
2014-04-10 20:12:09 +00:00
|
|
|
|
|
|
|
namespace CSVWorld
|
|
|
|
{
|
2014-04-29 10:27:26 +00:00
|
|
|
class RegionMap : public DragRecordTable
|
2014-04-10 20:12:09 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
QAction* mSelectAllAction;
|
|
|
|
QAction* mClearSelectionAction;
|
|
|
|
QAction* mSelectRegionsAction;
|
2014-04-13 12:17:18 +00:00
|
|
|
QAction* mCreateCellsAction;
|
2014-04-13 13:32:49 +00:00
|
|
|
QAction* mSetRegionAction;
|
|
|
|
QAction* mUnsetRegionAction;
|
2014-04-13 13:46:31 +00:00
|
|
|
QAction* mViewAction;
|
2014-04-13 14:40:16 +00:00
|
|
|
QAction* mViewInTableAction;
|
2014-04-13 13:32:49 +00:00
|
|
|
std::string mRegionId;
|
2014-04-10 20:12:09 +00:00
|
|
|
|
|
|
|
private:
|
2020-10-16 18:18:54 +00:00
|
|
|
void contextMenuEvent(QContextMenuEvent* event) override;
|
2014-04-10 20:12:09 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
QModelIndexList getUnselectedCells() const;
|
|
|
|
///< \note Non-existent cells are not listed.
|
2014-04-10 20:12:09 +00:00
|
|
|
|
|
|
|
QModelIndexList getSelectedCells(bool existent = true, bool nonExistent = false) const;
|
2014-04-13 12:17:18 +00:00
|
|
|
///< \param existent Include existent cells.
|
|
|
|
/// \param nonExistent Include non-existent cells.
|
|
|
|
|
|
|
|
QModelIndexList getMissingRegionCells() const;
|
2016-12-14 15:39:33 +00:00
|
|
|
///< Unselected cells within all regions that have at least one selected cell.
|
2014-04-10 20:12:09 +00:00
|
|
|
|
|
|
|
void setRegion(const std::string& regionId);
|
|
|
|
///< Set region Id of selected cells.
|
|
|
|
|
2014-04-13 13:32:49 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent* event) override;
|
|
|
|
|
2024-03-16 07:45:52 +00:00
|
|
|
void dragMoveEvent(QDragMoveEvent* event) override;
|
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void dropEvent(QDropEvent* event) override;
|
2014-04-29 09:19:19 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
public:
|
2020-10-16 18:18:54 +00:00
|
|
|
RegionMap(const CSMWorld::UniversalId& universalId, CSMDoc::Document& document, QWidget* parent = nullptr);
|
2014-04-30 11:32:54 +00:00
|
|
|
|
2014-04-10 20:12:09 +00:00
|
|
|
std::vector<CSMWorld::UniversalId> getDraggedRecords() const override;
|
|
|
|
|
2014-04-13 12:17:18 +00:00
|
|
|
signals:
|
2014-04-10 20:12:09 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void editRequest(const CSMWorld::UniversalId& id, const std::string& hint);
|
2014-04-29 10:27:26 +00:00
|
|
|
|
2014-04-13 13:46:31 +00:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void selectAll() override;
|
|
|
|
|
2014-04-10 20:12:09 +00:00
|
|
|
void clearSelection();
|
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void selectRegions();
|
2014-04-10 20:12:09 +00:00
|
|
|
|
|
|
|
void createCells();
|
|
|
|
|
|
|
|
void setRegion();
|
2014-04-13 12:17:18 +00:00
|
|
|
|
|
|
|
void unsetRegion();
|
2014-04-13 13:32:49 +00:00
|
|
|
|
|
|
|
void view();
|
|
|
|
|
2014-04-13 14:40:16 +00:00
|
|
|
void viewInTable();
|
2014-04-10 20:12:09 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|