1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-20 22:23:52 +00:00
openmw/apps/opencs/view/tools/reporttable.hpp

102 lines
2.4 KiB
C++
Raw Normal View History

2014-12-06 12:01:55 +00:00
#ifndef CSV_TOOLS_REPORTTABLE_H
#define CSV_TOOLS_REPORTTABLE_H
#include <map>
2014-12-06 12:01:55 +00:00
#include "../world/dragrecordtable.hpp"
2014-12-06 13:17:56 +00:00
class QAction;
class QSortFilterProxyModel;
2014-12-06 13:17:56 +00:00
2014-12-06 12:01:55 +00:00
namespace CSMTools
{
class ReportModel;
}
namespace CSMPrefs
{
class Setting;
}
2014-12-06 12:01:55 +00:00
namespace CSVWorld
{
class CommandDelegate;
}
namespace CSVTools
{
class ReportTable : public CSVWorld::DragRecordTable
{
2022-09-22 18:26:05 +00:00
Q_OBJECT
2014-12-06 12:01:55 +00:00
2022-09-22 18:26:05 +00:00
enum DoubleClickAction
{
Action_None,
Action_Edit,
Action_Remove,
Action_EditAndRemove
};
2022-09-22 18:26:05 +00:00
QSortFilterProxyModel* mProxyModel;
CSMTools::ReportModel* mModel;
CSVWorld::CommandDelegate* mIdTypeDelegate;
QAction* mShowAction;
QAction* mRemoveAction;
QAction* mReplaceAction;
QAction* mRefreshAction;
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
int mRefreshState;
2014-12-06 12:01:55 +00:00
2022-09-22 18:26:05 +00:00
private:
void contextMenuEvent(QContextMenuEvent* event) override;
2014-12-06 12:19:43 +00:00
2022-09-22 18:26:05 +00:00
void mouseMoveEvent(QMouseEvent* event) override;
2014-12-06 13:17:56 +00:00
2022-09-22 18:26:05 +00:00
void mouseDoubleClickEvent(QMouseEvent* event) override;
2014-12-06 12:19:43 +00:00
2022-09-22 18:26:05 +00:00
public:
/// \param richTextDescription Use rich text in the description column.
/// \param refreshState Document state to check for refresh function. If value is
/// 0 no refresh function exists. If the document current has the specified state
/// the refresh function is disabled.
ReportTable(CSMDoc::Document& document, const CSMWorld::UniversalId& id, bool richTextDescription,
int refreshState = 0, QWidget* parent = nullptr);
2022-09-22 18:26:05 +00:00
std::vector<CSMWorld::UniversalId> getDraggedRecords() const override;
2014-12-06 12:01:55 +00:00
2022-09-22 18:26:05 +00:00
void clear();
2014-12-06 12:01:55 +00:00
2022-09-22 18:26:05 +00:00
/// Return indices of rows that are suitable for replacement.
///
/// \param selection Only list selected rows.
///
/// \return rows in the original model
std::vector<int> getReplaceIndices(bool selection) const;
2014-12-06 12:01:55 +00:00
2022-09-22 18:26:05 +00:00
/// \param index row in the original model
void flagAsReplaced(int index);
2022-09-22 18:26:05 +00:00
private slots:
2015-04-16 16:50:22 +00:00
2022-09-22 18:26:05 +00:00
void settingChanged(const CSMPrefs::Setting* setting);
2015-04-16 16:50:22 +00:00
2022-09-22 18:26:05 +00:00
void showSelection();
2014-12-06 12:01:55 +00:00
2022-09-22 18:26:05 +00:00
void removeSelection();
2022-09-22 18:26:05 +00:00
public slots:
2014-12-06 13:17:56 +00:00
2022-09-22 18:26:05 +00:00
void stateChanged(int state, CSMDoc::Document* document);
2022-09-22 18:26:05 +00:00
signals:
2022-09-22 18:26:05 +00:00
void editRequest(const CSMWorld::UniversalId& id, const std::string& hint);
2022-09-22 18:26:05 +00:00
void replaceRequest();
2014-12-06 12:01:55 +00:00
2022-09-22 18:26:05 +00:00
void refreshRequest();
2014-12-06 12:01:55 +00:00
};
}
#endif