videodownloader/gui/addmultipledownloadswizard.h

117 lines
3.2 KiB
C
Raw Permalink Normal View History

2015-04-22 19:32:04 +02:00
#ifndef ADDMULTIPLEDOWNLOADSWIZARD_H
#define ADDMULTIPLEDOWNLOADSWIZARD_H
2017-05-01 03:22:50 +02:00
#include <QNetworkProxy>
2015-04-22 19:32:04 +02:00
#include <QWizard>
#include <QWizardPage>
QT_FORWARD_DECLARE_CLASS(QCheckBox)
QT_FORWARD_DECLARE_CLASS(QTreeView)
QT_FORWARD_DECLARE_CLASS(QItemSelection)
2015-04-22 19:32:04 +02:00
2019-06-10 22:50:15 +02:00
namespace QtUtilities {
2015-04-22 19:32:04 +02:00
class ClearLineEdit;
}
namespace Network {
class Download;
class DownloadFinder;
2019-07-20 20:20:58 +02:00
} // namespace Network
2015-04-22 19:32:04 +02:00
namespace QtGui {
class DownloadFinderResultsModel;
class DownloadInteraction;
2017-05-01 03:22:50 +02:00
enum class DownloadSource : int { None, WebpageLinks, YoutubePlaylist, GroovesharkAlbum, GroovesharkPlaylist };
2015-04-22 19:32:04 +02:00
extern DownloadSource downloadSourceFromField(const QVariant &fieldValue);
2017-05-01 03:22:50 +02:00
class AddMultipleDownloadsSelectSourcePage : public QWizardPage {
2015-04-22 19:32:04 +02:00
Q_OBJECT
Q_PROPERTY(DownloadSource selectedSource READ selectedSource)
public:
explicit AddMultipleDownloadsSelectSourcePage(QWidget *parent = nullptr);
DownloadSource selectedSource() const;
bool isComplete() const;
private:
void changeSource(DownloadSource source);
DownloadSource m_selectedSource;
};
inline DownloadSource AddMultipleDownloadsSelectSourcePage::selectedSource() const
{
return m_selectedSource;
}
inline void AddMultipleDownloadsSelectSourcePage::changeSource(DownloadSource source)
{
m_selectedSource = source;
emit completeChanged(); // might change
2017-05-01 03:22:50 +02:00
if (source != DownloadSource::None && wizard()) {
2015-04-22 19:32:04 +02:00
setField(QStringLiteral("source"), QVariant(static_cast<int>(source)));
wizard()->next();
}
}
2017-05-01 03:22:50 +02:00
class AddMultipleDownloadsEnterSearchTermPage : public QWizardPage {
2015-04-22 19:32:04 +02:00
Q_OBJECT
public:
explicit AddMultipleDownloadsEnterSearchTermPage(QWidget *parent = nullptr);
QString searchTerm() const;
void initializePage();
2017-05-01 03:22:50 +02:00
2015-04-22 19:32:04 +02:00
private:
2019-06-10 22:50:15 +02:00
QtUtilities::ClearLineEdit *m_searchTermLineEdit;
2015-04-22 19:32:04 +02:00
QCheckBox *m_byIdCheckBox;
QCheckBox *m_verifiedOnlyCheckBox;
};
2017-05-01 03:22:50 +02:00
class AddMultipleDownloadsResultsPage : public QWizardPage {
2015-04-22 19:32:04 +02:00
Q_OBJECT
public:
explicit AddMultipleDownloadsResultsPage(QWidget *parent = nullptr);
void initializePage();
void cleanupPage();
bool isComplete() const;
Network::DownloadFinder *finder() const;
QList<Network::Download *> results() const;
2020-03-08 14:06:45 +01:00
private Q_SLOTS:
2015-04-22 19:32:04 +02:00
void finderHasResults(const QList<Network::Download *> &newResults);
void finderFinished(bool success, const QString &reason = QString());
void selectionChanged(const QItemSelection &, const QItemSelection &);
void scrollBarValueChanged();
void customButtonClicked(int which);
void setComplete(bool complete);
void selectAll();
private:
void updateSubTitle();
QTreeView *m_view;
Network::DownloadFinder *m_finder;
DownloadFinderResultsModel *m_model;
DownloadInteraction *m_interaction;
bool m_complete;
QString m_collectionKind;
QString m_collectionContent;
};
inline Network::DownloadFinder *AddMultipleDownloadsResultsPage::finder() const
{
return m_finder;
}
2017-05-01 03:22:50 +02:00
class AddMultipleDownloadsWizard : public QWizard {
2015-04-22 19:32:04 +02:00
Q_OBJECT
public:
explicit AddMultipleDownloadsWizard(QWidget *parent = nullptr);
DownloadSource source() const;
QList<Network::Download *> results() const;
};
2019-07-20 20:20:58 +02:00
} // namespace QtGui
2015-04-22 19:32:04 +02:00
#endif // ADDMULTIPLEDOWNLOADSWIZARD_H