diff --git a/filesync/fileparser.cpp b/filesync/fileparser.cpp index dc90a9c..3761ce3 100644 --- a/filesync/fileparser.cpp +++ b/filesync/fileparser.cpp @@ -84,9 +84,9 @@ void FileParSer::getItemCountList(QString path, FileParSer::KeyType type, QMap &map, QString flag) +void FileParSer::getFileInfoList(QString path, QList &list, QString flag) { - map.clear(); + list.clear(); QFile *file = new QFile(path); if (!file->open(QIODevice::ReadOnly)) { // 打开文件失败 @@ -123,7 +123,7 @@ void FileParSer::getFileInfoList(QString path, QMap &map, QSt fileInfo.setThumbnailPath(path.mid(0, path.lastIndexOf("/")) + "/thumbnail/" + flag + thumbPath.mid(thumbPath.lastIndexOf("/") + 1, thumbPath.size())); } - map.insert(fileInfo.name(), fileInfo); + list.append(fileInfo); } file->close(); file->deleteLater(); diff --git a/filesync/fileparser.h b/filesync/fileparser.h index d31e3cc..f6bff73 100644 --- a/filesync/fileparser.h +++ b/filesync/fileparser.h @@ -38,7 +38,7 @@ public: void getItemCountList(QString path, FileParSer::KeyType type, QMap &map); // 获取文件信息 - void getFileInfoList(QString path, QMap &map, QString flag = ""); + void getFileInfoList(QString path, QList &list, QString flag = ""); // 获取缩略图列表 void getThumbList(QString path, QStringList &list); diff --git a/filesync/filesyncmanage.cpp b/filesync/filesyncmanage.cpp index c983243..8139ae5 100644 --- a/filesync/filesyncmanage.cpp +++ b/filesync/filesyncmanage.cpp @@ -81,25 +81,24 @@ void FileSyncManage::getItemCount(FileParSer::KeyType type, QMap &map) } void FileSyncManage::getClassifiedFileList(FileSyncManage::FileKey key, FileSyncManage::FileType type, - QMap &map) + QList &list) { - map.clear(); qInfo() << "Get classification file list..."; int index = getIndex(key, type); switch (type) { case FileType::Picture: - m_fileParser->getFileInfoList(FILE_DOWN_PATH + m_uuid + "/" + CONFIG_FILE_LIST.value(index), map, + m_fileParser->getFileInfoList(FILE_DOWN_PATH + m_uuid + "/" + CONFIG_FILE_LIST.value(index), list, FLAGE_LIST.value(key) + PICTURE_FLAGE); break; case FileType::Video: - m_fileParser->getFileInfoList(FILE_DOWN_PATH + m_uuid + "/" + CONFIG_FILE_LIST.value(index), map, + m_fileParser->getFileInfoList(FILE_DOWN_PATH + m_uuid + "/" + CONFIG_FILE_LIST.value(index), list, FLAGE_LIST.value(key) + VIDEO_FLAGE); break; case FileType::Music: - m_fileParser->getFileInfoList(FILE_DOWN_PATH + m_uuid + "/" + CONFIG_FILE_LIST.value(index), map); + m_fileParser->getFileInfoList(FILE_DOWN_PATH + m_uuid + "/" + CONFIG_FILE_LIST.value(index), list); break; case FileType::Doc: - m_fileParser->getFileInfoList(FILE_DOWN_PATH + m_uuid + "/" + CONFIG_FILE_LIST.value(index), map); + m_fileParser->getFileInfoList(FILE_DOWN_PATH + m_uuid + "/" + CONFIG_FILE_LIST.value(index), list); break; } } diff --git a/filesync/filesyncmanage.h b/filesync/filesyncmanage.h index 3f815c6..afc6fa9 100644 --- a/filesync/filesyncmanage.h +++ b/filesync/filesyncmanage.h @@ -44,8 +44,7 @@ public: void getItemCount(FileParSer::KeyType type, QMap &map); // 获取分类列表 - void getClassifiedFileList(FileSyncManage::FileKey key, FileSyncManage::FileType type, - QMap &map); + void getClassifiedFileList(FileSyncManage::FileKey key, FileSyncManage::FileType type, QList &lsit); void updateFileInfo(FileSyncManage::FileKey key, FileSyncManage::FileType type);