代码拉取完成,页面将自动刷新
#ifndef NETWORK_H
#define NETWORK_H
#include <QObject>
#include <QtNetwork>
#include "Song.h"
class NetPlayList {
public:
QString name;
unsigned id;
};
class Network;
class SongUrlProcess : public QObject{
Q_OBJECT
public :
SongUrlProcess(QNetworkAccessManager *manager, QUrl baseUrl);
void sendRequest(Song song);
void conn();
friend Network;
private:
Song m_song;
QNetworkAccessManager *manager;
QNetworkReply *getSongUrlReply;
QUrl baseUrl;
private slots:
void getSongUrlSlot();
signals:
void getSongUrlDone(Song song);
};
class Network :public QObject
{
Q_OBJECT
private:
QNetworkAccessManager manager;
QUrl baseUrl;
public:
Network(const QUrl &baseUrl);
void search(QString keywords, int limit = 30, int offset = 0);
void getSongUrl(Song song);
void getLyric(unsigned id);
void getPlayList();
void getPlayListById(unsigned id);
void logout();
SongUrlProcess songUrlProcess;
unsigned userId;
QString nickname;
public slots:
void login(QString user, QString password);
private :
QNetworkReply *searchReply, *getLyricReply, *loginReply, *playListReply, *playListByIdReply, *logoutReply;
QString cookie;
private slots:
void processSearch(QNetworkReply *);
void searchreadyReadSlot();
void loginReplySlot();
void getLyricReadyReadSlot();
void playListReadyReadSlot();
void playListByIdReadyReadSlot();
void logoutReadyReadSlot();
signals :
void searchDone(SongList);
void getLyricDone(QString lyric);
void loginResult(bool);
void getPlayListDone(QList<NetPlayList>);
void getPlayListByIdDone(SongList);
void logoutSignal(bool);
};
#endif // NETWORK_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。