X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Ffilelistmodel.cpp;h=626b296d9b637af178649f089da61cb4d164e421;hb=a7c352a26c0fbd32d85f3248a12d661c0bec4ac1;hp=09389b86289043e5afd7b2d93af51bc2a4794aa9;hpb=b79e71ad6d2f71a2c1ccacb3d37ff02be60f2538;p=virtualjaguar diff --git a/src/gui/filelistmodel.cpp b/src/gui/filelistmodel.cpp index 09389b8..626b296 100644 --- a/src/gui/filelistmodel.cpp +++ b/src/gui/filelistmodel.cpp @@ -57,6 +57,12 @@ QVariant FileListModel::data(const QModelIndex & index, int role) const return list.at(index.row()).filename; else if (role == FLM_FILESIZE) return (uint)list.at(index.row()).fileSize; + else if (role == FLM_UNIVERSALHDR) + return (uint)list.at(index.row()).hasUniversalHeader; + else if (role == FLM_FILETYPE) + return (uint)list.at(index.row()).fileType; + else if (role == FLM_CRC) + return (uint)list.at(index.row()).crc; return QVariant(); #endif @@ -111,6 +117,36 @@ void FileListModel::AddData(unsigned long index, QString str, QImage img, unsign reset(); } +void FileListModel::AddData(unsigned long index, QString str, QImage img, unsigned long size, bool univHdr, uint32_t type, uint32_t fileCrc) +{ + // Assuming that both QString and QImage have copy constructors, this should work. + FileListData data; + + data.dbIndex = index; + data.fileSize = size; + data.filename = str; + data.label = img; + data.hasUniversalHeader = univHdr; + data.fileType = type; + data.crc = fileCrc; + + list.push_back(data); +//This is probably not the best way to do this, it prevents the user from using the +//list while it populates. +#warning "!!! AddData calls reset() for every addition, this is bad !!!" + reset(); +} + +void FileListModel::ClearData(void) +{ + if (list.size() == 0) + return; + + beginResetModel(); + list.clear(); + endResetModel(); +} + //FileListData FileListModel::GetData(const QModelIndex & index) const //{ // return list.at(index.row());