mirror of
https://github.com/spalencsar/bearwave.git
synced 2026-07-07 22:54:15 +02:00
Prepare BearWave for public repository
This commit is contained in:
41
src/radiobrowser.h
Normal file
41
src/radiobrowser.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef RADIOBROWSER_H
|
||||
#define RADIOBROWSER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QList>
|
||||
|
||||
#include "radiostation.h"
|
||||
|
||||
class RadioBrowser : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RadioBrowser(QObject *parent = nullptr);
|
||||
|
||||
void search(const QString &query);
|
||||
void getTopStations(int count = 50);
|
||||
void getByCountry(const QString &countryCode);
|
||||
void getByTag(const QString &tag);
|
||||
void getWorldStations(int count = 200);
|
||||
void getGermanStations();
|
||||
void getDutchStations();
|
||||
|
||||
signals:
|
||||
void stationsLoaded(const QList<RadioStation*> &stations);
|
||||
void error(const QString &message);
|
||||
|
||||
private slots:
|
||||
void onReplyFinished();
|
||||
|
||||
private:
|
||||
QNetworkAccessManager *m_networkManager = nullptr;
|
||||
QString m_baseUrl = "https://de1.api.radio-browser.info/json";
|
||||
|
||||
void makeRequest(const QString &endpoint);
|
||||
QList<RadioStation*> parseJsonResponse(const QByteArray &jsonData);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user