TTKMusicPlayer  4.3.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicpersonalradioquerywidget.cpp
Go to the documentation of this file.
4 
7 {
9 
11 }
12 
14 {
17 
19  item.m_id = value;
20  req->startToQueryInfo(item);
21  setResultDataItem(item);
22 
23  connect(req, SIGNAL(downloadDataChanged(QString)), SLOT(queryAllFinished()));
24 }
25 
27 {
29 
30  if(m_resizeWidgets.isEmpty())
31  {
32  return;
33  }
34 
35  const int width = G_SETTING_PTR->value(MusicSettingManager::WidgetSize).toSize().width() - WINDOW_WIDTH_MIN;
36 
37  Data *data = &m_resizeWidgets[0];
38  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, 200 + width));
39 
40  data = &m_resizeWidgets[1];
41  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, 180 + width));
42 
43  data = &m_resizeWidgets[2];
44  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, 320 + width));
45 }
46 
48 {
50 }
51 
53 {
54  delete m_statusLabel;
55  m_statusLabel = nullptr;
56 
57  m_container->show();
58 
59  m_currentPlaylistItem = item;
61 
63 
64  layout()->removeWidget(m_mainWidget);
65  QScrollArea *scrollArea = new QScrollArea(this);
67  layout()->addWidget(scrollArea);
68 
69  QWidget *function = new QWidget(m_mainWidget);
70  function->setStyleSheet(TTK::UI::CheckBoxStyle01);
71  QVBoxLayout *grid = new QVBoxLayout(function);
72  //
73  QWidget *topFuncWidget = new QWidget(function);
74  QHBoxLayout *topFuncLayout = new QHBoxLayout(topFuncWidget);
75 
76  m_iconLabel = new QLabel(topFuncWidget);
77  m_iconLabel->setPixmap(QPixmap(":/image/lb_warning").scaled(180, 180));
78  m_iconLabel->setFixedSize(210, 180);
79 
81  {
83  connect(req, SIGNAL(downloadRawDataChanged(QByteArray)), SLOT(downloadFinished(QByteArray)));
84  req->startToRequest(item.m_coverUrl);
85  }
86 
87  QWidget *topLineWidget = new QWidget(topFuncWidget);
88  QVBoxLayout *topLineLayout = new QVBoxLayout(topLineWidget);
89  topLineLayout->setContentsMargins(10, 5, 0, 0);
90 
91  QLabel *nameLabel = new QLabel(topLineWidget);
92  QFont nameFont = nameLabel->font();
93  nameFont.setPixelSize(20);
94  nameLabel->setFont(nameFont);
95  nameLabel->setStyleSheet(TTK::UI::FontStyle01);
96  nameLabel->setToolTip(item.m_title);
97 
98  QLabel *creatorLabel = new QLabel(topLineWidget);
99  creatorLabel->setStyleSheet(TTK::UI::ColorStyle04 + TTK::UI::FontStyle03);
100  creatorLabel->setToolTip(tr("PlayCount: %1").arg(item.m_count));
101 
102  QLabel *descriptionLabel = new QLabel(topLineWidget);
103  descriptionLabel->setStyleSheet(TTK::UI::ColorStyle04 + TTK::UI::FontStyle03);
104  descriptionLabel->setToolTip(tr("Description: %1").arg(item.m_description));
105 
106  topLineLayout->addWidget(nameLabel);
107  topLineLayout->addWidget(creatorLabel);
108  topLineLayout->addWidget(descriptionLabel);
109  topLineWidget->setLayout(topLineLayout);
110 
111  QWidget *topButtonWidget = new QWidget(topFuncWidget);
112  topButtonWidget->setStyleSheet(TTK::UI::PushButtonStyle03);
113  QHBoxLayout *topButtonLayout = new QHBoxLayout(topButtonWidget);
114  topButtonLayout->setContentsMargins(0, 0, 0, 0);
115 
116  topButtonLayout->addStretch(1);
117  topButtonWidget->setLayout(topButtonLayout);
118  topLineLayout->addWidget(topButtonWidget);
119  //
120  topFuncLayout->addWidget(m_iconLabel);
121  topFuncLayout->addWidget(topLineWidget);
122  topFuncWidget->setLayout(topFuncLayout);
123  grid->addWidget(topFuncWidget);
124  //
125  QWidget *functionWidget = new QWidget(this);
126  functionWidget->setStyleSheet(TTK::UI::PushButtonStyle03);
127  QHBoxLayout *hLayout = new QHBoxLayout(functionWidget);
128 
129  m_songButton = new QPushButton(functionWidget);
130  m_songButton->setText(tr("SongItems"));
131  m_songButton->setFixedSize(100, 25);
132  m_songButton->setCursor(QCursor(Qt::PointingHandCursor));
133  hLayout->addWidget(m_songButton);
134  hLayout->addStretch(1);
135  functionWidget->setLayout(hLayout);
136 
137 #ifdef Q_OS_UNIX
138  m_songButton->setFocusPolicy(Qt::NoFocus);
139 #endif
140  grid->addWidget(functionWidget);
141  grid->addWidget(m_container);
142  grid->addStretch(1);
143 
144  function->setLayout(grid);
145  m_mainWidget->layout()->addWidget(function);
146 
147  m_resizeWidgets.append({nameLabel, nameLabel->font()});
148  m_resizeWidgets.append({creatorLabel, creatorLabel->font()});
149  m_resizeWidgets.append({descriptionLabel, descriptionLabel->font()});
150 
151  resizeGeometry();
152 }
void setQueryInput(MusicAbstractQueryRequest *query)
virtual void resizeGeometry() overridefinal
virtual void setCurrentValue(const QString &value) overridefinal
The class of the search result data item.
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)
The class of the query playlist data from net.
virtual void startToQueryInfo(MusicResultDataItem &item)=0
static const QString FontStyle01
Font.
The class of the query item table widget.
void downloadFinished(const QByteArray &bytes)
void setResultDataItem(const MusicResultDataItem &item)
The class of the cover source data download request.
static const QString PushButtonStyle03
TTK_MODULE_EXPORT QString elidedText(const QFont &font, const QString &text, Qt::TextElideMode mode, int width)
The class of the wangyi query playlist data from net.
TTK_MODULE_EXPORT void generateVScrollAreaStyle(QWidget *widget, QWidget *parent, bool background=true)
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
MusicPersonalRadioQueryWidget(QWidget *parent=nullptr)
The class of the cover data download request.
virtual void resizeGeometry() overridefinal
#define G_SETTING_PTR