/*************************************************************************************** * * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. * * By downloading, copying, installing or using the software you agree to this license. * If you do not agree to this license, do not download, install, * copy or use the software. * * Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved. * * Redistribution and use in binary forms, with or without modification, are permitted. * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. * ****************************************************************************************/ #ifndef FILELISTMODEL_H #define FILELISTMODEL_H #include #include #include #define FILE_FORMAT_PIC 0 #define FILE_FORMAT_VIDEO 1 typedef QList QBoolList; class FileListModel : public QAbstractListModel { Q_OBJECT public: FileListModel(int fileFormat, QObject *parent = 0); int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; Qt::ItemFlags flags(const QModelIndex &index) const; bool setData(const QModelIndex &index, const QVariant &value, int role); void setCheckable(bool checkable); void setNameFilters(const QStringList &filters); bool removeRows(int pos, int count, const QModelIndex &parent = QModelIndex()); public slots: void setDirPath(const QString &path); protected: bool canFetchMore(const QModelIndex &parent) const; void fetchMore(const QModelIndex &parent); private: QStringList m_nameFilters; QStringList m_fileList; QBoolList m_boolList; int m_fileCount; bool m_bCheckable; QString m_basePath; int m_fileFormat; }; #endif // FILELISTMODEL_H