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;
|
|
|
|
|
2014-12-06 12:01:55 +00:00
|
|
|
namespace CSMTools
|
|
|
|
{
|
|
|
|
class ReportModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace CSVWorld
|
|
|
|
{
|
|
|
|
class CommandDelegate;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace CSVTools
|
|
|
|
{
|
|
|
|
class ReportTable : public CSVWorld::DragRecordTable
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2015-06-18 14:36:27 +00:00
|
|
|
enum DoubleClickAction
|
|
|
|
{
|
|
|
|
Action_None,
|
|
|
|
Action_Edit,
|
|
|
|
Action_Remove,
|
|
|
|
Action_EditAndRemove
|
|
|
|
};
|
|
|
|
|
2014-12-06 12:01:55 +00:00
|
|
|
CSMTools::ReportModel *mModel;
|
|
|
|
CSVWorld::CommandDelegate *mIdTypeDelegate;
|
2014-12-06 13:17:56 +00:00
|
|
|
QAction *mShowAction;
|
2014-12-06 13:30:40 +00:00
|
|
|
QAction *mRemoveAction;
|
2015-04-16 16:50:22 +00:00
|
|
|
QAction *mReplaceAction;
|
2015-06-25 10:03:40 +00:00
|
|
|
QAction *mRefreshAction;
|
2015-06-18 14:36:27 +00:00
|
|
|
std::map<Qt::KeyboardModifiers, DoubleClickAction> mDoubleClickActions;
|
2015-06-25 10:03:40 +00:00
|
|
|
int mRefreshState;
|
2014-12-06 12:01:55 +00:00
|
|
|
|
2014-12-06 12:19:43 +00:00
|
|
|
private:
|
|
|
|
|
2014-12-06 13:17:56 +00:00
|
|
|
void contextMenuEvent (QContextMenuEvent *event);
|
|
|
|
|
2014-12-06 12:19:43 +00:00
|
|
|
void mouseMoveEvent (QMouseEvent *event);
|
|
|
|
|
2014-12-06 14:08:51 +00:00
|
|
|
virtual void mouseDoubleClickEvent (QMouseEvent *event);
|
|
|
|
|
2014-12-06 12:01:55 +00:00
|
|
|
public:
|
|
|
|
|
2015-03-30 10:52:08 +00:00
|
|
|
/// \param richTextDescription Use rich text in the description column.
|
2015-06-25 10:03:40 +00:00
|
|
|
/// \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.
|
2014-12-06 12:01:55 +00:00
|
|
|
ReportTable (CSMDoc::Document& document, const CSMWorld::UniversalId& id,
|
2015-06-25 10:03:40 +00:00
|
|
|
bool richTextDescription, int refreshState = 0, QWidget *parent = 0);
|
2014-12-06 12:01:55 +00:00
|
|
|
|
|
|
|
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const;
|
|
|
|
|
|
|
|
void updateUserSetting (const QString& name, const QStringList& list);
|
|
|
|
|
2015-03-28 11:53:01 +00:00
|
|
|
void clear();
|
|
|
|
|
2015-04-16 16:50:22 +00:00
|
|
|
// Return indices of rows that are suitable for replacement.
|
|
|
|
//
|
|
|
|
// \param selection Only list selected rows.
|
|
|
|
std::vector<int> getReplaceIndices (bool selection) const;
|
|
|
|
|
|
|
|
void flagAsReplaced (int index);
|
|
|
|
|
2014-12-06 12:01:55 +00:00
|
|
|
private slots:
|
|
|
|
|
2014-12-06 13:17:56 +00:00
|
|
|
void showSelection();
|
|
|
|
|
2014-12-06 13:30:40 +00:00
|
|
|
void removeSelection();
|
|
|
|
|
2014-12-06 12:01:55 +00:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void editRequest (const CSMWorld::UniversalId& id, const std::string& hint);
|
2015-04-16 16:50:22 +00:00
|
|
|
|
|
|
|
void replaceRequest();
|
2015-06-25 10:03:40 +00:00
|
|
|
|
|
|
|
void refreshRequest();
|
2014-12-06 12:01:55 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|