2010-03-24 00:11:46 +01:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-03-24 00:11:46 +01:00
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-02-03 17:17:04 +01:00
|
|
|
#ifndef LIBRARYDIRECTORYMODEL_H
|
|
|
|
#define LIBRARYDIRECTORYMODEL_H
|
|
|
|
|
2014-02-06 14:48:00 +01:00
|
|
|
#include <memory>
|
|
|
|
|
2010-02-03 17:17:04 +01:00
|
|
|
#include <QIcon>
|
2010-08-09 23:50:46 +02:00
|
|
|
#include <QStandardItemModel>
|
|
|
|
|
2010-02-03 17:17:04 +01:00
|
|
|
#include "directory.h"
|
|
|
|
|
2010-05-09 02:10:26 +02:00
|
|
|
class LibraryBackend;
|
2010-07-19 21:56:29 +02:00
|
|
|
class MusicStorage;
|
2010-02-03 17:17:04 +01:00
|
|
|
|
|
|
|
class LibraryDirectoryModel : public QStandardItemModel {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2014-02-10 16:03:54 +01:00
|
|
|
LibraryDirectoryModel(LibraryBackend* backend, QObject* parent = nullptr);
|
2010-07-19 21:56:29 +02:00
|
|
|
~LibraryDirectoryModel();
|
2010-02-03 17:17:04 +01:00
|
|
|
|
|
|
|
// To be called by GUIs
|
|
|
|
void AddDirectory(const QString& path);
|
|
|
|
void RemoveDirectory(const QModelIndex& index);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
QVariant data(const QModelIndex& index, int role) const;
|
2010-07-19 21:56:29 +02:00
|
|
|
|
2010-02-03 17:17:04 +01:00
|
|
|
private slots:
|
|
|
|
// To be called by the backend
|
2010-04-01 18:59:32 +02:00
|
|
|
void DirectoryDiscovered(const Directory& directories);
|
2020-01-25 20:59:33 +01:00
|
|
|
void DirectoryDeleted(int dir_id);
|
2010-02-03 17:17:04 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
static const int kIdRole = Qt::UserRole + 1;
|
|
|
|
|
|
|
|
QIcon dir_icon_;
|
2010-05-09 02:10:26 +02:00
|
|
|
LibraryBackend* backend_;
|
2014-02-06 14:48:00 +01:00
|
|
|
QList<std::shared_ptr<MusicStorage> > storage_;
|
2010-02-03 17:17:04 +01:00
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
#endif // LIBRARYDIRECTORYMODEL_H
|