TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musictranslationrequest.cpp
Go to the documentation of this file.
6 
8  : MusicAbstractNetwork(parent),
9  m_pluginIndex(-1)
10 {
11 
12 }
13 
15 {
16  m_pluginIndex = -1;
18 }
19 
21 {
22  if(bytes.isEmpty())
23  {
25  return;
26  }
27 
28  Q_EMIT downLoadDataChanged(bytes);
29  deleteLater();
30 }
31 
33 {
35  switch(++m_pluginIndex)
36  {
37  case 0: d = new MusicWYTranslationRequest(this); break;
38  case 1: d = new MusicBingTranslationRequest(this); break;
39  case 2: d = new MusicYDTranslationRequest(this); break;
40  case 3: d = new MusicBDTranslationRequest(this); break;
41  default: deleteLater(); break;
42  }
43 
44  if(d)
45  {
46  connect(d, SIGNAL(downLoadDataChanged(QString)), SLOT(downLoadDataFinished(QString)));
47  //
48  d->setHeader("name", header("name"));
49  d->startToRequest(header("data").toString());
50  }
51 }
MusicTranslationRequest(QObject *parent=nullptr)
void downLoadDataChanged(const QString &bytes)
The class of the wangyi translation words request.
The class of the translation words request.
The class of the bing translation words request.
virtual void startToRequest(const QString &data)=0
void downLoadDataFinished(const QString &bytes)
const QVariant header(const QString &key) const
The class of the abstract network.
void setHeader(const QString &key, const QVariant &value)
TTK_MODULE_EXPORT QString toString(Record type)
The class of the baidu translation words request.
The class of the yandex translation words request.