File indexing completed on 2024-05-19 04:49:31

0001 
0002 /****************************************************************************************
0003  * Copyright (c) 2014 Ralf Engels <ralf-engels@gmx.de>                                  *
0004  *                                                                                      *
0005  * This program is free software; you can redistribute it and/or modify it under        *
0006  * the terms of the GNU General Public License as published by the Free Software        *
0007  * Foundation; either version 2 of the License, or (at your option) any later           *
0008  * version.                                                                             *
0009  *                                                                                      *
0010  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0012  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0013  *                                                                                      *
0014  * You should have received a copy of the GNU General Public License along with         *
0015  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0016  ****************************************************************************************/
0017 
0018 #ifndef AMAROK_STORAGE_FACTORY_H
0019 #define AMAROK_STORAGE_FACTORY_H
0020 
0021 #include "core/amarokcore_export.h"
0022 #include "core/support/PluginFactory.h"
0023 
0024 #include <QObject>
0025 #include <QSharedPointer>
0026 
0027 class SqlStorage;
0028 
0029 /** A plugin that provides a Storage object.
0030  *
0031  *  The storage plugin is the only part of Amarok that actually needs to be
0032  *  a plugin since we are linking two libraries (MySqlClient and MySqlEmbedded)
0033  *  that have the same symbols.
0034  *
0035  */
0036 class AMAROKCORE_EXPORT StorageFactory : public Plugins::PluginFactory
0037 {
0038     Q_OBJECT
0039 
0040 public:
0041     StorageFactory();
0042     ~StorageFactory() override;
0043 
0044 Q_SIGNALS:
0045     /** Emitted whenever the factory produces a new storage.
0046      *
0047      */
0048     void newStorage( QSharedPointer<SqlStorage> newStorage );
0049 
0050     /**
0051      *  The factories will not Q_EMIT the newStorage signal in case
0052      *  of initialization problems.
0053      *  In order to report their issues they will instead Q_EMIT
0054      *  newError with the list of errors.
0055      */
0056     void newError( const QStringList &errorMessageList );
0057 };
0058 
0059 #endif /* AMAROK_STORAGE_FACTORY_H */