1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2023 LoRd_MuldeR <MuldeR2@GMX.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU GENERAL PUBLIC LICENSE as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version; always including the non-optional
9 // LAMEXP GNU GENERAL PUBLIC LICENSE ADDENDUM. See "License.txt" file!
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
25 #include "Model_AudioFile.h"
27 #include <QAbstractTableModel>
30 class FileListModel : public QAbstractTableModel
39 int columnCount(const QModelIndex &parent = QModelIndex()) const;
40 int rowCount(const QModelIndex &parent = QModelIndex()) const;
41 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
42 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
45 bool removeFile(const QModelIndex &index);
46 void clearFiles(void);
47 bool moveFile(const QModelIndex &index, int delta);
48 const AudioFileModel &getFile(const QModelIndex &index);
49 bool setFile(const QModelIndex &index, const AudioFileModel &audioFile);
50 AudioFileModel &operator[] (const QModelIndex &index);
53 int exportToCsv(const QString &outFile);
54 int importFromCsv(QWidget *parent, const QString &inFile);
61 CsvError_FileOpen = 2,
62 CsvError_FileRead = 3,
63 CsvError_FileWrite = 4,
64 CsvError_Incomplete = 5,
70 void setBlockUpdates(bool flag)
72 m_blockUpdates = flag;
76 const AudioFileModel m_nullAudioFile;
79 void addFile(const QString &filePath);
80 void addFile(const AudioFileModel &file);
83 void rowAppended(void);
87 QList<QString> m_fileList;
88 QHash<QString, AudioFileModel> m_fileStore;
89 const QIcon m_fileIcon;
91 QString int2str(const int &value) const;
92 static bool checkArray(const bool *a, const bool val, size_t len);