TTKMusicPlayer  4.3.0.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 
7 {
8  delete m_statusLabel;
9  m_statusLabel = nullptr;
10 
12  m_tableWidget->hide();
13 
16 
17  connect(req, SIGNAL(downloadDataChanged(QString)), SLOT(queryAllFinished()));
18  connect(req, SIGNAL(createCategoryItem(MusicResultDataItem)), SLOT(createProgramCategoryItem(MusicResultDataItem)));
19 }
20 
22 {
25 }
26 
28 {
30 
31  if(m_resizeWidgets.isEmpty())
32  {
33  return;
34  }
35 
36  const int width = G_SETTING_PTR->value(MusicSettingManager::WidgetSize).toSize().width() - WINDOW_WIDTH_MIN + 390;
37 
38  Data *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 
52 {
54 }
55 
57 {
58  m_currentPlaylistItem = item;
59 
60  createLabels();
61 
62  if(m_resizeWidgets.isEmpty())
63  {
64  return;
65  }
66 
68  {
70  connect(req, SIGNAL(downloadRawDataChanged(QByteArray)), SLOT(downloadFinished(QByteArray)));
71  req->startToRequest(item.m_coverUrl);
72  }
73 
74  const int width = G_SETTING_PTR->value(MusicSettingManager::WidgetSize).toSize().width() - WINDOW_WIDTH_MIN + 390;
75 
76  Data *data = &m_resizeWidgets[0];
77  data->m_label->setToolTip(item.m_name);
78  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
79 
80  data = &m_resizeWidgets[1];
81  data->m_label->setToolTip(tr("Singer: %1").arg(item.m_nickName));
82  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
83 
84  data = &m_resizeWidgets[2];
85  data->m_label->setToolTip(tr("PlayCount: %1").arg(item.m_count));
86  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
87 
88  data = &m_resizeWidgets[3];
89  data->m_label->setToolTip(tr("UpdateTime: %1").arg(item.m_time));
90  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, width));
91 }
92 
94 {
96  m_container->show();
97 
98  layout()->removeWidget(m_mainWidget);
99  QScrollArea *scrollArea = new QScrollArea(this);
101  layout()->addWidget(scrollArea);
102 
103  QWidget *function = new QWidget(m_mainWidget);
104  function->setStyleSheet(TTK::UI::CheckBoxStyle01 + TTK::UI::PushButtonStyle03);
105  QVBoxLayout *grid = new QVBoxLayout(function);
106 
107  QWidget *firstTopFuncWidget = new QWidget(function);
108  QHBoxLayout *firstTopFuncLayout = new QHBoxLayout(firstTopFuncWidget);
109 
110  QLabel *firstLabel = new QLabel(function);
111  firstLabel->setText(tr("<font color=#158FE1> DJRadio > %1 </font>").arg(m_currentPlaylistItem.m_name));
112 
113  QPushButton *backButton = new QPushButton(tr("Back"));
114  backButton->setFixedSize(90, 30);
115  backButton->setStyleSheet(TTK::UI::PushButtonStyle03);
116  backButton->setCursor(QCursor(Qt::PointingHandCursor));
117  connect(backButton, SIGNAL(clicked()), this, SIGNAL(backToMainMenu()));
118 
119  firstTopFuncLayout->addWidget(firstLabel);
120  firstTopFuncLayout->addWidget(backButton);
121  grid->addWidget(firstTopFuncWidget);
122  //
123  QWidget *topFuncWidget = new QWidget(function);
124  QHBoxLayout *topFuncLayout = new QHBoxLayout(topFuncWidget);
125 
126  m_iconLabel = new QLabel(topFuncWidget);
127  m_iconLabel->setPixmap(QPixmap(":/image/lb_warning").scaled(180, 180));
128  m_iconLabel->setFixedSize(210, 180);
129  //
130  QWidget *topLineWidget = new QWidget(topFuncWidget);
131  QVBoxLayout *topLineLayout = new QVBoxLayout(topLineWidget);
132  topLineLayout->setContentsMargins(10, 5, 5, 0);
133 
134  QLabel *nameLabel = new QLabel(topLineWidget);
135  QFont nameFont = nameLabel->font();
136  nameFont.setPixelSize(20);
137  nameLabel->setFont(nameFont);
138  nameLabel->setStyleSheet(TTK::UI::FontStyle01);
139  nameLabel->setText(TTK_DEFAULT_STR);
140 
141  QLabel *singerLabel = new QLabel(topLineWidget);
142  singerLabel->setStyleSheet(TTK::UI::ColorStyle04 + TTK::UI::FontStyle03);
143  singerLabel->setText(TTK_DEFAULT_STR);
144 
145  QLabel *playCountLabel = new QLabel(topLineWidget);
146  playCountLabel->setStyleSheet(TTK::UI::ColorStyle04 + TTK::UI::FontStyle03);
147 
148  QLabel *updateTimeLabel = new QLabel(topLineWidget);
149  updateTimeLabel->setStyleSheet(TTK::UI::ColorStyle04 + TTK::UI::FontStyle03);
150  updateTimeLabel->setText(TTK_DEFAULT_STR);
151 
152  topLineLayout->addWidget(nameLabel);
153  topLineLayout->addWidget(singerLabel);
154  topLineLayout->addWidget(playCountLabel);
155  topLineLayout->addWidget(updateTimeLabel);
156  topLineWidget->setLayout(topLineLayout);
157 
158  topFuncLayout->addWidget(m_iconLabel);
159  topFuncLayout->addWidget(topLineWidget);
160  topFuncWidget->setLayout(topFuncLayout);
161  grid->addWidget(topFuncWidget);
162  //
163  QWidget *functionWidget = new QWidget(this);
164  functionWidget->setStyleSheet(TTK::UI::PushButtonStyle03);
165  QHBoxLayout *hLayout = new QHBoxLayout(functionWidget);
166 
167  m_songButton = new QPushButton(functionWidget);
168  m_songButton->setText(tr("SongItems"));
169  m_songButton->setFixedSize(100, 25);
170  m_songButton->setCursor(QCursor(Qt::PointingHandCursor));
171 
172  hLayout->addWidget(m_songButton);
173  hLayout->addStretch(1);
174  functionWidget->setLayout(hLayout);
175 
176  QButtonGroup *buttonGroup = new QButtonGroup(this);
177  buttonGroup->addButton(m_songButton, 0);
178  QtButtonGroupConnect(buttonGroup, m_container, setCurrentIndex, TTK_SLOT);
179 
180 #ifdef Q_OS_UNIX
181  backButton->setFocusPolicy(Qt::NoFocus);
182  m_songButton->setFocusPolicy(Qt::NoFocus);
183 #endif
184 
185  grid->addWidget(functionWidget);
186  grid->addWidget(m_container);
187  grid->addStretch(1);
188 
189  function->setLayout(grid);
190  m_mainWidget->layout()->addWidget(function);
191 
192  m_resizeWidgets.append({nameLabel, nameLabel->font()});
193  m_resizeWidgets.append({singerLabel, singerLabel->font()});
194  m_resizeWidgets.append({playCountLabel, playCountLabel->font()});
195  m_resizeWidgets.append({updateTimeLabel, updateTimeLabel->font()});
196 }
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:276
static const QString FontStyle03
static bool isCoverValid(const QString &url) noexcept
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.
void downloadFinished(const QByteArray &bytes)
virtual void resizeGeometry() overridefinal
The class of the wangyi query program category data from net.
The class of the cover source data download request.
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:177
TTK_MODULE_EXPORT void generateVScrollAreaStyle(QWidget *widget, QWidget *parent, bool background=true)
#define QtButtonGroupConnect(p, q, f, s)
Button group connect.
Definition: ttkqtcompat.h:115
The class of the item query widget base.
#define WINDOW_WIDTH_MIN
Definition: musicobject.h:172
virtual void startToSearchByValue(const QString &value) overridefinal
MusicItemQueryTableWidget * m_tableWidget
The class of the cover data download request.
The class of the abstract query data from net.
virtual void resizeGeometry() overridefinal
#define G_SETTING_PTR