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
|
|
|
|
|
|
|
|
#include <QIcon>
|
2010-08-09 23:50:46 +02:00
|
|
|
#include <QStandardItemModel>
|
|
|
|
|
|
|
|
#include <boost/shared_ptr.hpp>
|
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:
|
2010-05-09 02:10:26 +02:00
|
|
|
LibraryDirectoryModel(LibraryBackend* backend, QObject* parent = 0);
|
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);
|
|
|
|
|
2010-07-19 21:56:29 +02:00
|
|
|
QVariant data(const QModelIndex &index, int role) const;
|
|
|
|
|
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);
|
|
|
|
void DirectoryDeleted(const Directory& directories);
|
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_;
|
2010-08-09 23:50:46 +02:00
|
|
|
QList<boost::shared_ptr<MusicStorage> > storage_;
|
2010-02-03 17:17:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LIBRARYDIRECTORYMODEL_H
|