Files
ANSLIB/MediaClient/MediaClientForMobile/FileListModel.h
2026-03-28 11:39:04 +11:00

69 lines
2.1 KiB
C++

/***************************************************************************************
*
* 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 <QAbstractListModel>
#include <QList>
#include <QStringList>
#define FILE_FORMAT_PIC 0
#define FILE_FORMAT_VIDEO 1
typedef QList<bool> 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