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);
138 m_ui->topTitleCloseButton->setEnabled(enabled);
139 m_ui->downloadButton->setEnabled(enabled);
150 m_ui->loadingLabel->run(
true);
163 m_ui->loadingLabel->run(
true);
181 const TTK::MusicSongInformationList &songInfos = request->
items();
182 if(row >= songInfos.count())
191 m_ui->loadingLabel->run(
true);
208 if(p.m_bitrate == bitrate)
224 QString downloadPath;
225 QString fileName = baseName;
229 downloadPath = QString(
"%1%2.%3").arg(downloadPrefix, fileName, prop.
m_format);
230 if(!QFile::exists(downloadPath))
235 fileName = baseName + QString(
"(%1)").arg(index++);
241 MusicSongList records;
246 record.
setPath(QFileInfo(downloadPath).absoluteFilePath());
256 connect(d, SIGNAL(downLoadDataChanged(QString)), parent, SLOT(
downloadFinished()));
281 if(p.m_bitrate == bitrate)
295 QString downloadPath = QString(
"%1%2.%3").arg(downloadPrefix, fileName, prop.
m_format);
297 if(QFile::exists(downloadPath))
299 for(
int i = 1; i < 99; ++i)
301 if(!QFile::exists(downloadPath))
311 fileName += QString(
"(%1)").arg(i);
312 downloadPath = QString(
"%1%2.%3").arg(downloadPrefix, fileName, prop.
m_format);
317 connect(d, SIGNAL(downLoadDataChanged(QString)), parent, SLOT(
downloadFinished()));
329 m_ui->viewArea->removeItems();
332 if(songInfos.isEmpty())
343 if(var.m_artistName.contains(artistName, Qt::CaseInsensitive) && var.m_songName.contains(songName, Qt::CaseInsensitive))
388 m_ui->viewArea->addCellItem(prop, QObject::tr(
"SD"), QString(
":/quality/lb_sd_quality"));
393 m_ui->viewArea->addCellItem(prop, QObject::tr(
"HQ"), QString(
":/quality/lb_hd_quality"));
398 m_ui->viewArea->addCellItem(prop, QObject::tr(
"SQ"), QString(
":/quality/lb_sq_quality"));
403 m_ui->viewArea->addCellItem(prop, QObject::tr(
"CD"), QString(
":/quality/lb_cd_quality"));
411 m_ui->loadingLabel->run(
false);
413 int delta =
m_ui->viewArea->rowCount();
431 w->setFixedHeight(w->height() + height);
436 const QRect &rect = w->geometry();
437 w->move(rect.x(), rect.y() + pos);
442 const int bitrate =
m_ui->viewArea->bitrate();
void setInformation(const QString &info)
QString queryValue() const
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
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
QueryType queryType() const
void setIcon(const QString &name)
void setText(const QString &text)
TTK_MODULE_EXPORT QString toString(Record type)
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 download data from net.
The class of the download table item.
const TTK::MusicSongInformationList & items() const
static QString parse(const TTK::MusicSongInformation &info, const QString &value)
virtual void startToRequest() override