2014-12-06 12:01:55 +00:00
|
|
|
#ifndef CSV_TOOLS_REPORTTABLE_H
|
|
|
|
#define CSV_TOOLS_REPORTTABLE_H
|
|
|
|
|
2015-06-18 14:36:27 +00:00
|
|
|
#include <map>
|
|
|
|
|
2014-12-06 12:01:55 +00:00
|
|
|
#include "../world/dragrecordtable.hpp"
|
|
|
|
|
2014-12-06 13:17:56 +00:00
|
|
|
class QAction;
|
2015-07-03 08:45:08 +00:00
|
|
|
class QSortFilterProxyModel;
|
2014-12-06 13:17:56 +00:00
|
|
|
|
2014-12-06 12:01:55 +00:00
|
|
|
namespace CSMTools
|
|
|
|
{
|
|
|
|
class ReportModel;
|
|
|
|
}
|
|
|
|
|
2015-12-14 16:38:33 +00:00
|
|
|
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
|
|
|
|
};
|
2015-07-03 08:45:08 +00:00
|
|
|
|
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);
|
2014-12-06 14:08:51 +00:00
|
|
|
|
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);
|
2015-03-28 11:53:01 +00:00
|
|
|
|
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();
|
2015-12-14 16:38:33 +00:00
|
|
|
|
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);
|
2014-12-06 13:30:40 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
signals:
|
2015-06-25 11:05:57 +00:00
|
|
|
|
2022-09-22 18:26:05 +00:00
|
|
|
void editRequest(const CSMWorld::UniversalId& id, const std::string& hint);
|
2015-07-03 08:45:08 +00:00
|
|
|
|
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
|