2 #include "ui_musicdownloadwidget.h"
31 m_icon->setPixmap(QPixmap(name).scaled(28, 18));
51 QHeaderView *headerView = horizontalHeader();
52 headerView->resizeSection(0, 400);
64 const int index = rowCount();
65 setRowCount(index + 1);
68 QTableWidgetItem *it =
new QTableWidgetItem;
70 setItem(index, 0, it);
78 setCellWidget(index, 0, item);
83 const int row = currentRow();
107 setFixedSize(
size());
108 setAttribute(Qt::WA_DeleteOnClose);
111 m_ui->topTitleCloseButton->setIcon(QIcon(
":/functions/btn_close_hover"));
113 m_ui->topTitleCloseButton->setCursor(QCursor(Qt::PointingHandCursor));
114 m_ui->topTitleCloseButton->setToolTip(tr(
"Close"));
115 connect(
m_ui->topTitleCloseButton, SIGNAL(clicked()), SLOT(
close()));
119 m_ui->downloadButton->setFocusPolicy(Qt::NoFocus);
139 m_ui->topTitleCloseButton->setEnabled(enabled);
140 m_ui->downloadButton->setEnabled(enabled);
151 m_ui->loadingLabel->execute(
true);
164 m_ui->loadingLabel->execute(
true);
170 MusicAbstractMoveWidget::close();
182 const TTK::MusicSongInformationList &songInfos = request->
items();
183 if(row >= songInfos.count())
192 m_ui->loadingLabel->execute(
true);
209 if(p.m_bitrate == bitrate)
225 QString downloadPath;
226 QString fileName = baseName;
230 downloadPath = QString(
"%1%2.%3").arg(downloadPrefix, fileName, prop.
m_format);
231 if(!QFile::exists(downloadPath))
236 fileName = baseName + QString(
"(%1)").arg(index++);
242 MusicSongList records;
247 record.
setPath(QFileInfo(downloadPath).absoluteFilePath());
257 connect(req, SIGNAL(downloadDataChanged(QString)), parent, SLOT(
downloadFinished()));
282 if(p.m_bitrate == bitrate)
296 QString downloadPath = QString(
"%1%2.%3").arg(downloadPrefix, fileName, prop.
m_format);
298 if(QFile::exists(downloadPath))
300 for(
int i = 1; i < 99; ++i)
302 if(!QFile::exists(downloadPath))
312 fileName += QString(
"(%1)").arg(i);
313 downloadPath = QString(
"%1%2.%3").arg(downloadPrefix, fileName, prop.
m_format);
318 connect(req, SIGNAL(downloadDataChanged(QString)), parent, SLOT(
downloadFinished()));
336 m_ui->viewArea->removeItems();
339 if(songInfos.isEmpty())
350 if(var.m_artistName.contains(artistName, Qt::CaseInsensitive) && var.m_songName.contains(songName, Qt::CaseInsensitive))
361 MusicAbstractMoveWidget::close();
372 MusicAbstractMoveWidget::close();
383 MusicAbstractMoveWidget::close();
394 MusicAbstractMoveWidget::close();
405 m_ui->viewArea->addCellItem(prop, QObject::tr(
"SD"), QString(
":/quality/lb_sd_quality"));
410 m_ui->viewArea->addCellItem(prop, QObject::tr(
"HQ"), QString(
":/quality/lb_hd_quality"));
415 m_ui->viewArea->addCellItem(prop, QObject::tr(
"SQ"), QString(
":/quality/lb_sq_quality"));
420 m_ui->viewArea->addCellItem(prop, QObject::tr(
"CD"), QString(
":/quality/lb_cd_quality"));
428 m_ui->loadingLabel->execute(
false);
430 int delta =
m_ui->viewArea->rowCount();
448 w->setFixedHeight(w->height() + height);
453 const QRect &rect = w->geometry();
454 w->move(rect.x(), rect.y() + pos);
459 const int bitrate =
m_ui->viewArea->bitrate();
const TTK::MusicSongInformationList & items() const noexcept
void setInformation(const QString &info)
TTK_MODULE_EXPORT QString generateSongArtist(const QString &name, const QString &key=TTK_DEFAULT_STR)
virtual bool writeBuffer(const MusicSongList &items) overridefinal
~MusicDownloadTableItem()
bool fromFile(const QString &name)
The class of the music song property.
The class of the download the type of data.
The class of the download record manager.
TTK_MODULE_EXPORT QString generateSongTitle(const QString &name, const QString &key=TTK_DEFAULT_STR)
virtual bool readBuffer(MusicSongList &items) overridefinal
void setName(const QString &n) noexcept
QString queryValue() const noexcept
static void popup(const QString &text)
virtual void startToQueryResult(TTK::MusicSongInformation *info, int bitrate)
void setAddTimeStr(const QString &t) noexcept
#define TTK_SIGNLE_SHOT(...)
void setSizeStr(const QString &s) noexcept
bool isEmpty() const noexcept
void setIcon(const QString &name)
TTK_MODULE_EXPORT QString toString(Record type) noexcept
void setText(const QString &text)
MusicDownloadTableItem(QWidget *parent=nullptr)
static const QString PushButtonStyle05
static const QString ToolButtonStyle04
#define G_DOWNLOAD_QUERY_PTR
The class of the music song info.
void setPath(const QString &p) noexcept
virtual void startToSearch(const QString &value)=0
The class of the abstract query data from net.
QueryType queryType() const noexcept
The class of the download table item.
static QString parse(const TTK::MusicSongInformation &info, const QString &value)
virtual void startToRequest() override