#include "tablemimedata.hpp" #include "universalid.hpp" #include CSMWorld::TableMimeData::TableMimeData (UniversalId id) { mUniversalId.push_back(id); mObjectsFormats << QString::fromStdString("application/Type_" + id.getTypeName()); } CSMWorld::TableMimeData::TableMimeData (std::vector< CSMWorld::UniversalId >& id) { mUniversalId = id; for (std::vector::iterator it(mUniversalId.begin()); it != mUniversalId.end(); ++it) { mObjectsFormats << QString::fromStdString("application/Type_" + it->getTypeName()); } } QStringList CSMWorld::TableMimeData::formats() const { return mObjectsFormats; } CSMWorld::TableMimeData::~TableMimeData() { } CSMWorld::UniversalId CSMWorld::TableMimeData::getId(unsigned int index) const { if (mUniversalId.empty()) { throw("TableMimeData holds no UniversalId"); } return mUniversalId[index]; } std::string CSMWorld::TableMimeData::getIcon() const { if (mUniversalId.empty()) { throw("TableMimeData holds no UniversalId"); } std::string tmpIcon; bool firstIteration = true; for (unsigned i = 0; i < mUniversalId.size(); ++i) { if (firstIteration) { firstIteration = false; tmpIcon = mUniversalId[i].getIcon(); continue; } if (tmpIcon != mUniversalId[i].getIcon()) { return ""; //should return multiple types icon, but at the moment we don't have one } tmpIcon = mUniversalId[i].getIcon(); } return mUniversalId.begin()->getIcon(); //All objects are of the same type; }