RemoteVstPlugin: fixed too short arrays for preset names
[lmms.git] / include / LocalResourceProvider.h
blob14d3feb459668df55dee363b4c6105751a4c9420
1 /*
2 * LocalResourceProvider.h - header file for LocalResourceProvider
4 * Copyright (c) 2009-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
25 #ifndef _LOCAL_RESOURCE_PROVIDER_H
26 #define _LOCAL_RESOURCE_PROVIDER_H
28 #include <QtCore/QFileSystemWatcher>
29 #include <QtCore/QStringList>
31 #include "ResourceProvider.h"
32 #include "ResourceItem.h"
35 /*! \brief The LocalResourceProvider class provides a ResourceProvider
36 * implementation which serves data from local files.
38 * This class crawls a given directory and provides a ResourceDB with all
39 * retrieved information inside. Additionally it monitors all (sub-)directories
40 * for changes and immediately updates the database. #fetchData() simply reads
41 * the according local file.
44 class EXPORT LocalResourceProvider : public ResourceProvider
46 Q_OBJECT
47 public:
48 LocalResourceProvider( ResourceItem::BaseDirectory _baseDir,
49 const QString & _dir );
50 virtual ~LocalResourceProvider();
52 virtual QString providerName() const
54 return "LocalResourceProvider";
57 virtual void updateDatabase();
59 virtual int dataSize( const ResourceItem * _item ) const;
60 virtual QByteArray fetchData( const ResourceItem * _item,
61 int _maxSize = -1 ) const;
63 virtual bool isLocal() const
65 return true;
69 private slots:
70 void addDirectory( const QString & _path );
71 void removeDirectory( const QString & _path );
72 void reloadDirectory( const QString & _path );
75 private:
76 void readDir( const QString & _dir, ResourceItem::Relation * _parent );
78 ResourceItem::BaseDirectory m_baseDir;
79 const QString m_dir;
81 QStringList m_scannedFolders;
83 QFileSystemWatcher m_watcher;
85 } ;
88 #endif