2014-02-01 19:06:41 +01:00
|
|
|
#ifndef TABLEMIMEDATA_H
|
|
|
|
#define TABLEMIMEDATA_H
|
|
|
|
|
2014-02-04 18:30:47 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2014-02-09 15:33:00 +01:00
|
|
|
#include <QtCore/QMimeData>
|
2014-02-04 11:40:48 +01:00
|
|
|
#include <QStringList>
|
|
|
|
|
|
|
|
#include "universalid.hpp"
|
2014-02-13 10:21:49 +01:00
|
|
|
#include "columnbase.hpp"
|
2014-02-04 11:40:48 +01:00
|
|
|
|
2014-02-15 12:40:07 +01:00
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Document;
|
|
|
|
}
|
2014-02-01 19:06:41 +01:00
|
|
|
|
2014-02-04 09:13:40 +01:00
|
|
|
namespace CSMWorld
|
2014-02-01 19:06:41 +01:00
|
|
|
{
|
2014-02-14 14:04:36 +01:00
|
|
|
|
|
|
|
/// \brief Subclass of QmimeData, augmented to contain and transport UniversalIds.
|
|
|
|
///
|
|
|
|
/// This class provides way to construct mimedata object holding the universalid copy
|
|
|
|
/// Universalid is used in the majority of the tables to store type, id, argument types.
|
2016-04-07 11:55:49 +02:00
|
|
|
/// This way universalid grants a way to retrieve record from the concrete table.
|
2014-02-14 14:04:36 +01:00
|
|
|
/// Please note, that tablemimedata object can hold multiple universalIds in the vector.
|
|
|
|
|
2014-02-04 09:13:40 +01:00
|
|
|
class TableMimeData : public QMimeData
|
|
|
|
{
|
2014-03-21 12:13:54 +01:00
|
|
|
std::vector<UniversalId> mUniversalId;
|
|
|
|
QStringList mObjectsFormats;
|
|
|
|
const CSMDoc::Document& mDocument;
|
2014-02-04 09:13:40 +01:00
|
|
|
public:
|
2014-02-15 12:40:07 +01:00
|
|
|
TableMimeData(UniversalId id, const CSMDoc::Document& document);
|
|
|
|
|
2014-04-29 11:19:19 +02:00
|
|
|
TableMimeData(const std::vector<UniversalId>& id, const CSMDoc::Document& document);
|
2014-02-15 12:40:07 +01:00
|
|
|
|
2014-02-04 09:13:40 +01:00
|
|
|
~TableMimeData();
|
2014-02-15 12:40:07 +01:00
|
|
|
|
2014-02-04 09:13:40 +01:00
|
|
|
virtual QStringList formats() const;
|
2014-02-15 12:40:07 +01:00
|
|
|
|
2014-02-04 18:30:47 +01:00
|
|
|
std::string getIcon() const;
|
2014-02-15 12:40:07 +01:00
|
|
|
|
2014-02-04 19:42:52 +01:00
|
|
|
std::vector<UniversalId> getData() const;
|
2014-02-15 12:40:07 +01:00
|
|
|
|
2014-02-13 10:21:49 +01:00
|
|
|
bool holdsType(UniversalId::Type type) const;
|
2014-02-15 12:40:07 +01:00
|
|
|
|
2014-02-13 13:54:09 +01:00
|
|
|
bool holdsType(CSMWorld::ColumnBase::Display type) const;
|
2014-02-15 12:40:07 +01:00
|
|
|
|
|
|
|
bool fromDocument(const CSMDoc::Document& document) const;
|
|
|
|
|
2014-02-13 10:21:49 +01:00
|
|
|
UniversalId returnMatching(UniversalId::Type type) const;
|
2014-02-15 12:40:07 +01:00
|
|
|
|
2014-03-13 16:50:04 +01:00
|
|
|
const CSMDoc::Document* getDocumentPtr() const;
|
|
|
|
|
2014-02-13 13:54:09 +01:00
|
|
|
UniversalId returnMatching(CSMWorld::ColumnBase::Display type) const;
|
2014-02-01 19:06:41 +01:00
|
|
|
|
2014-02-19 11:22:47 +01:00
|
|
|
static CSMWorld::UniversalId::Type convertEnums(CSMWorld::ColumnBase::Display type);
|
2014-05-01 12:34:54 +02:00
|
|
|
|
2014-02-19 16:15:51 +01:00
|
|
|
static CSMWorld::ColumnBase::Display convertEnums(CSMWorld::UniversalId::Type type);
|
2014-02-19 11:22:47 +01:00
|
|
|
|
2014-09-08 23:14:04 +10:00
|
|
|
static bool isReferencable(CSMWorld::UniversalId::Type type);
|
2014-02-04 09:13:40 +01:00
|
|
|
private:
|
2014-03-21 12:13:54 +01:00
|
|
|
bool isReferencable(CSMWorld::ColumnBase::Display type) const;
|
2014-02-15 13:23:51 +01:00
|
|
|
|
2014-02-04 09:13:40 +01:00
|
|
|
};
|
|
|
|
}
|
2014-09-07 06:29:09 +10:00
|
|
|
#endif // TABLEMIMEDATA_H
|