2015-09-08 17:05:59 +02:00
|
|
|
#include "./addmultipledownloadswizard.h"
|
|
|
|
#include "./downloadinteraction.h"
|
|
|
|
#include "./settings.h"
|
2015-04-22 19:32:04 +02:00
|
|
|
|
2015-09-08 17:05:59 +02:00
|
|
|
#include "../network/download.h"
|
|
|
|
#include "../network/finder/downloadfinder.h"
|
2017-05-01 03:22:50 +02:00
|
|
|
#include "../network/finder/groovesharksearcher.h"
|
2015-09-08 17:05:59 +02:00
|
|
|
#include "../network/finder/linkfinder.h"
|
|
|
|
#include "../network/finder/youtubeplaylist.h"
|
2015-04-22 19:32:04 +02:00
|
|
|
|
2015-09-08 17:05:59 +02:00
|
|
|
#include "../model/downloadfinderresultsmodel.h"
|
2015-04-22 19:32:04 +02:00
|
|
|
|
|
|
|
#include <qtutilities/widgets/clearlineedit.h>
|
|
|
|
|
|
|
|
#include <QCheckBox>
|
2017-05-01 03:22:50 +02:00
|
|
|
#include <QCommandLinkButton>
|
2015-04-22 19:32:04 +02:00
|
|
|
#include <QHeaderView>
|
|
|
|
#include <QScrollBar>
|
2017-05-01 03:22:50 +02:00
|
|
|
#include <QTreeView>
|
|
|
|
#include <QVBoxLayout>
|
2015-04-22 19:32:04 +02:00
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
2019-06-10 22:50:15 +02:00
|
|
|
using namespace QtUtilities;
|
2015-04-22 19:32:04 +02:00
|
|
|
using namespace Network;
|
|
|
|
|
|
|
|
namespace QtGui {
|
|
|
|
|
2017-05-01 03:22:50 +02:00
|
|
|
enum { AddMultipleDownloadsSelectSourcePageId, AddMultipleDownloadsEnterSearchTermPageId, AddMultipleDownloadsResultsPageId };
|
2015-04-22 19:32:04 +02:00
|
|
|
|
|
|
|
DownloadSource downloadSourceFromField(const QVariant &fieldValue)
|
|
|
|
{
|
|
|
|
bool ok = false;
|
|
|
|
int value = fieldValue.toInt(&ok);
|
2017-05-01 03:22:50 +02:00
|
|
|
if (ok && value > 0 && value < 4) {
|
2015-04-22 19:32:04 +02:00
|
|
|
return static_cast<DownloadSource>(value);
|
|
|
|
}
|
|
|
|
return DownloadSource::None;
|
|
|
|
}
|
|
|
|
|
2017-05-01 03:22:50 +02:00
|
|
|
AddMultipleDownloadsSelectSourcePage::AddMultipleDownloadsSelectSourcePage(QWidget *parent)
|
|
|
|
: QWizardPage(parent)
|
|
|
|
, m_selectedSource(DownloadSource::None)
|
2015-04-22 19:32:04 +02:00
|
|
|
{
|
|
|
|
// create buttons
|
|
|
|
QCommandLinkButton *webpageLinksButton = new QCommandLinkButton(tr("Links in ordinary webpage"));
|
|
|
|
QCommandLinkButton *youtubePlaylistButton = new QCommandLinkButton(tr("YouTube playlist"));
|
|
|
|
QCommandLinkButton *groovesharkAlbumButton = new QCommandLinkButton(tr("Grooveshark album"));
|
|
|
|
QCommandLinkButton *groovesharkPlaylistButton = new QCommandLinkButton(tr("Grooveshark playlist"));
|
|
|
|
// add layout
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
|
|
layout->addWidget(webpageLinksButton);
|
|
|
|
layout->addWidget(youtubePlaylistButton);
|
|
|
|
layout->addWidget(groovesharkAlbumButton);
|
|
|
|
layout->addWidget(groovesharkPlaylistButton);
|
|
|
|
setLayout(layout);
|
|
|
|
// connect signals and slots
|
2017-05-01 03:22:50 +02:00
|
|
|
connect(webpageLinksButton, &QCommandLinkButton::clicked,
|
|
|
|
std::bind(&AddMultipleDownloadsSelectSourcePage::changeSource, this, DownloadSource::WebpageLinks));
|
|
|
|
connect(youtubePlaylistButton, &QCommandLinkButton::clicked,
|
|
|
|
std::bind(&AddMultipleDownloadsSelectSourcePage::changeSource, this, DownloadSource::YoutubePlaylist));
|
|
|
|
connect(groovesharkAlbumButton, &QCommandLinkButton::clicked,
|
|
|
|
std::bind(&AddMultipleDownloadsSelectSourcePage::changeSource, this, DownloadSource::GroovesharkAlbum));
|
|
|
|
connect(groovesharkPlaylistButton, &QCommandLinkButton::clicked,
|
|
|
|
std::bind(&AddMultipleDownloadsSelectSourcePage::changeSource, this, DownloadSource::GroovesharkPlaylist));
|
2015-04-22 19:32:04 +02:00
|
|
|
// set title
|
|
|
|
setTitle(tr("Source"));
|
|
|
|
setSubTitle(tr("Select the source you want to add downloads from."));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AddMultipleDownloadsSelectSourcePage::isComplete() const
|
|
|
|
{
|
|
|
|
return m_selectedSource != DownloadSource::None;
|
|
|
|
}
|
|
|
|
|
2017-05-01 03:22:50 +02:00
|
|
|
AddMultipleDownloadsEnterSearchTermPage::AddMultipleDownloadsEnterSearchTermPage(QWidget *parent)
|
|
|
|
: QWizardPage(parent)
|
2015-04-22 19:32:04 +02:00
|
|
|
{
|
|
|
|
// create line edit
|
|
|
|
m_searchTermLineEdit = new ClearLineEdit(this);
|
|
|
|
// create check boxes
|
|
|
|
m_byIdCheckBox = new QCheckBox(tr("search by ID"), this);
|
|
|
|
m_verifiedOnlyCheckBox = new QCheckBox(tr("show only verified songs if possible"), nullptr);
|
|
|
|
// add layout
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
|
|
layout->addWidget(m_searchTermLineEdit);
|
|
|
|
layout->addWidget(m_byIdCheckBox);
|
|
|
|
layout->addWidget(m_verifiedOnlyCheckBox);
|
|
|
|
setLayout(layout);
|
|
|
|
// register fields
|
|
|
|
registerField(QStringLiteral("term*"), m_searchTermLineEdit);
|
|
|
|
registerField(QStringLiteral("byid"), m_byIdCheckBox);
|
|
|
|
registerField(QStringLiteral("verifiedonly"), m_verifiedOnlyCheckBox);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AddMultipleDownloadsEnterSearchTermPage::searchTerm() const
|
|
|
|
{
|
|
|
|
return m_searchTermLineEdit->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsEnterSearchTermPage::initializePage()
|
|
|
|
{
|
|
|
|
DownloadSource source = DownloadSource::None;
|
2017-05-01 03:22:50 +02:00
|
|
|
if (AddMultipleDownloadsWizard *w = qobject_cast<AddMultipleDownloadsWizard *>(wizard())) {
|
2015-04-22 19:32:04 +02:00
|
|
|
source = w->source();
|
|
|
|
}
|
2017-05-01 03:22:50 +02:00
|
|
|
switch (source) {
|
2015-04-22 19:32:04 +02:00
|
|
|
case DownloadSource::WebpageLinks:
|
|
|
|
setTitle(tr("Specify the webpage"));
|
|
|
|
setSubTitle(tr("Enter the URL."));
|
|
|
|
setEnabled(true);
|
2019-12-30 22:27:20 +01:00
|
|
|
m_searchTermLineEdit->setPlaceholderText(QStringLiteral("URL"));
|
2015-04-22 19:32:04 +02:00
|
|
|
m_byIdCheckBox->setHidden(true);
|
|
|
|
m_verifiedOnlyCheckBox->setHidden(true);
|
|
|
|
break;
|
|
|
|
case DownloadSource::YoutubePlaylist:
|
|
|
|
setTitle(tr("Specify YouTube playlist"));
|
|
|
|
setSubTitle(tr("Enter the playlist URL or ID."));
|
|
|
|
setEnabled(true);
|
2019-12-30 22:27:20 +01:00
|
|
|
m_searchTermLineEdit->setPlaceholderText(QStringLiteral("URL"));
|
2015-04-22 19:32:04 +02:00
|
|
|
m_byIdCheckBox->setHidden(false);
|
|
|
|
m_verifiedOnlyCheckBox->setHidden(true);
|
|
|
|
break;
|
|
|
|
case DownloadSource::GroovesharkAlbum:
|
|
|
|
setTitle(tr("Specify Grooveshark album"));
|
|
|
|
setSubTitle(tr("Enter a search term or the album ID."));
|
|
|
|
setEnabled(true);
|
|
|
|
m_searchTermLineEdit->setPlaceholderText(tr("search term or ID"));
|
|
|
|
m_byIdCheckBox->setHidden(false);
|
|
|
|
m_verifiedOnlyCheckBox->setHidden(false);
|
|
|
|
break;
|
|
|
|
case DownloadSource::GroovesharkPlaylist:
|
|
|
|
setTitle(tr("Specify Grooveshark playlist"));
|
|
|
|
setSubTitle(tr("Enter a search term or the playlist ID."));
|
|
|
|
setEnabled(true);
|
|
|
|
m_searchTermLineEdit->setPlaceholderText(tr("search term or ID"));
|
|
|
|
m_byIdCheckBox->setHidden(false);
|
|
|
|
m_verifiedOnlyCheckBox->setHidden(false);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
setTitle(tr("No source selected"));
|
|
|
|
setSubTitle(tr("There is no source selected."));
|
|
|
|
setEnabled(false);
|
|
|
|
m_byIdCheckBox->setHidden(true);
|
|
|
|
m_verifiedOnlyCheckBox->setHidden(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-01 03:22:50 +02:00
|
|
|
AddMultipleDownloadsResultsPage::AddMultipleDownloadsResultsPage(QWidget *parent)
|
|
|
|
: QWizardPage(parent)
|
|
|
|
, m_finder(nullptr)
|
|
|
|
, m_model(nullptr)
|
|
|
|
, m_interaction(new DownloadInteraction(parent))
|
|
|
|
, m_complete(false)
|
2015-04-22 19:32:04 +02:00
|
|
|
{
|
|
|
|
// setup view
|
|
|
|
m_view = new QTreeView(this);
|
|
|
|
m_view->setSelectionMode(QTreeView::MultiSelection);
|
|
|
|
m_view->setIndentation(0);
|
|
|
|
m_model = new DownloadFinderResultsModel(nullptr, this);
|
|
|
|
m_view->setModel(m_model);
|
|
|
|
connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged, this, &AddMultipleDownloadsResultsPage::selectionChanged);
|
|
|
|
connect(m_view->verticalScrollBar(), &QScrollBar::valueChanged, this, &AddMultipleDownloadsResultsPage::scrollBarValueChanged);
|
|
|
|
// add layout
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
|
|
layout->addWidget(m_view);
|
|
|
|
setLayout(layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsResultsPage::initializePage()
|
|
|
|
{
|
|
|
|
DownloadSource source = DownloadSource::None;
|
2017-05-01 03:22:50 +02:00
|
|
|
if (AddMultipleDownloadsWizard *w = qobject_cast<AddMultipleDownloadsWizard *>(wizard())) {
|
2015-04-22 19:32:04 +02:00
|
|
|
source = w->source();
|
|
|
|
w->setButtonText(QWizard::CustomButton1, tr("Select all"));
|
|
|
|
w->button(QWizard::CustomButton1)->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-all")));
|
|
|
|
w->setOption(QWizard::HaveCustomButton1, true);
|
|
|
|
connect(w, &QWizard::customButtonClicked, this, &AddMultipleDownloadsResultsPage::customButtonClicked);
|
|
|
|
}
|
|
|
|
// source = downloadSourceFromField(field(QStringLiteral("source"))); // does not work for some reason
|
2017-05-01 03:22:50 +02:00
|
|
|
if (m_finder) {
|
2015-04-22 19:32:04 +02:00
|
|
|
delete m_finder;
|
|
|
|
m_finder = nullptr;
|
|
|
|
}
|
|
|
|
bool byId = field(QStringLiteral("byid")).toBool();
|
|
|
|
QString term = field(QStringLiteral("term")).toString();
|
|
|
|
bool verifiedOnly = field(QStringLiteral("verfiedonly")).toBool();
|
2017-05-01 03:22:50 +02:00
|
|
|
switch (source) {
|
2015-04-22 19:32:04 +02:00
|
|
|
case DownloadSource::WebpageLinks:
|
|
|
|
setTitle(tr("Select links to be added"));
|
|
|
|
m_collectionKind = tr("Webpage");
|
|
|
|
m_collectionContent = tr("links");
|
|
|
|
m_finder = new LinkFinder(QUrl(term), this);
|
|
|
|
break;
|
|
|
|
case DownloadSource::YoutubePlaylist:
|
|
|
|
setTitle(tr("Select videos to be added"));
|
|
|
|
m_collectionKind = tr("YouTube playlist");
|
|
|
|
m_collectionContent = tr("videos");
|
|
|
|
m_finder = byId ? new YoutubePlaylist(term, this) : new YoutubePlaylist(QUrl(term), this);
|
|
|
|
break;
|
|
|
|
case DownloadSource::GroovesharkAlbum:
|
|
|
|
setTitle(tr("Select songs to be added"));
|
|
|
|
m_collectionKind = tr("Grooveshark album");
|
|
|
|
m_collectionContent = tr("songs");
|
2017-05-01 03:22:50 +02:00
|
|
|
m_finder
|
|
|
|
= new GroovesharkSearcher(term, byId ? GroovesharkSearchTermRole::AlbumId : GroovesharkSearchTermRole::AlbumName, verifiedOnly, this);
|
2015-04-22 19:32:04 +02:00
|
|
|
break;
|
|
|
|
case DownloadSource::GroovesharkPlaylist:
|
|
|
|
setTitle(tr("Select songs to be added"));
|
|
|
|
m_collectionKind = tr("Grooveshark playlist");
|
|
|
|
m_collectionContent = tr("songs");
|
2017-05-01 03:22:50 +02:00
|
|
|
m_finder = new GroovesharkSearcher(
|
|
|
|
term, byId ? GroovesharkSearchTermRole::PlaylistId : GroovesharkSearchTermRole::PlaylistName, verifiedOnly, this);
|
2015-04-22 19:32:04 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
setTitle(tr("No source selected"));
|
|
|
|
}
|
|
|
|
m_model->setFinder(m_finder);
|
|
|
|
updateSubTitle();
|
|
|
|
selectionChanged(QItemSelection(), QItemSelection());
|
2017-05-01 03:22:50 +02:00
|
|
|
if (m_finder) {
|
2015-04-22 19:32:04 +02:00
|
|
|
connect(m_finder, &DownloadFinder::requestCreated, m_interaction, &DownloadInteraction::connectDownload);
|
|
|
|
connect(m_finder, &DownloadFinder::finished, this, &AddMultipleDownloadsResultsPage::finderFinished);
|
|
|
|
connect(m_finder, &DownloadFinder::newResultsAvailable, this, &AddMultipleDownloadsResultsPage::finderHasResults);
|
|
|
|
m_finder->setContinueAutomatically(false);
|
2016-04-04 14:51:51 +02:00
|
|
|
m_finder->setProxy(ProxyPage::proxy());
|
2015-04-22 19:32:04 +02:00
|
|
|
m_finder->start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsResultsPage::cleanupPage()
|
|
|
|
{
|
2017-05-01 03:22:50 +02:00
|
|
|
if (wizard()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
wizard()->disconnect(this);
|
|
|
|
wizard()->setOption(QWizard::HaveCustomButton1, false);
|
|
|
|
}
|
|
|
|
m_model->setFinder(nullptr);
|
2017-05-01 03:22:50 +02:00
|
|
|
if (m_finder) {
|
2015-04-22 19:32:04 +02:00
|
|
|
delete m_finder;
|
|
|
|
m_finder = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AddMultipleDownloadsResultsPage::isComplete() const
|
|
|
|
{
|
|
|
|
return m_complete;
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<Download *> AddMultipleDownloadsResultsPage::results() const
|
|
|
|
{
|
|
|
|
QList<Download *> results;
|
2017-05-01 03:22:50 +02:00
|
|
|
if (m_finder) {
|
2015-04-22 19:32:04 +02:00
|
|
|
QModelIndexList selectedRows = m_view->selectionModel()->selectedRows();
|
|
|
|
const QList<Download *> &allResults = m_finder->results();
|
2019-12-30 22:27:20 +01:00
|
|
|
for (const QModelIndex &index : selectedRows) {
|
2017-05-01 03:22:50 +02:00
|
|
|
if (index.row() < allResults.size()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
results << allResults.at(index.row());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return results;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsResultsPage::finderHasResults(const QList<Download *> &newResults)
|
|
|
|
{
|
2017-05-01 03:22:50 +02:00
|
|
|
if (m_finder && !newResults.isEmpty()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
updateSubTitle();
|
2017-05-01 03:22:50 +02:00
|
|
|
if (!m_finder->hasFinished() && !m_finder->isDownloading()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
QScrollBar *sb = m_view->verticalScrollBar();
|
2017-05-01 03:22:50 +02:00
|
|
|
if (!sb || ((sb->maximum() + sb->minimum()) == 0)) {
|
2015-04-22 19:32:04 +02:00
|
|
|
m_finder->start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsResultsPage::finderFinished(bool success, const QString &reason)
|
|
|
|
{
|
2017-05-01 03:22:50 +02:00
|
|
|
if (m_finder) {
|
|
|
|
if (success) {
|
2015-04-22 19:32:04 +02:00
|
|
|
updateSubTitle();
|
|
|
|
} else {
|
2017-05-01 03:22:50 +02:00
|
|
|
if (reason.isEmpty()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
setSubTitle(tr("Failed to retrieve %1.").arg(m_collectionContent));
|
|
|
|
} else {
|
|
|
|
setSubTitle(tr("Failed to retrieve %1: %2").arg(m_collectionContent, reason));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsResultsPage::selectionChanged(const QItemSelection &, const QItemSelection &)
|
|
|
|
{
|
|
|
|
int count = m_view->selectionModel()->selectedRows().count();
|
2017-05-01 03:22:50 +02:00
|
|
|
if (wizard()) {
|
|
|
|
if (count == 1) {
|
2015-04-22 19:32:04 +02:00
|
|
|
wizard()->setButtonText(QWizard::FinishButton, tr("Add selected download").arg(count));
|
|
|
|
setComplete(true);
|
2017-05-01 03:22:50 +02:00
|
|
|
} else if (count > 0) {
|
2015-04-22 19:32:04 +02:00
|
|
|
wizard()->setButtonText(QWizard::FinishButton, tr("Add selected downloads (%1)").arg(count));
|
|
|
|
setComplete(true);
|
|
|
|
} else {
|
|
|
|
setComplete(false);
|
|
|
|
}
|
2017-05-01 03:22:50 +02:00
|
|
|
if (count >= m_model->rowCount()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
wizard()->setButtonText(QWizard::CustomButton1, tr("Repeal selection"));
|
|
|
|
} else {
|
|
|
|
wizard()->setButtonText(QWizard::CustomButton1, tr("Select all"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsResultsPage::scrollBarValueChanged()
|
|
|
|
{
|
2017-05-01 03:22:50 +02:00
|
|
|
if (m_finder && !m_finder->hasFinished() && !m_finder->isDownloading()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
QScrollBar *sb = m_view->verticalScrollBar();
|
2017-05-01 03:22:50 +02:00
|
|
|
if (!sb || (sb->value() == sb->maximum()) || ((sb->maximum() + sb->minimum()) == 0)) {
|
2015-04-22 19:32:04 +02:00
|
|
|
m_finder->start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsResultsPage::customButtonClicked(int which)
|
|
|
|
{
|
2017-05-01 03:22:50 +02:00
|
|
|
if (which == QWizard::CustomButton1) {
|
2015-04-22 19:32:04 +02:00
|
|
|
selectAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsResultsPage::setComplete(bool complete)
|
|
|
|
{
|
2017-05-01 03:22:50 +02:00
|
|
|
if (m_complete != complete) {
|
2015-04-22 19:32:04 +02:00
|
|
|
m_complete = complete;
|
|
|
|
emit completeChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsResultsPage::selectAll()
|
|
|
|
{
|
|
|
|
QItemSelectionModel *selectionModel = m_view->selectionModel();
|
2017-05-01 03:22:50 +02:00
|
|
|
if (selectionModel->selectedRows().length() >= m_model->rowCount()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
selectionModel->clearSelection();
|
|
|
|
} else {
|
|
|
|
m_view->selectAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddMultipleDownloadsResultsPage::updateSubTitle()
|
|
|
|
{
|
|
|
|
QString subTitle;
|
2017-05-01 03:22:50 +02:00
|
|
|
if (m_finder) {
|
|
|
|
if (m_finder->resultCount()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
const QString &collectionTitle = m_finder->collectionTitle();
|
2017-05-01 03:22:50 +02:00
|
|
|
if (collectionTitle.isEmpty()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
subTitle = tr("%1 %2 of the %3 have been retrieved.").arg(m_finder->resultCount()).arg(m_collectionContent, m_collectionKind);
|
|
|
|
} else {
|
2017-05-01 03:22:50 +02:00
|
|
|
subTitle = tr("%1 %2 of the %3 »%4« have been retrieved.")
|
|
|
|
.arg(m_finder->resultCount())
|
|
|
|
.arg(m_collectionContent, m_collectionKind, collectionTitle);
|
2015-04-22 19:32:04 +02:00
|
|
|
}
|
2017-05-01 03:22:50 +02:00
|
|
|
if (!m_finder->hasFinished()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
subTitle.append(' ');
|
|
|
|
subTitle.append(tr("More %1 are available.").arg(m_collectionContent));
|
|
|
|
}
|
|
|
|
} else {
|
2017-05-01 03:22:50 +02:00
|
|
|
if (m_finder->hasFinished()) {
|
2015-04-22 19:32:04 +02:00
|
|
|
subTitle = tr("No %1 could be found.").arg(m_collectionContent);
|
|
|
|
} else {
|
|
|
|
subTitle = tr("Retrieving %1 ...").arg(m_collectionContent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
subTitle = tr("There is no source selected.");
|
|
|
|
}
|
|
|
|
setSubTitle(subTitle);
|
|
|
|
}
|
|
|
|
|
2017-05-01 03:22:50 +02:00
|
|
|
AddMultipleDownloadsWizard::AddMultipleDownloadsWizard(QWidget *parent)
|
|
|
|
: QWizard(parent)
|
2015-04-22 19:32:04 +02:00
|
|
|
{
|
2016-04-20 00:26:49 +02:00
|
|
|
setWindowTitle(tr("Add multiple downloads"));
|
2015-04-22 19:32:04 +02:00
|
|
|
setPage(AddMultipleDownloadsSelectSourcePageId, new AddMultipleDownloadsSelectSourcePage);
|
|
|
|
setPage(AddMultipleDownloadsEnterSearchTermPageId, new AddMultipleDownloadsEnterSearchTermPage);
|
|
|
|
setPage(AddMultipleDownloadsResultsPageId, new AddMultipleDownloadsResultsPage);
|
|
|
|
setButtonText(FinishButton, tr("Add selected downloads"));
|
|
|
|
setButtonText(NextButton, tr("Next"));
|
|
|
|
setButtonText(BackButton, tr("Back"));
|
|
|
|
button(FinishButton)->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
|
|
|
|
button(NextButton)->setIcon(QIcon::fromTheme(QStringLiteral("go-next")));
|
|
|
|
button(BackButton)->setIcon(QIcon::fromTheme(QStringLiteral("go-previous")));
|
|
|
|
button(CancelButton)->setIcon(QIcon::fromTheme(QStringLiteral("window-close")));
|
|
|
|
setOption(WizardOption::HelpButtonOnRight, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
DownloadSource AddMultipleDownloadsWizard::source() const
|
|
|
|
{
|
|
|
|
return qobject_cast<AddMultipleDownloadsSelectSourcePage *>(page(AddMultipleDownloadsSelectSourcePageId))->selectedSource();
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<Download *> AddMultipleDownloadsWizard::results() const
|
|
|
|
{
|
|
|
|
return qobject_cast<AddMultipleDownloadsResultsPage *>(page(AddMultipleDownloadsResultsPageId))->results();
|
|
|
|
}
|
2019-07-20 20:20:58 +02:00
|
|
|
} // namespace QtGui
|