TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicabstractqueryrequest.cpp
Go to the documentation of this file.
2 
4  : MusicPageQueryRequest(parent),
5  m_queryServer("Invalid"),
6  m_queryType(QueryType::Music),
7  m_queryMode(QueryMode::Normal)
8 {
9 
10 }
11 
13 {
14  Q_UNUSED(value);
15 }
16 
18 {
19  Q_UNUSED(bitrate);
21  {
22  if(var.m_songId == info->m_songId)
23  {
24  var.m_songProps = info->m_songProps;
25  break;
26  }
27  }
28 }
29 
31 {
32  Q_EMIT clearItems();
33  m_items.clear();
35 }
36 
38 {
39  const QString &v = tr("Current used server from %1");
40  if(m_queryServer.contains(QUERY_KG_INTERFACE))
41  {
42  return v.arg(tr("KG"));
43  }
44  else if(m_queryServer.contains(QUERY_KW_INTERFACE))
45  {
46  return v.arg(tr("KW"));
47  }
48  else if(m_queryServer.contains(QUERY_WY_INTERFACE))
49  {
50  return v.arg(tr("WY"));
51  }
52  else if(!m_queryServer.isEmpty())
53  {
54  return v.arg(m_queryServer);
55  }
56  else
57  {
58  return {};
59  }
60 }
61 
62 bool MusicAbstractQueryRequest::findUrlPathSize(TTK::MusicSongProperty *prop, const QString &duration) const
63 {
64  if(!prop->m_size.isEmpty() && prop->m_size != TTK_DEFAULT_STR)
65  {
66  return false;
67  }
68 
69  if(prop->m_bitrate != -1 && !duration.isEmpty() && duration != TTK_DEFAULT_STR)
70  {
71  prop->m_size = TTK::Number::sizeByteToLabel(duration, prop->m_bitrate);
72  }
73  else
74  {
78  }
79  return true;
80 }
81 
82 bool MusicAbstractQueryRequest::findUrlPathSize(TTK::MusicSongPropertyList *props, const QString &duration) const
83 {
84  for(int i = 0; i < props->count(); ++i)
85  {
86  if(!findUrlPathSize(&(*props)[i], duration))
87  {
88  return false;
89  }
90  }
91  return true;
92 }
#define TTK_NETWORK_QUERY_CHECK(VALUE)
#define TTK_DEFAULT_STR
Definition: ttkglobal.h:200
TTK_MODULE_EXPORT qint64 queryFileSizeByUrl(const QString &url)
The class of the music song property.
Definition: musicobject.h:223
static constexpr const char * QUERY_KG_INTERFACE
MusicAbstractQueryRequest(QObject *parent=nullptr)
MusicSongPropertyList m_songProps
Definition: musicobject.h:295
The class of the abstract download page query request.
TTK_MODULE_EXPORT QString sizeByteToLabel(qint64 size)
virtual void downLoadFinished()
virtual void startToSearchByID(const QString &value)
virtual void startToQueryResult(TTK::MusicSongInformation *info, int bitrate)
TTK::MusicSongInformationList m_items
static constexpr const char * QUERY_WY_INTERFACE
static constexpr const char * QUERY_KW_INTERFACE
virtual void downLoadFinished() override
bool findUrlPathSize(TTK::MusicSongProperty *prop, const QString &duration) const
The class of the music song information.
Definition: musicobject.h:281