10 #include <QButtonGroup>
17 QHeaderView *headerView = horizontalHeader();
18 headerView->resizeSection(0, 30);
19 headerView->resizeSection(1, 273);
20 headerView->resizeSection(2, 105);
21 headerView->resizeSection(3, 105);
22 headerView->resizeSection(4, 55);
23 headerView->resizeSection(5, 23);
24 headerView->resizeSection(6, 26);
25 headerView->resizeSection(7, 26);
26 headerView->resizeSection(8, 26);
43 MusicSearchRecordList records;
49 records.insert(0, record);
75 QHeaderView *headerView = horizontalHeader();
80 for(
int i = 0; i < rowCount(); ++i)
82 QTableWidgetItem *it = item(i, 1);
110 if(column == 7 || column == 8)
112 setCursor(QCursor(Qt::PointingHandCursor));
133 if(column <= 0 || row < 0 || row >= rowCount() - 1)
149 const int count = rowCount();
150 setRowCount(count + 1);
152 QHeaderView *headerView = horizontalHeader();
153 QTableWidgetItem *item =
new QTableWidgetItem;
155 setItem(count, 0, item);
157 item =
new QTableWidgetItem;
159 item->setText(
TTK::Widget::elidedText(font(), item->toolTip(), Qt::ElideRight, headerView->sectionSize(1) - 15));
161 setItem(count, 1, item);
163 item =
new QTableWidgetItem;
165 item->setText(
TTK::Widget::elidedText(font(), item->toolTip(), Qt::ElideRight, headerView->sectionSize(2) - 30));
167 setItem(count, 2, item);
169 item =
new QTableWidgetItem;
171 item->setText(
TTK::Widget::elidedText(font(), item->toolTip(), Qt::ElideRight, headerView->sectionSize(3) - 30));
173 setItem(count, 3, item);
175 item =
new QTableWidgetItem(result.
m_duration);
177 setItem(count, 4, item);
179 item =
new QTableWidgetItem;
181 setItem(count, 5, item);
183 item =
new QTableWidgetItem;
184 item->setIcon(QIcon(
":/tiny/lb_server_type"));
185 item->setToolTip(result.
m_type);
186 setItem(count, 6, item);
188 item =
new QTableWidgetItem;
189 item->setIcon(QIcon(
":/contextMenu/btn_add"));
190 setItem(count, 7, item);
192 item =
new QTableWidgetItem;
193 item->setIcon(QIcon(
":/contextMenu/btn_download"));
194 setItem(count, 8, item);
199 const int row = currentRow();
208 switch(action->data().toInt())
222 MusicItemSearchTableWidget::contextMenuEvent(event);
225 m_searchActions->addAction(menu.addAction(QIcon(
":/contextMenu/btn_play"), tr(
"Play")))->setData(4);
231 const QString &albumName = (currentRow() != -1 && rowCount() > 0) ? item(currentRow(), 3)->toolTip() : QString();
233 QAction *action =
m_searchActions->addAction(tr(
"Search '%1'").arg(albumName));
235 menu.insertAction(lastAction, action);
237 menu.exec(QCursor::pos());
255 if(row >= songInfos.count())
293 QVBoxLayout *boxLayout =
new QVBoxLayout(
this);
294 boxLayout->setContentsMargins(0, 0, 0, 0);
295 boxLayout->setSpacing(0);
297 QPalette plt(palette());
298 plt.setColor(QPalette::Window, Qt::white);
300 QWidget *toolWidget =
new QWidget(
this);
301 toolWidget->setAutoFillBackground(
true);
302 toolWidget->setPalette(plt);
303 toolWidget->setFixedHeight(80);
304 boxLayout->addWidget(toolWidget);
306 QWidget *containerWidget =
new QWidget(
this);
307 containerWidget->setAutoFillBackground(
true);
308 containerWidget->setPalette(plt);
309 boxLayout->addWidget(containerWidget);
313 QVBoxLayout *layout =
new QVBoxLayout(containerWidget);
314 layout->setContentsMargins(0, 0, 0, 0);
315 layout->setSpacing(0);
317 containerWidget->setLayout(layout);
318 setLayout(boxLayout);
372 for(
int i = 0; i < rows.count(); ++i)
400 QVBoxLayout *wLayout =
new QVBoxLayout(widget);
401 wLayout->setContentsMargins(0, 0, 0, 0);
402 wLayout->setSpacing(0);
403 widget->setLayout(wLayout);
405 QWidget *funcWidget =
new QWidget(widget);
406 QHBoxLayout *funcLayout =
new QHBoxLayout(funcWidget);
407 funcLayout->setContentsMargins(0, 0, 10, 0);
408 funcLayout->setSpacing(10);
417 m_playButton->setIcon(QIcon(
":/contextMenu/btn_play_white"));
421 m_playButton->setCursor(QCursor(Qt::PointingHandCursor));
424 QPushButton *addButton =
new QPushButton(tr(
"Add"),
this);
425 addButton->setFixedSize(70, 25);
427 addButton->setCursor(QCursor(Qt::PointingHandCursor));
428 funcLayout->addWidget(addButton);
430 QPushButton *downloadButton =
new QPushButton(tr(
"Download"),
this);
431 downloadButton->setFixedSize(70, 25);
433 downloadButton->setCursor(QCursor(Qt::PointingHandCursor));
434 funcLayout->addWidget(downloadButton);
436 QButtonGroup *buttonGroup =
new QButtonGroup(
this);
438 buttonGroup->addButton(addButton, 1);
439 buttonGroup->addButton(downloadButton, 2);
441 funcWidget->setLayout(funcLayout);
442 wLayout->addWidget(funcWidget);
446 QWidget *labelWidget =
new QWidget(widget);
447 QHBoxLayout *labelLayout =
new QHBoxLayout(labelWidget);
448 labelLayout->setContentsMargins(7, 0, 10, 0);
449 labelLayout->setSpacing(0);
452 QCheckBox *labelCheckBox =
new QCheckBox(
this);
454 connect(labelCheckBox, SIGNAL(clicked(
bool)),
m_tableWidget, SLOT(checkedItemsState(
bool)));
455 labelLayout->addWidget(labelCheckBox, headerView->sectionSize(0));
460 addButton->setFocusPolicy(Qt::NoFocus);
461 downloadButton->setFocusPolicy(Qt::NoFocus);
462 labelCheckBox->setFocusPolicy(Qt::NoFocus);
465 QLabel *label1 =
new QLabel(tr(
"Song"),
this);
467 labelLayout->addWidget(label1, headerView->sectionSize(1));
470 QLabel *label2 =
new QLabel(tr(
"Artist"),
this);
472 labelLayout->addWidget(label2, headerView->sectionSize(2));
475 QLabel *label3 =
new QLabel(tr(
"Album"),
this);
477 labelLayout->addWidget(label3, headerView->sectionSize(3));
480 QLabel *label4 =
new QLabel(tr(
"Operator"),
this);
482 labelLayout->addWidget(label4, headerView->sectionSize(4) + headerView->sectionSize(5) + headerView->sectionSize(6) * 3);
485 labelWidget->setLayout(labelLayout);
486 wLayout->addWidget(labelWidget);
const TTK::MusicSongInformationList & items() const noexcept
virtual bool writeBuffer(const MusicSearchRecordList &items) overridefinal
The class of the search result data item.
static qint64 currentTimestamp() noexcept
bool fromFile(const QString &name)
The class of the music song property.
static const QString CheckBoxStyle01
CheckBox.
static constexpr unsigned int Color02
The class of the search history Config.
static const QString FontStyle01
Font.
virtual void startToSearchByID(const QString &value)
static void popup(const QString &text)
virtual bool readBuffer(MusicSearchRecordList &items) overridefinal
virtual void startToQueryResult(TTK::MusicSongInformation *info, int bitrate)
static const QString PushButtonStyle03
static const QString BackgroundStyle09
#define QtButtonGroupConnect(p, q, f, s)
Button group connect.
static const QString ColorStyle03
The class of the search result info item.
The class of the searched record item.
#define G_DOWNLOAD_QUERY_PTR
virtual void startToSearch(const QString &value)=0
The class of the abstract query data from net.
TTK_MODULE_EXPORT QString generateSongName(const QString &title, const QString &artist) noexcept
#define TTKObjectCast(x, y)
QString queryServer() const noexcept