TTKMusicPlayer  4.1.3.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicwebdjradioinfowidget.cpp
Go to the documentation of this file.
4 #include "musiccoverrequest.h"
5 
6 #include <qmath.h>
7 
10 {
11  delete m_statusLabel;
12  m_statusLabel = nullptr;
13 
15  m_queryTableWidget->hide();
16 
19 
20  connect(d, SIGNAL(downLoadDataChanged(QString)), SLOT(queryAllFinished()));
21  connect(d, SIGNAL(createCategoryItem(MusicResultDataItem)), SLOT(createProgramCategoryItem(MusicResultDataItem)));
22 }
23 
25 {
28 }
29 
31 {
33 
34  if(!m_resizeWidgets.isEmpty())
35  {
36  const int width = G_SETTING_PTR->value(MusicSettingManager::WidgetSize).toSize().width() - WINDOW_WIDTH_MIN + 390;
37 
38  TTKResizeWidget *data = &m_resizeWidgets[0];
39  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
40 
41  data = &m_resizeWidgets[1];
42  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
43 
44  data = &m_resizeWidgets[2];
45  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
46 
47  data = &m_resizeWidgets[3];
48  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
49  }
50 }
51 
53 {
55 }
56 
58 {
59  m_currentPlaylistItem = item;
60 
61  createLabels();
62 
63  if(!m_resizeWidgets.isEmpty())
64  {
66  {
67  MusicCoverRequest *d = G_DOWNLOAD_QUERY_PTR->makeCoverRequest(this);
68  connect(d, SIGNAL(downLoadRawDataChanged(QByteArray)), SLOT(downLoadFinished(QByteArray)));
69  d->startToRequest(item.m_coverUrl);
70  }
71 
72  const int width = G_SETTING_PTR->value(MusicSettingManager::WidgetSize).toSize().width() - WINDOW_WIDTH_MIN + 390;
73 
74  TTKResizeWidget *data = &m_resizeWidgets[0];
75  data->m_label->setToolTip(item.m_name);
76  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
77 
78  data = &m_resizeWidgets[1];
79  data->m_label->setToolTip(tr("Singer: %1").arg(item.m_nickName));
80  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
81 
82  data = &m_resizeWidgets[2];
83  data->m_label->setToolTip(tr("PlayCount: %1").arg(item.m_count));
84  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
85 
86  data = &m_resizeWidgets[3];
87  data->m_label->setToolTip(tr("UpdateTime: %1").arg(item.m_time));
88  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
89  }
90 }
91 
93 {
95  m_container->show();
96 
97  layout()->removeWidget(m_mainWindow);
98  QScrollArea *scrollArea = new QScrollArea(this);
100  layout()->addWidget(scrollArea);
101 
102  QWidget *function = new QWidget(m_mainWindow);
103  function->setStyleSheet(TTK::UI::CheckBoxStyle01 + TTK::UI::PushButtonStyle03);
104  QVBoxLayout *grid = new QVBoxLayout(function);
105 
106  QWidget *firstTopFuncWidget = new QWidget(function);
107  QHBoxLayout *firstTopFuncLayout = new QHBoxLayout(firstTopFuncWidget);
108 
109  QLabel *firstLabel = new QLabel(function);
110  firstLabel->setText(tr("<font color=#158FE1> DJRadio > %1 </font>").arg(m_currentPlaylistItem.m_name));
111 
112  QPushButton *backButton = new QPushButton(tr("Back"));
113  backButton->setFixedSize(90, 30);
114  backButton->setStyleSheet(TTK::UI::PushButtonStyle03);
115  backButton->setCursor(QCursor(Qt::PointingHandCursor));
116  connect(backButton, SIGNAL(clicked()), this, SIGNAL(backToMainMenu()));
117 
118  firstTopFuncLayout->addWidget(firstLabel);
119  firstTopFuncLayout->addWidget(backButton);
120  grid->addWidget(firstTopFuncWidget);
121  //
122  QWidget *topFuncWidget = new QWidget(function);
123  QHBoxLayout *topFuncLayout = new QHBoxLayout(topFuncWidget);
124 
125  m_iconLabel = new QLabel(topFuncWidget);
126  m_iconLabel->setPixmap(QPixmap(":/image/lb_warning").scaled(180, 180));
127  m_iconLabel->setFixedSize(210, 180);
128  //
129  QWidget *topLineWidget = new QWidget(topFuncWidget);
130  QVBoxLayout *topLineLayout = new QVBoxLayout(topLineWidget);
131  topLineLayout->setContentsMargins(10, 5, 5, 0);
132 
133  QLabel *nameLabel = new QLabel(topLineWidget);
134  QFont nameFont = nameLabel->font();
135  nameFont.setPixelSize(20);
136  nameLabel->setFont(nameFont);
137  nameLabel->setStyleSheet(TTK::UI::FontStyle01);
138  nameLabel->setText(TTK_DEFAULT_STR);
139 
140  QLabel *singerLabel = new QLabel(topLineWidget);
141  singerLabel->setStyleSheet(TTK::UI::ColorStyle04 + TTK::UI::FontStyle03);
142  singerLabel->setText(TTK_DEFAULT_STR);
143 
144  QLabel *playCountLabel = new QLabel(topLineWidget);
145  playCountLabel->setStyleSheet(TTK::UI::ColorStyle04 + TTK::UI::FontStyle03);
146 
147  QLabel *updateTimeLabel = new QLabel(topLineWidget);
148  updateTimeLabel->setStyleSheet(TTK::UI::ColorStyle04 + TTK::UI::FontStyle03);
149  updateTimeLabel->setText(TTK_DEFAULT_STR);
150 
151  topLineLayout->addWidget(nameLabel);
152  topLineLayout->addWidget(singerLabel);
153  topLineLayout->addWidget(playCountLabel);
154  topLineLayout->addWidget(updateTimeLabel);
155  topLineWidget->setLayout(topLineLayout);
156 
157  topFuncLayout->addWidget(m_iconLabel);
158  topFuncLayout->addWidget(topLineWidget);
159  topFuncWidget->setLayout(topFuncLayout);
160  grid->addWidget(topFuncWidget);
161  //
162  QWidget *functionWidget = new QWidget(this);
163  functionWidget->setStyleSheet(TTK::UI::PushButtonStyle03);
164  QHBoxLayout *hLayout = new QHBoxLayout(functionWidget);
165 
166  m_songButton = new QPushButton(functionWidget);
167  m_songButton->setText(tr("SongItems"));
168  m_songButton->setFixedSize(100, 25);
169  m_songButton->setCursor(QCursor(Qt::PointingHandCursor));
170 
171  hLayout->addWidget(m_songButton);
172  hLayout->addStretch(1);
173  functionWidget->setLayout(hLayout);
174 
175  QButtonGroup *buttonGroup = new QButtonGroup(this);
176  buttonGroup->addButton(m_songButton, 0);
177  QtButtonGroupConnect(buttonGroup, m_container, setCurrentIndex, TTK_SLOT);
178 
179 #ifdef Q_OS_UNIX
180  backButton->setFocusPolicy(Qt::NoFocus);
181  m_songButton->setFocusPolicy(Qt::NoFocus);
182 #endif
183 
184  grid->addWidget(functionWidget);
185  grid->addWidget(m_container);
186  grid->addStretch(1);
187 
188  function->setLayout(grid);
189  m_mainWindow->layout()->addWidget(function);
190 
191  m_resizeWidgets.push_back({nameLabel, nameLabel->font()});
192  m_resizeWidgets.push_back({singerLabel, singerLabel->font()});
193  m_resizeWidgets.push_back({playCountLabel, playCountLabel->font()});
194  m_resizeWidgets.push_back({updateTimeLabel, updateTimeLabel->font()});
195 }
void setQueryInput(MusicAbstractQueryRequest *query)
The class of the search result data item.
virtual void setCurrentValue(const QString &value) overridefinal
#define TTK_DEFAULT_STR
Definition: ttkglobal.h:203
static const QString FontStyle03
MusicItemQueryTableWidget * m_queryTableWidget
virtual void startToRequest(const QString &url)=0
static const QString CheckBoxStyle01
CheckBox.
static const QString ColorStyle04
Definition: musicuiobject.h:46
virtual void setCurrentValue(const QString &value)
static const QString FontStyle01
Font.
The class of the query item table widget.
The class of the wangyi query program category download data from net.
static const QString PushButtonStyle03
void createProgramCategoryItem(const MusicResultDataItem &item)
MusicWebDJRadioInfoWidget(QWidget *parent=nullptr)
TTK_MODULE_EXPORT QString elidedText(const QFont &font, const QString &text, Qt::TextElideMode mode, int width)
#define TTK_SLOT
Definition: ttkqtglobal.h:181
TTK_MODULE_EXPORT void generateVScrollAreaStyle(QWidget *widget, QWidget *parent, bool background=true)
#define QtButtonGroupConnect(p, q, f, s)
Button group connect.
Definition: ttkqtcompat.h:101
static bool isCoverValid(const QString &url)
void downLoadFinished(const QByteArray &bytes)
The class of the item query widget base.
virtual void startToSearchByText(const QString &text) overridefinal
#define WINDOW_WIDTH_MIN
Definition: musicobject.h:155
#define G_DOWNLOAD_QUERY_PTR
virtual void resizeWidget() overridefinal
The class of the cover data download request.
The class of the abstract query download data from net.
#define G_SETTING_PTR