X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Ffilelistmodel.cpp;h=8308c5c946123c3511c1eb07f7b776e8519c1123;hb=f24ae2128609d5ab8c9a57dfd9dbb46afb7302a9;hp=c35bd35944ca84ac9a49c30ed0d95e54ff016a8d;hpb=caf1236884015695c52910a75b8420be7c63d574;p=virtualjaguar diff --git a/src/gui/filelistmodel.cpp b/src/gui/filelistmodel.cpp index c35bd35..8308c5c 100644 --- a/src/gui/filelistmodel.cpp +++ b/src/gui/filelistmodel.cpp @@ -36,14 +36,36 @@ QVariant FileListModel::data(const QModelIndex & index, int role) const // return QVariant(); // return pixList.at(index.row()); // return (uint)dbIndex.at(index.row()); +//It could be that this is fucking things up... +#if 0 if (role == Qt::DecorationRole) return list.at(index.row()).label; else if (role == Qt::DisplayRole) return (uint)list.at(index.row()).dbIndex; else if (role == Qt::EditRole) return list.at(index.row()).filename; + else if (role == Qt::WhatsThisRole) + return (uint)list.at(index.row()).fileSize; else return QVariant(); +#else + if (role == FLM_LABEL) + return list.at(index.row()).label; + else if (role == FLM_INDEX) + return (uint)list.at(index.row()).dbIndex; + else if (role == FLM_FILENAME) + 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 } QVariant FileListModel::headerData(int/* section*/, Qt::Orientation/* orientation*/, int role/*= Qt::DisplayRole*/) const @@ -67,6 +89,7 @@ QVariant FileListModel::headerData(int/* section*/, Qt::Orientation/* orientatio #endif } +/* void FileListModel::AddData(QIcon pix) { pixList.push_back(pix); @@ -78,20 +101,49 @@ void FileListModel::AddData(unsigned long index) dbIndex.push_back(index); reset(); } +*/ + +void FileListModel::AddData(unsigned long index, QString str, QImage img, unsigned long size) +{ + // 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; + + list.push_back(data); + reset(); +} -void FileListModel::AddData(unsigned long index, QString str, QImage img) +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); 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());