TTKMusicPlayer  4.1.3.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 #include "musiccoverrequest.h"
5 
8 {
10 
12 }
13 
15 {
18 
20  item.m_id = value;
21  d->startToQueryInfo(item);
22  setResultDataItem(item);
23 
24  connect(d, SIGNAL(downLoadDataChanged(QString)), SLOT(queryAllFinished()));
25 }
26 
28 {
30 
31  if(!m_resizeWidgets.isEmpty())
32  {
33  const int width = G_SETTING_PTR->value(MusicSettingManager::WidgetSize).toSize().width() - WINDOW_WIDTH_MIN;
34 
35  TTKResizeWidget *data = &m_resizeWidgets[0];
36  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, 200 + width));
37 
38  data = &m_resizeWidgets[1];
39  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, 180 + width));
40 
41  data = &m_resizeWidgets[2];
42  data->m_label->setText(TTK::Widget::elidedText(data->m_font, data->m_label->toolTip(), Qt::ElideRight, 320 + width));
43  }
44 }
45 
47 {
49 }
50 
52 {
53  delete m_statusLabel;
54  m_statusLabel = nullptr;
55 
56  m_container->show();
57 
58  m_currentPlaylistItem = item;
60 
62 
63  layout()->removeWidget(m_mainWindow);
64  QScrollArea *scrollArea = new QScrollArea(this);
66  layout()->addWidget(scrollArea);
67 
68  QWidget *function = new QWidget(m_mainWindow);
69  function->setStyleSheet(TTK::UI::CheckBoxStyle01);
70  QVBoxLayout *grid = new QVBoxLayout(function);
71  //
72  QWidget *topFuncWidget = new QWidget(function);
73  QHBoxLayout *topFuncLayout = new QHBoxLayout(topFuncWidget);
74 
75  m_iconLabel = new QLabel(topFuncWidget);
76  m_iconLabel->setPixmap(QPixmap(":/image/lb_warning").scaled(180, 180));
77  m_iconLabel->setFixedSize(210, 180);
78 
80  {
81  MusicCoverRequest *d = G_DOWNLOAD_QUERY_PTR->makeCoverRequest(this);
82  connect(d, SIGNAL(downLoadRawDataChanged(QByteArray)), SLOT(downLoadFinished(QByteArray)));
83  d->startToRequest(item.m_coverUrl);
84  }
85 
86  QWidget *topLineWidget = new QWidget(topFuncWidget);
87  QVBoxLayout *topLineLayout = new QVBoxLayout(topLineWidget);
88  topLineLayout->setContentsMargins(10, 5, 0, 0);
89 
90  QLabel *nameLabel = new QLabel(topLineWidget);
91  QFont nameFont = nameLabel->font();
92  nameFont.setPixelSize(20);
93  nameLabel->setFont(nameFont);
94  nameLabel->setStyleSheet(TTK::UI::FontStyle01);
95  nameLabel->setToolTip(item.m_title);
96 
97  QLabel *creatorLabel = new QLabel(topLineWidget);
98  creatorLabel->setStyleSheet(TTK::UI::ColorStyle04 + TTK::UI::FontStyle03);
99  creatorLabel->setToolTip(tr("PlayCount: %1").arg(item.m_count));
100 
101  QLabel *descriptionLabel = new QLabel(topLineWidget);
102  descriptionLabel->setStyleSheet(TTK::UI::ColorStyle04 + TTK::UI::FontStyle03);
103  descriptionLabel->setToolTip(tr("Description: %1").arg(item.m_description));
104 
105  topLineLayout->addWidget(nameLabel);
106  topLineLayout->addWidget(creatorLabel);
107  topLineLayout->addWidget(descriptionLabel);
108  topLineWidget->setLayout(topLineLayout);
109 
110  QWidget *topButtonWidget = new QWidget(topFuncWidget);
111  topButtonWidget->setStyleSheet(TTK::UI::PushButtonStyle03);
112  QHBoxLayout *topButtonLayout = new QHBoxLayout(topButtonWidget);
113  topButtonLayout->setContentsMargins(0, 0, 0, 0);
114 
115  topButtonLayout->addStretch(1);
116  topButtonWidget->setLayout(topButtonLayout);
117  topLineLayout->addWidget(topButtonWidget);
118  //
119  topFuncLayout->addWidget(m_iconLabel);
120  topFuncLayout->addWidget(topLineWidget);
121  topFuncWidget->setLayout(topFuncLayout);
122  grid->addWidget(topFuncWidget);
123  //
124  QWidget *functionWidget = new QWidget(this);
125  functionWidget->setStyleSheet(TTK::UI::PushButtonStyle03);
126  QHBoxLayout *hLayout = new QHBoxLayout(functionWidget);
127 
128  m_songButton = new QPushButton(functionWidget);
129  m_songButton->setText(tr("SongItems"));
130  m_songButton->setFixedSize(100, 25);
131  m_songButton->setCursor(QCursor(Qt::PointingHandCursor));
132  hLayout->addWidget(m_songButton);
133  hLayout->addStretch(1);
134  functionWidget->setLayout(hLayout);
135 
136 #ifdef Q_OS_UNIX
137  m_songButton->setFocusPolicy(Qt::NoFocus);
138 #endif
139  grid->addWidget(functionWidget);
140  grid->addWidget(m_container);
141  grid->addStretch(1);
142 
143  function->setLayout(grid);
144  m_mainWindow->layout()->addWidget(function);
145 
146  m_resizeWidgets.push_back({nameLabel, nameLabel->font()});
147  m_resizeWidgets.push_back({creatorLabel, creatorLabel->font()});
148  m_resizeWidgets.push_back({descriptionLabel, descriptionLabel->font()});
149 
150  resizeWidget();
151 }
void setQueryInput(MusicAbstractQueryRequest *query)
virtual void setCurrentValue(const QString &value) overridefinal
The class of the search result data item.
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)
The class of the query playlist download data from net.
virtual void startToQueryInfo(MusicResultDataItem &item)=0
static const QString FontStyle01
Font.
The class of the query item table widget.
void setResultDataItem(const MusicResultDataItem &item)
virtual void resizeWidget() overridefinal
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 download data from net.
TTK_MODULE_EXPORT void generateVScrollAreaStyle(QWidget *widget, QWidget *parent, bool background=true)
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
MusicPersonalRadioQueryWidget(QWidget *parent=nullptr)
The class of the cover data download request.
#define G_SETTING_PTR