File indexing completed on 2024-05-05 04:55:40

0001 /**
0002  * \file testserverimporterbase.h
0003  * Base class for server importer tests.
0004  *
0005  * \b Project: Kid3
0006  * \author Urs Fleisch
0007  * \date 07 Oct 2012
0008  *
0009  * Copyright (C) 2012-2024  Urs Fleisch
0010  *
0011  * This file is part of Kid3.
0012  *
0013  * Kid3 is free software; you can redistribute it and/or modify
0014  * it under the terms of the GNU General Public License as published by
0015  * the Free Software Foundation; either version 2 of the License, or
0016  * (at your option) any later version.
0017  *
0018  * Kid3 is distributed in the hope that it will be useful,
0019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0021  * GNU General Public License for more details.
0022  *
0023  * You should have received a copy of the GNU General Public License
0024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0025  */
0026 
0027 #pragma once
0028 
0029 #include <QObject>
0030 
0031 class QNetworkAccessManager;
0032 class TrackDataModel;
0033 class ServerImporter;
0034 class ISettings;
0035 class ConfigStore;
0036 
0037 /**
0038  * Base class for server importer tests.
0039  */
0040 class TestServerImporterBase : public QObject {
0041   Q_OBJECT
0042 public:
0043   explicit TestServerImporterBase(QObject* parent = nullptr);
0044   ~TestServerImporterBase() override;
0045 
0046 public slots:
0047   void onFindFinished(const QByteArray& searchStr);
0048   void onAlbumFinished(const QByteArray& albumStr);
0049 
0050 signals:
0051   void albumsUpdated();
0052   void trackDataUpdated();
0053 
0054 protected:
0055   void setServerImporter(ServerImporter* importer);
0056   void setServerImporter(const QString& key);
0057   void queryAlbums(const QString& artist, const QString& album);
0058   void queryTracks(const QString& cat, const QString& id);
0059 
0060   QNetworkAccessManager* m_netMgr;
0061   TrackDataModel* m_trackDataModel;
0062   ServerImporter* m_importer;
0063   ISettings* m_settings;
0064   ConfigStore* m_configStore;
0065 };