added simple CMake project file

This commit is contained in:
Martchus 2015-12-05 22:56:32 +01:00
parent f561f68707
commit faecd5b2fa
17 changed files with 121 additions and 834 deletions

76
CMakeLists.txt Normal file
View File

@ -0,0 +1,76 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# meta data
set(META_PROJECT_NAME videodownloader)
set(META_APP_NAME "Video Downloader")
set(META_APP_AUTHOR "Martchus")
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
set(META APP_DESCRIPTION "A video downloader with Qt GUI (currently only YouTube and Vimeo are maintained).")
set(META_VERSION_MAJOR 1)
set(META_VERSION_MINOR 2)
set(META_VERSION_PATCH 1)
# define project
project(${META_PROJECT_NAME})
# stringification of meta data
set(META_PROJECT_NAME_STR "\"${META_PROJECT_NAME}\"")
set(META_APP_NAME_STR "\"${META_APP_NAME}\"")
set(META_APP_AUTHOR_STR "\"${META_APP_AUTHOR}\"")
set(META_APP_URL_STR "\"${META_APP_URL}\"")
set(APP_DESCRIPTION_STR "\"${APP_DESCRIPTION}\"")
set(META_APP_VERSION_STR "\"${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}\"")
# add configuration header
configure_file (
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)
include_directories("${PROJECT_BINARY_DIR}")
# add source and header files
file(GLOB_RECURSE SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "application/*.cpp" "cli/*.cpp" "model/*.cpp" "network/*.cpp" "resources/json.qrc")
file(GLOB_RECURSE WIDGETS_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gui/*.cpp" "itemdelegates/*.cpp" "resources/icons.qrc")
file(GLOB_RECURSE HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "application/*.h" "cli/*.h" "model/*.h" "network/*.h")
file(GLOB_RECURSE WIDGETS_HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gui/*.h" "itemdelegates/*.h")
# enable only Qt Widgets GUI
add_definitions(-DGUI_QTWIDGETS -DMODEL_UNDO_SUPPORT)
# check required Qt 5 modules
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
# enable moc, uic and rcc
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# executable and linking
add_executable(${META_PROJECT_NAME} ${HEADER_FILES} ${SRC_FILES} ${WIDGETS_HEADER_FILES} ${WIDGETS_SRC_FILES})
target_link_libraries(${META_PROJECT_NAME} c++utilities qtutilities Qt5::Core Qt5::Widgets Qt5::Network)
# enable C++11
set_property(TARGET ${META_PROJECT_NAME} PROPERTY CXX_STANDARD 11)
# add install target
install(TARGETS ${META_PROJECT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES resources/icons/hicolor/scalable/apps/${META_PROJECT_NAME}.svg
DESTINATION share/icons/hicolor/scalable/apps
)
install(FILES resources/desktop/applications/${META_PROJECT_NAME}.desktop
DESTINATION share/applications
)
install(FILES resources/json/groovesharkauthenticationinfo.json
DESTINATION share/${META_PROJECT_NAME}/json
)
install(FILES resources/json/itaginfo.json
DESTINATION share/${META_PROJECT_NAME}/json
)

View File

@ -1,6 +1,11 @@
#include "../cli/mainfeatures.h"
#include "../gui/initiate.h"
// include configuration from separate header file when building with CMake
#ifndef APP_METADATA_AVAIL
#include "config.h"
#endif
#if defined(GUI_QTWIDGETS) || defined(GUI_QTQUICK)
# include <qtutilities/resources/qtconfigarguments.h>
#else

9
config.h.in Normal file
View File

@ -0,0 +1,9 @@
#ifndef APP_METADATA_AVAIL
#define APP_METADATA_AVAIL
#define PROJECT_NAME @META_PROJECT_NAME_STR@
#define APP_NAME @META_APP_NAME_STR@
#define APP_VERSION @META_APP_VERSION_STR@
#define APP_AUTHOR @META_APP_AUTHOR_STR@
#define APP_URL @META_APP_URL_STR@
#define APP_DESCRIPTION @META_APP_DESCRIPTION_STR@
#endif // APP_METADATA_AVAIL

View File

@ -1,5 +1,4 @@
#dirs
UI_DIR = ./gui
MOC_DIR = ./moc
OBJECTS_DIR = ./obj
RCC_DIR = ./res
@ -18,6 +17,7 @@ CONFIG(debug, debug|release) {
TARGET = $${targetprefix}$${projectname}
}
# add defines
DEFINES += "APP_METADATA_AVAIL"
DEFINES += "'PROJECT_NAME=\"$${projectname}\"'"
DEFINES += "'APP_NAME=\"$${appname}\"'"
DEFINES += "'APP_AUTHOR=\"$${appauthor}\"'"

View File

@ -10,7 +10,7 @@
#include "../network/spotifydownload.h"
#endif
#include "gui/ui_adddownloaddialog.h"
#include "ui_adddownloaddialog.h"
#include <qtutilities/misc/dialogutils.h>
@ -237,7 +237,6 @@ void AddDownloadDialog::setLastUrl()
m_lastUrl = m_ui->urlLineEdit->text();
settings.setValue("lasturl", m_lastUrl);
settings.endGroup();
}
}

View File

@ -1,438 +0,0 @@
#include "addmultipledownloadsdialog.h"
#include "ui_addmultipledownloadsdialog.h"
#include "download/finder/youtubeplaylist.h"
#include "download/finder/groovesharksearcher.h"
#include <QInputDialog>
#include <QMessageBox>
#include <QStandardItem>
#include <QScrollBar>
#define checkForExistingQuery if(m_finder) { return; }
using namespace ChronoUtilities;
const int AddMultipleDownloadsDialog::m_maxInfoRequests = 3;
const int AddMultipleDownloadsDialog::m_titleCol = 0;
const int AddMultipleDownloadsDialog::m_uploaderCol = 1;
const int AddMultipleDownloadsDialog::m_nrCol = 2;
const int AddMultipleDownloadsDialog::m_collectionCol = 3;
const int AddMultipleDownloadsDialog::m_durationCol = 4;
const int AddMultipleDownloadsDialog::m_idCol = 5;
const QString &emptyField()
{
static const QString value = QStringLiteral("-");
return value;
}
const QString &retrievingField()
{
static const QString value = QApplication::translate("AddMultipleDownloadsDialog", "retrieving ...");
return value;
}
AddMultipleDownloadsDialog::AddMultipleDownloadsDialog(QWidget *parent, const QNetworkProxy &proxy) :
QDialog(parent),
m_ui(new Ui::AddMultipleDownloadsDialog),
m_selectedSource(SelectedSource::YoutubePlaylist),
m_proxy(proxy)
{
// setup ui
m_ui->setupUi(this);
#ifdef Q_OS_WIN32
setStyleSheet(QStringLiteral("* { font: 9pt \"Segoe UI\"; } #mainWidget { color: black; background-color: white; border: none; } #bottomWidget { background-color: #F0F0F0; border-top: 1px solid #DFDFDF; } QMessageBox QLabel, QInputDialog QLabel, QCommandLinkButton { font-size: 12pt; color: #003399; } #buttonsTabWidget, #resultsTabWidget { background-color: white; } #tabWidget:pane { border: none; }"));
#else
setStyleSheet(QStringLiteral("#tabWidget:pane { border: none; }"));
#endif
m_ui->tabWidget->tabBar()->setHidden(true);
m_ui->tabWidget->setCurrentIndex(0);
m_ui->progressBar->setHidden(true);
m_ui->selectAllPushButton->setHidden(true);
m_ui->addPushButton->setHidden(true);
m_ui->searchPushButton->setHidden(true);
m_ui->moreDownloadsAvailableLabel->setHidden(true);
// setup tree view
m_model = new QStandardItemModel(this);
m_model->setHorizontalHeaderLabels(QStringList() << "Title" << "Uploader or Artist" << "Nr." << "Collection name" << "Duration" << "Id");
m_ui->downloadsTreeView->setModel(m_model);
if(QScrollBar *sb = m_ui->downloadsTreeView->verticalScrollBar())
connect(sb, &QScrollBar::valueChanged, this, &AddMultipleDownloadsDialog::scrollBarValueChanged);
// connect signals and slots
connect(m_ui->backPushButton, &QPushButton::clicked, this, &AddMultipleDownloadsDialog::back);
connect(m_ui->addPushButton, &QPushButton::clicked, this, &AddMultipleDownloadsDialog::addResultsClicked);
connect(m_ui->addPushButton, &QPushButton::clicked, this, &AddMultipleDownloadsDialog::accept);
connect(m_ui->searchPushButton, &QPushButton::clicked, this, &AddMultipleDownloadsDialog::startSearch);
connect(m_ui->termLineEdit, &QLineEdit::returnPressed, this, &AddMultipleDownloadsDialog::startSearch);
connect(m_ui->youtubePlaylistCommandLinkButton, &QCommandLinkButton::clicked, this, &AddMultipleDownloadsDialog::youtubePlaylistSelected);
connect(m_ui->groovesharkAlbumCommandLinkButton, &QCommandLinkButton::clicked, this, &AddMultipleDownloadsDialog::groovesharkAlbumSelected);
connect(m_ui->groovesharkPlaylistCommandLinkButton, &QCommandLinkButton::clicked, this, &AddMultipleDownloadsDialog::groovesharkPlaylistSelected);
connect(m_ui->selectAllPushButton, &QPushButton::clicked, this, &AddMultipleDownloadsDialog::selectAll);
connect(m_ui->downloadsTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &AddMultipleDownloadsDialog::updateControls);
// set fields
m_currentInfoRequests = 0;
}
AddMultipleDownloadsDialog::~AddMultipleDownloadsDialog()
{ }
QList<Download *> AddMultipleDownloadsDialog::results()
{
QList<Download *> res;
Download *download;
int rowCount = m_model->rowCount();
QModelIndexList selectedIndexes = m_ui->downloadsTreeView->selectionModel()->selectedRows();
QModelIndex index;
QStandardItem *item;
for(int i = 0; i < rowCount; ++i) {
index = m_model->index(i, 0);
if(selectedIndexes.contains(index)) {
item = m_model->item(i, 0);
download = item->data(Qt::UserRole + 1).value<Download *>();
if(download->status() != DownloadStatus::Failed)
res.append(download);
}
}
return res;
}
void AddMultipleDownloadsDialog::downloadChangedStatus(Download *download)
{
switch(download->status()) {
case DownloadStatus::Failed:
showDownloadError(download);
--m_currentInfoRequests;
break;
case DownloadStatus::Ready:
addDownloadInformation(download);
--m_currentInfoRequests;
break;
default:
;
}
while(m_currentInfoRequests < m_maxInfoRequests
&& !m_pendingDownloads.isEmpty()) {
Download *download = m_pendingDownloads.takeFirst();
if(!download->isInitiated() && download->isInitiatingInstantlyRecommendable()) {
++m_currentInfoRequests;
download->init();
}
}
}
void AddMultipleDownloadsDialog::addFinder(DownloadFinder *finder)
{
m_finder.reset(finder);
m_finder->setContinueAutomatically(false);
connect(finder, &DownloadFinder::newResultsAvailable, this, &AddMultipleDownloadsDialog::addResults);
connect(finder, &DownloadFinder::finished, this, &AddMultipleDownloadsDialog::retrievingFinished);
m_ui->tabWidget->setCurrentIndex(2);
m_ui->progressBar->setHidden(false);
m_ui->addPushButton->setHidden(false);
m_ui->selectAllPushButton->setHidden(false);
m_ui->searchPushButton->setHidden(true);
m_pendingDownloads.clear();
m_currentInfoRequests = 0;
m_ui->titleLabel->setText(tr("Retrieving downloads ..."));
finder->start();
}
void AddMultipleDownloadsDialog::addDownloadInformation(Download *download)
{
QStandardItem *item;
for(int row = 0; row < m_model->rowCount(); ++row) {
item = m_model->item(row, 0);
if(item->data(Qt::UserRole + 1).value<Download *>() == download) {
const QString &title = download->title();
const QString &id = download->id();
const QString &uploader = download->uploader();
const QString &collectionName = download->collectionName();
int nr = download->positionInCollection();
TimeSpan duration = download->duration();
m_model->item(row, m_titleCol)->setText(title.isEmpty() ? emptyField() : title);
m_model->item(row, m_uploaderCol)->setText(uploader.isEmpty() ? emptyField() : uploader);
m_model->item(row, m_nrCol)->setText(nr == 0 ? emptyField() : QStringLiteral("%1").arg(nr));
m_model->item(row, m_collectionCol)->setText(collectionName.isEmpty() ? emptyField() : collectionName);
m_model->item(row, m_durationCol)->setText(duration.isNull() ? emptyField() : QString::fromStdString(duration.toString(TimeSpanOutputFormat::WithMeasures)));
m_model->item(row, m_idCol)->setText(id.isEmpty() ? emptyField() : id);
break;
}
}
}
void AddMultipleDownloadsDialog::showDownloadError(Download *download)
{
QStandardItem *item;
for(int row = 0; row < m_model->rowCount(); ++row) {
item = m_model->item(row, 0);
if(item->data(Qt::UserRole +1).value<Download *>() == download) {
for(int i = m_titleCol; i <= m_idCol; i++) {
item = m_model->item(row, i);
if(i != m_titleCol)
item->setText(QStringLiteral("not found"));
item->setSelectable(false);
}
break;
}
}
}
void AddMultipleDownloadsDialog::youtubePlaylistSelected()
{
checkForExistingQuery;
m_ui->enterTermLabel->setText(tr("Enter the url of the playlist or the id:"));
m_ui->termLineEdit->setInputMethodHints(Qt::ImhUrlCharactersOnly);
m_ui->termLineEdit->setText(m_ui->byIdCheckBox->isChecked() ? QString() : QStringLiteral("http://www.youtube.com/playlist?list="));
m_ui->termLineEdit->selectAll();
m_ui->byIdCheckBox->setHidden(false);
m_ui->verifiedCheckBox->setHidden(true);
m_ui->addPushButton->setHidden(true);
m_ui->searchPushButton->setHidden(false);
m_selectedSource = SelectedSource::YoutubePlaylist;
m_ui->tabWidget->setCurrentIndex(1);
}
void AddMultipleDownloadsDialog::groovesharkAlbumSelected()
{
checkForExistingQuery;
m_ui->enterTermLabel->setText(tr("Enter a search term or the album id:"));
m_ui->termLineEdit->setInputMethodHints(Qt::ImhNone);
m_ui->termLineEdit->clear();
m_ui->byIdCheckBox->setHidden(false);
m_ui->verifiedCheckBox->setHidden(false);
m_ui->addPushButton->setHidden(true);
m_ui->searchPushButton->setHidden(false);
m_selectedSource = SelectedSource::GroovesharkAlbum;
m_ui->tabWidget->setCurrentIndex(1);
// "124486"
}
void AddMultipleDownloadsDialog::groovesharkPlaylistSelected()
{
checkForExistingQuery;
m_ui->enterTermLabel->setText(tr("Enter a search term or the playlist id:"));
m_ui->termLineEdit->setInputMethodHints(Qt::ImhNone);
m_ui->termLineEdit->clear();
m_ui->byIdCheckBox->setHidden(false);
m_ui->verifiedCheckBox->setHidden(false);
m_ui->addPushButton->setHidden(true);
m_ui->searchPushButton->setHidden(false);
m_selectedSource = SelectedSource::GroovesharkPlaylist;
m_ui->tabWidget->setCurrentIndex(1);
}
void AddMultipleDownloadsDialog::startSearch()
{
if(m_ui->tabWidget->currentIndex() != 1)
return;
if(m_ui->termLineEdit->text().isEmpty())
return;
m_ui->searchPushButton->setHidden(false);
switch(m_selectedSource) {
case SelectedSource::YoutubePlaylist:
addFinder(new YoutubePlaylist(
m_ui->byIdCheckBox->isChecked() ?
QUrl(QStringLiteral("http://www.youtube.com/playlist?list=%1").arg(m_ui->termLineEdit->text())) :
m_ui->termLineEdit->text(),
parent()));
break;
case SelectedSource::GroovesharkAlbum:
addFinder(new GroovesharkSearcher(
m_ui->termLineEdit->text(),
m_ui->byIdCheckBox->isChecked() ? GroovesharkSearchTermRole::AlbumId : GroovesharkSearchTermRole::AlbumName,
m_ui->verifiedCheckBox->isChecked(),
parent()));
break;
case SelectedSource::GroovesharkPlaylist:
addFinder(new GroovesharkSearcher(
m_ui->termLineEdit->text(),
m_ui->byIdCheckBox->isChecked() ? GroovesharkSearchTermRole::PlaylistId : GroovesharkSearchTermRole::PlaylistName,
m_ui->verifiedCheckBox->isChecked(),
parent()));
break;
}
}
void AddMultipleDownloadsDialog::addResults(const QList<Download *> &results)
{
if(m_ui->tabWidget->currentIndex() != 2)
return;
foreach(Download *download, results) {
QList<QStandardItem *> items;
QStandardItem *item;
item = new QStandardItem(download->title());
item->setEditable(false);
item->setData(QVariant::fromValue(download), Qt::UserRole + 1);
items << item;
item = new QStandardItem(download->uploader().isEmpty() ? retrievingField() : download->uploader());
item->setEditable(false);
items << item;
item = new QStandardItem(download->positionInCollection() == 0 ? retrievingField() : QString("%1").arg(download->positionInCollection()));
item->setEditable(false);
items << item;
item = new QStandardItem(download->collectionName().isEmpty() ? retrievingField() : download->collectionName());
item->setEditable(false);
items << item;
item = new QStandardItem(download->duration().isNull() ? retrievingField() : QString::fromStdString(download->duration().toString()));
item->setEditable(false);
items << item;
item = new QStandardItem(download->id().isEmpty() ? retrievingField() : download->id());
item->setEditable(false);
items << item;
m_model->appendRow(items);
connect(download, &Download::statusChanged, this, &AddMultipleDownloadsDialog::downloadChangedStatus);
if(download->isInitiated() || (!download->isInitiatingInstantlyRecommendable()))
addDownloadInformation(download);
else {
if(m_currentInfoRequests < m_maxInfoRequests) {
++m_currentInfoRequests;
download->setProxy(m_proxy);
download->init();
} else {
m_pendingDownloads.append(download);
}
}
}
m_ui->selectAllPushButton->setText(tr("Select all"));
if(m_finder) {
if(!m_finder->collectionTitle().isEmpty()) {
m_ui->titleLabel->setText(m_listName + m_finder->collectionTitle());
}
if(!m_finder->hasFinished() && !m_finder->isDownloading()) {
QScrollBar *sb = m_ui->downloadsTreeView->verticalScrollBar();
if(!sb || ((sb->maximum() + sb->minimum()) == 0)) {
m_ui->progressBar->setHidden(false);
m_finder->start();
} else {
m_ui->progressBar->setHidden(true);
}
}
}
}
void AddMultipleDownloadsDialog::scrollBarValueChanged()
{
if(m_finder && !m_finder->hasFinished() && !m_finder->isDownloading()) {
QScrollBar *sb = m_ui->downloadsTreeView->verticalScrollBar();
if(!sb || (sb->value() == sb->maximum()) || ((sb->maximum() + sb->minimum()) == 0)) {
m_ui->progressBar->setHidden(false);
m_finder->start();
} else {
m_ui->progressBar->setHidden(true);
}
} else {
m_ui->progressBar->setHidden(true);
}
}
void AddMultipleDownloadsDialog::retrievingFinished(bool sucess, const QString &reasonForFail)
{
if(m_finder) {
m_ui->progressBar->setHidden(true);
m_ui->selectAllPushButton->setHidden(false);
m_ui->addPushButton->setHidden(false);
m_ui->titleLabel->setText(sucess
? (m_listName + m_finder->collectionTitle())
: tr("Failed to retrieve downloads: %1").arg(reasonForFail));
m_finder.release()->deleteLater();
}
}
void AddMultipleDownloadsDialog::updateControls(const QItemSelection &, const QItemSelection &)
{
int count = m_ui->downloadsTreeView->selectionModel()->selectedRows().count();
if(count > 0) {
m_ui->addPushButton->setText(tr("Add selected downloads (%1)").arg(count));
m_ui->addPushButton->setEnabled(true);
} else {
m_ui->addPushButton->setText(tr("Add selected downloads"));
m_ui->addPushButton->setEnabled(false);
}
if(count >= m_model->rowCount())
m_ui->selectAllPushButton->setText(tr("Repeal selection"));
else
m_ui->selectAllPushButton->setText(tr("Select all"));
}
void AddMultipleDownloadsDialog::selectAll()
{
QItemSelectionModel *selectionModel = m_ui->downloadsTreeView->selectionModel();
if(selectionModel->selectedRows().length() >= m_model->rowCount())
selectionModel->clearSelection();
else
m_ui->downloadsTreeView->selectAll();
}
void AddMultipleDownloadsDialog::back()
{
m_finder.reset();
switch(m_ui->tabWidget->currentIndex()) {
case 0:
close();
break;
case 1:
reset();
break;
case 2:
abortSearch();
break;
}
}
void AddMultipleDownloadsDialog::reset()
{
m_finder.reset();
m_ui->progressBar->setHidden(true);
m_ui->selectAllPushButton->setHidden(true);
m_ui->addPushButton->setHidden(true);
m_ui->searchPushButton->setHidden(true);
m_ui->tabWidget->setCurrentIndex(0);
m_model->removeRows(0, m_model->rowCount());
m_pendingDownloads.clear();
m_currentInfoRequests = 0;
}
void AddMultipleDownloadsDialog::abortSearch()
{
m_finder.reset();
m_ui->tabWidget->setCurrentIndex(1);
m_ui->progressBar->setHidden(true);
m_ui->selectAllPushButton->setHidden(true);
m_ui->addPushButton->setHidden(true);
m_ui->searchPushButton->setHidden(false);
m_model->removeRows(0, m_model->rowCount());
m_pendingDownloads.clear();
m_currentInfoRequests = 0;
m_ui->titleLabel->setText(tr("Aborted"));
}

View File

@ -1,76 +0,0 @@
#ifndef ADDMULTIPLEDOWNLOADSDIALOG_H
#define ADDMULTIPLEDOWNLOADSDIALOG_H
#include "download/download.h"
#include "download/finder/downloadfinder.h"
#include <QDialog>
#include <QStandardItemModel>
#include <QItemSelection>
#include <QNetworkProxy>
namespace Ui {
class AddMultipleDownloadsDialog;
}
class AddMultipleDownloadsDialog : public QDialog
{
Q_OBJECT
public:
explicit AddMultipleDownloadsDialog(QWidget *parent = nullptr, const QNetworkProxy &proxy = QNetworkProxy());
~AddMultipleDownloadsDialog();
QList<Download *> results();
public slots:
void selectAll();
void back();
void reset();
void abortSearch();
signals:
void addResultsClicked();
private slots:
void youtubePlaylistSelected();
void groovesharkAlbumSelected();
void groovesharkPlaylistSelected();
void startSearch();
void downloadChangedStatus(Download *download);
void addResults(const QList<Download *> &results);
void retrievingFinished(bool sucess, const QString &reasonForFail);
void updateControls(const QItemSelection &selected, const QItemSelection &deselected);
void scrollBarValueChanged();
private:
enum class SelectedSource
{
YoutubePlaylist,
GroovesharkAlbum,
GroovesharkPlaylist
};
void addFinder(DownloadFinder *finder);
void addDownloadInformation(Download *download);
void showDownloadError(Download *download);
std::unique_ptr<Ui::AddMultipleDownloadsDialog> m_ui;
QStandardItemModel *m_model;
std::unique_ptr<DownloadFinder> m_finder;
SelectedSource m_selectedSource;
QString m_listName;
static const int m_maxInfoRequests;
int m_currentInfoRequests;
QList<Download *> m_pendingDownloads;
const QNetworkProxy &m_proxy;
static const int m_titleCol;
static const int m_uploaderCol;
static const int m_nrCol;
static const int m_collectionCol;
static const int m_durationCol;
static const int m_idCol;
};
#endif // ADDMULTIPLEDOWNLOADSDIALOG_H

View File

@ -1,308 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddMultipleDownloadsDialog</class>
<widget class="QDialog" name="AddMultipleDownloadsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>702</width>
<height>329</height>
</rect>
</property>
<property name="windowTitle">
<string>Add multiple downloads</string>
</property>
<property name="styleSheet">
<string notr="true">#tabWidget::pane {
border: none;
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="mainWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
</property>
<widget class="QWidget" name="buttonsTabWidget">
<attribute name="title">
<string>Select source</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="sourceLabel">
<property name="text">
<string>Select the source you want to add downloads from:</string>
</property>
</widget>
</item>
<item>
<widget class="QCommandLinkButton" name="youtubePlaylistCommandLinkButton">
<property name="text">
<string>Youtube playlist</string>
</property>
</widget>
</item>
<item>
<widget class="QCommandLinkButton" name="groovesharkAlbumCommandLinkButton">
<property name="text">
<string>Grooveshark album</string>
</property>
</widget>
</item>
<item>
<widget class="QCommandLinkButton" name="groovesharkPlaylistCommandLinkButton">
<property name="text">
<string>Grooveshark playlist</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="enterSearchTermTab">
<attribute name="title">
<string>Enter search term</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="enterTermLabel">
<property name="text">
<string>Enter search term</string>
</property>
</widget>
</item>
<item>
<widget class="Widgets::ClearLineEdit" name="termLineEdit"/>
</item>
<item>
<widget class="QCheckBox" name="byIdCheckBox">
<property name="text">
<string>search by id</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="verifiedCheckBox">
<property name="text">
<string>retrieve only verified songs if possible</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="resultsTabWidget">
<attribute name="title">
<string>Results</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="titleLabel">
<property name="styleSheet">
<string notr="true">font-weight: bold;</string>
</property>
<property name="text">
<string>Retrieving downloads ...</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="downloadsTreeView">
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
<property name="indentation">
<number>0</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
</widget>
</item>
<item>
<widget class="QLabel" name="moreDownloadsAvailableLabel">
<property name="text">
<string>there are more downloads available</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="bottomWidget" native="true">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>55</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="selectAllPushButton">
<property name="text">
<string>Select all</string>
</property>
<property name="icon">
<iconset theme="edit-select-all">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="maximum">
<number>0</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="backPushButton">
<property name="text">
<string>Back</string>
</property>
<property name="icon">
<iconset theme="go-previous">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="searchPushButton">
<property name="text">
<string>Start search</string>
</property>
<property name="icon">
<iconset theme="system-search">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Add selected downloads</string>
</property>
<property name="icon">
<iconset theme="list-add">
<normaloff/>
</iconset>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Widgets::ClearLineEdit</class>
<extends>QLineEdit</extends>
<header location="global">qtutilities/widgets/clearlineedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -1,6 +1,6 @@
#include "./downloadwidget.h"
#include "gui/ui_downloadwidget.h"
#include "ui_downloadwidget.h"
#include <QPaintEvent>
#include <QMouseEvent>

View File

@ -2,6 +2,11 @@
#include "./settings.h"
#include "./mainwindow.h"
// include configuration from separate header file when building with CMake
#ifndef APP_METADATA_AVAIL
#include "config.h"
#endif
#include <qtutilities/resources/qtconfigarguments.h>
#include <qtutilities/resources/resources.h>

View File

@ -19,7 +19,7 @@
#include "../itemdelegates/progressbaritemdelegate.h"
#include "../itemdelegates/comboboxitemdelegate.h"
#include "gui/ui_mainwindow.h"
#include "ui_mainwindow.h"
#include <qtutilities/aboutdialog/aboutdialog.h>
#include <qtutilities/enterpassworddialog/enterpassworddialog.h>

View File

@ -2,7 +2,7 @@
#include "../network/downloadrange.h"
#include "gui/ui_setrangedialog.h"
#include "ui_setrangedialog.h"
#include <qtutilities/misc/dialogutils.h>

View File

@ -3,6 +3,11 @@
#include "../network/download.h"
#include "../network/groovesharkdownload.h"
// include configuration from separate header file when building with CMake
#ifndef APP_METADATA_AVAIL
#include "config.h"
#endif
#include <qtutilities/resources/resources.h>
#include <qtutilities/settingsdialog/optioncategory.h>
#include <qtutilities/settingsdialog/optioncategorymodel.h>
@ -466,7 +471,7 @@ void restoreSettings()
// load grooveshark authentication file
const auto errorMsg = QApplication::translate("QtGui::Settings", "Unable to read Grooveshark authentication information file.\n\nReason: %1\n\nThe values stored in this file are required when connection to Grooveshark. Built-in will values be used instead, but these might be deprecated.");
const auto groovesharkAuthenticationFile = ConfigFile::locateConfigFile(QStringLiteral("videodownloader"), QStringLiteral("json/groovesharkauthenticationinfo.json"), &settings);
const auto groovesharkAuthenticationFile = ConfigFile::locateConfigFile(QStringLiteral(PROJECT_NAME), QStringLiteral("json/groovesharkauthenticationinfo.json"), &settings);
QString reason;
if(!groovesharkAuthenticationFile.isEmpty()) {
if(!GroovesharkDownload::loadAuthenticationInformationFromFile(groovesharkAuthenticationFile, &reason)) {

View File

@ -2,9 +2,9 @@
#define SETTINGSDIALOG_H
// is not required here when building with GCC 4.9.1 or Clan 3.5 - MinGW 4.9.1 fails without including UI headers here
#include "gui/ui_targetpage.h"
#include "gui/ui_proxypage.h"
#include "gui/ui_useragentpage.h"
#include "ui_targetpage.h"
#include "ui_proxypage.h"
#include "ui_useragentpage.h"
#include <qtutilities/settingsdialog/settingsdialog.h>
#include <qtutilities/settingsdialog/optionpage.h>

View File

@ -2,6 +2,11 @@
#include "../application/utils.h"
// include configuration from separate header file when building with CMake
#ifndef APP_METADATA_AVAIL
#include "config.h"
#endif
#include <QUrlQuery>
#include <QCryptographicHash>
#include <QUuid>

View File

@ -2,6 +2,11 @@
#include "../application/utils.h"
// include configuration from separate header file when building with CMake
#ifndef APP_METADATA_AVAIL
#include "config.h"
#endif
#include <qtutilities/resources/resources.h>
#include <QUrlQuery>
@ -58,7 +63,7 @@ void YoutubeDownload::evalVideoInformation(Download *, QBuffer *videoInfoBuffer)
{
if(m_itagInfo.isEmpty()) {
// allow an external config file to be used instead of built-in values
QString path = ConfigFile::locateConfigFile(QStringLiteral("videodownloader"), QStringLiteral("json/itaginfo.json"));
QString path = ConfigFile::locateConfigFile(QStringLiteral(PROJECT_NAME), QStringLiteral("json/itaginfo.json"));
if(path.isEmpty()) {
path = QStringLiteral(":/jsonobjects/itaginfo");
}

View File

@ -2,7 +2,7 @@ projectname = videodownloader
appname = "Video Downloader"
appauthor = Martchus
appurl = "https://github.com/$${appauthor}/$${projectname}"
QMAKE_TARGET_DESCRIPTION = "A video downloader with Qt GUI (currently only YouTube is maintained)."
QMAKE_TARGET_DESCRIPTION = "A video downloader with Qt GUI (currently only YouTube and Vimeo are maintained)."
VERSION = 1.2.1
# include ../../common.pri when building as part of a subdirs project; otherwise include general.pri