Adapt to changes in c++utilities
This commit is contained in:
parent
07d3e130cc
commit
93755c7b43
|
@ -10,7 +10,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <c++utilities/application/commandlineutils.h>
|
#include <c++utilities/application/commandlineutils.h>
|
||||||
#include <c++utilities/application/failure.h>
|
#include <c++utilities/misc/parseerror.h>
|
||||||
#include <qtutilities/resources/resources.h>
|
#include <qtutilities/resources/resources.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
using namespace ApplicationUtilities;
|
using namespace CppUtilities;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ int main(int argc, char *argv[])
|
||||||
downloadArg.setCallback(bind(Cli::download, argc, argv, _1, cref(urlsArg), cref(noConfirmArg)));
|
downloadArg.setCallback(bind(Cli::download, argc, argv, _1, cref(urlsArg), cref(noConfirmArg)));
|
||||||
parser.setMainArguments({ &qtConfigArgs.qtWidgetsGuiArg(), &downloadArg, &helpArg });
|
parser.setMainArguments({ &qtConfigArgs.qtWidgetsGuiArg(), &downloadArg, &helpArg });
|
||||||
// parse arguments
|
// parse arguments
|
||||||
parser.parseArgsOrExit(argc, argv);
|
parser.parseArgs(argc, argv);
|
||||||
// set meta info for application
|
// set meta info for application
|
||||||
if (qtConfigArgs.areQtGuiArgsPresent()) {
|
if (qtConfigArgs.areQtGuiArgsPresent()) {
|
||||||
return QtGui::runWidgetsGui(argc, argv, qtConfigArgs);
|
return QtGui::runWidgetsGui(argc, argv, qtConfigArgs);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
using namespace ApplicationUtilities;
|
using namespace CppUtilities;
|
||||||
|
|
||||||
namespace Cli {
|
namespace Cli {
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
using namespace ApplicationUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace ConversionUtilities;
|
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
|
|
||||||
namespace Cli {
|
namespace Cli {
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace ApplicationUtilities {
|
namespace CppUtilities {
|
||||||
class Argument;
|
class Argument;
|
||||||
class ArgumentOccurrence;
|
class ArgumentOccurrence;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Cli {
|
namespace Cli {
|
||||||
|
|
||||||
void download(int argc, char *argv[], const ApplicationUtilities::ArgumentOccurrence ¶meterValues, const ApplicationUtilities::Argument &urlsArg,
|
void download(int argc, char *argv[], const CppUtilities::ArgumentOccurrence ¶meterValues, const CppUtilities::Argument &urlsArg,
|
||||||
const ApplicationUtilities::Argument &noConfirmArg);
|
const CppUtilities::Argument &noConfirmArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CLI_MAINFEATURES_H
|
#endif // CLI_MAINFEATURES_H
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
using namespace Dialogs;
|
using namespace QtUtilities;
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="Widgets::ClearLineEdit" name="urlLineEdit">
|
<widget class="QtUtilities::ClearLineEdit" name="urlLineEdit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>Widgets::ClearLineEdit</class>
|
<class>QtUtilities::ClearLineEdit</class>
|
||||||
<extends>QLineEdit</extends>
|
<extends>QLineEdit</extends>
|
||||||
<header location="global">qtutilities/widgets/clearlineedit.h</header>
|
<header location="global">qtutilities/widgets/clearlineedit.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
using namespace Widgets;
|
using namespace QtUtilities;
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
|
|
@ -9,7 +9,7 @@ QT_FORWARD_DECLARE_CLASS(QCheckBox)
|
||||||
QT_FORWARD_DECLARE_CLASS(QTreeView)
|
QT_FORWARD_DECLARE_CLASS(QTreeView)
|
||||||
QT_FORWARD_DECLARE_CLASS(QItemSelection)
|
QT_FORWARD_DECLARE_CLASS(QItemSelection)
|
||||||
|
|
||||||
namespace Widgets {
|
namespace QtUtilities {
|
||||||
class ClearLineEdit;
|
class ClearLineEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,16 +29,12 @@ extern DownloadSource downloadSourceFromField(const QVariant &fieldValue);
|
||||||
|
|
||||||
class AddMultipleDownloadsSelectSourcePage : public QWizardPage {
|
class AddMultipleDownloadsSelectSourcePage : public QWizardPage {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
//Q_PROPERTY(DownloadSource selectedSource READ selectedSource NOTIFY sourceSelected)
|
|
||||||
Q_PROPERTY(DownloadSource selectedSource READ selectedSource)
|
Q_PROPERTY(DownloadSource selectedSource READ selectedSource)
|
||||||
public:
|
public:
|
||||||
explicit AddMultipleDownloadsSelectSourcePage(QWidget *parent = nullptr);
|
explicit AddMultipleDownloadsSelectSourcePage(QWidget *parent = nullptr);
|
||||||
DownloadSource selectedSource() const;
|
DownloadSource selectedSource() const;
|
||||||
bool isComplete() const;
|
bool isComplete() const;
|
||||||
|
|
||||||
signals:
|
|
||||||
//void sourceSelected();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void changeSource(DownloadSource source);
|
void changeSource(DownloadSource source);
|
||||||
DownloadSource m_selectedSource;
|
DownloadSource m_selectedSource;
|
||||||
|
@ -67,7 +63,7 @@ public:
|
||||||
void initializePage();
|
void initializePage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Widgets::ClearLineEdit *m_searchTermLineEdit;
|
QtUtilities::ClearLineEdit *m_searchTermLineEdit;
|
||||||
QCheckBox *m_byIdCheckBox;
|
QCheckBox *m_byIdCheckBox;
|
||||||
QCheckBox *m_verifiedOnlyCheckBox;
|
QCheckBox *m_verifiedOnlyCheckBox;
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
|
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
|
using namespace QtUtilities;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
|
||||||
|
@ -191,7 +192,7 @@ void DownloadInteraction::downloadRequiresRedirectionPermission(Download *downlo
|
||||||
|
|
||||||
void DownloadInteraction::downloadRequiresAuthentication(Download *download, size_t optionIndex, const QString &realm)
|
void DownloadInteraction::downloadRequiresAuthentication(Download *download, size_t optionIndex, const QString &realm)
|
||||||
{
|
{
|
||||||
Dialogs::EnterPasswordDialog *dlg = new Dialogs::EnterPasswordDialog(m_parentWidget);
|
auto *const dlg = new EnterPasswordDialog(m_parentWidget);
|
||||||
QString downloadName = download->downloadUrl().isEmpty() ? download->id() : download->downloadUrl().toString();
|
QString downloadName = download->downloadUrl().isEmpty() ? download->id() : download->downloadUrl().toString();
|
||||||
dlg->setModal(false);
|
dlg->setModal(false);
|
||||||
dlg->setPromptForUserName(true);
|
dlg->setPromptForUserName(true);
|
||||||
|
@ -200,7 +201,7 @@ void DownloadInteraction::downloadRequiresAuthentication(Download *download, siz
|
||||||
if (!realm.isEmpty()) {
|
if (!realm.isEmpty()) {
|
||||||
dlg->setDescription(tr("Realm: %1").arg(realm));
|
dlg->setDescription(tr("Realm: %1").arg(realm));
|
||||||
}
|
}
|
||||||
connect(dlg, &Dialogs::EnterPasswordDialog::accepted, [download, optionIndex, dlg] {
|
connect(dlg, &EnterPasswordDialog::accepted, [download, optionIndex, dlg] {
|
||||||
download->provideAuthenticationCredentials(optionIndex, AuthenticationCredentials(dlg->userName(), dlg->password()));
|
download->provideAuthenticationCredentials(optionIndex, AuthenticationCredentials(dlg->userName(), dlg->password()));
|
||||||
dlg->deleteLater();
|
dlg->deleteLater();
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ApplicationUtilities;
|
using namespace CppUtilities;
|
||||||
|
using namespace QtUtilities;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#ifndef QTGUI_INIT_H
|
#ifndef QTGUI_INIT_H
|
||||||
#define QTGUI_INIT_H
|
#define QTGUI_INIT_H
|
||||||
|
|
||||||
namespace ApplicationUtilities {
|
namespace CppUtilities {
|
||||||
class QtConfigArguments;
|
class QtConfigArguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
|
||||||
int runWidgetsGui(int argc, char *argv[], const ApplicationUtilities::QtConfigArguments &qtConfigArgs);
|
int runWidgetsGui(int argc, char *argv[], const CppUtilities::QtConfigArguments &qtConfigArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // QTGUI_INIT_H
|
#endif // QTGUI_INIT_H
|
||||||
|
|
|
@ -49,9 +49,8 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace IoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace ConversionUtilities;
|
using namespace QtUtilities;
|
||||||
using namespace ChronoUtilities;
|
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
@ -196,7 +195,7 @@ MainWindow::~MainWindow()
|
||||||
void MainWindow::showAboutDialog()
|
void MainWindow::showAboutDialog()
|
||||||
{
|
{
|
||||||
if (!m_aboutDlg) {
|
if (!m_aboutDlg) {
|
||||||
m_aboutDlg = new Dialogs::AboutDialog(this, tr("A video downloader with Qt GUI (currently only YouTube is maintained)."),
|
m_aboutDlg = new AboutDialog(this, tr("A video downloader with Qt GUI (currently only YouTube is maintained)."),
|
||||||
QImage(QStringLiteral(":/icons/hicolor/128x128/apps/videodownloader.png")));
|
QImage(QStringLiteral(":/icons/hicolor/128x128/apps/videodownloader.png")));
|
||||||
}
|
}
|
||||||
if (m_aboutDlg->isHidden()) {
|
if (m_aboutDlg->isHidden()) {
|
||||||
|
@ -758,7 +757,7 @@ void MainWindow::exploreDownloadsDir()
|
||||||
QMessageBox::warning(this, windowTitle(), tr("There is no download target selected."));
|
QMessageBox::warning(this, windowTitle(), tr("There is no download target selected."));
|
||||||
} else {
|
} else {
|
||||||
if (QDir(TargetPage::targetDirectory()).exists()) {
|
if (QDir(TargetPage::targetDirectory()).exists()) {
|
||||||
DesktopUtils::openLocalFileOrDir(TargetPage::targetDirectory());
|
openLocalFileOrDir(TargetPage::targetDirectory());
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::warning(this, windowTitle(), tr("The selected download directory doesn't exist anymore."));
|
QMessageBox::warning(this, windowTitle(), tr("The selected download directory doesn't exist anymore."));
|
||||||
}
|
}
|
||||||
|
@ -845,7 +844,7 @@ void MainWindow::updateOverallStatus(Download *download)
|
||||||
status.append("s");
|
status.append("s");
|
||||||
}
|
}
|
||||||
status.append(QStringLiteral(" - "));
|
status.append(QStringLiteral(" - "));
|
||||||
status.append(QString::fromStdString(ConversionUtilities::bitrateToString(m_totalSpeed, true)));
|
status.append(QString::fromStdString(bitrateToString(m_totalSpeed, true)));
|
||||||
if (!m_remainingTime.isNull()) {
|
if (!m_remainingTime.isNull()) {
|
||||||
status.append(tr(", about %1 remaining").arg(QString::fromStdString(m_remainingTime.toString(TimeSpanOutputFormat::WithMeasures, true))));
|
status.append(tr(", about %1 remaining").arg(QString::fromStdString(m_remainingTime.toString(TimeSpanOutputFormat::WithMeasures, true))));
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ class QSpinBox;
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace QtUtilities {
|
||||||
class AboutDialog;
|
class AboutDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,13 +111,13 @@ private:
|
||||||
int m_initiatingDownloads;
|
int m_initiatingDownloads;
|
||||||
double m_totalSpeed;
|
double m_totalSpeed;
|
||||||
qint64 m_stillToReceive;
|
qint64 m_stillToReceive;
|
||||||
ChronoUtilities::TimeSpan m_remainingTime;
|
CppUtilities::TimeSpan m_remainingTime;
|
||||||
QTime m_elapsedTime;
|
QTime m_elapsedTime;
|
||||||
DownloadInteraction *m_downloadInteraction;
|
DownloadInteraction *m_downloadInteraction;
|
||||||
AddDownloadDialog *m_addDownloadDlg;
|
AddDownloadDialog *m_addDownloadDlg;
|
||||||
AddMultipleDownloadsWizard *m_addMultipleDownloadsWizard;
|
AddMultipleDownloadsWizard *m_addMultipleDownloadsWizard;
|
||||||
SettingsDialog *m_settingsDlg;
|
SettingsDialog *m_settingsDlg;
|
||||||
Dialogs::AboutDialog *m_aboutDlg;
|
QtUtilities::AboutDialog *m_aboutDlg;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
using namespace Dialogs;
|
using namespace QtUtilities;
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
|
|
@ -33,9 +33,8 @@
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
using namespace ConversionUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace Dialogs;
|
using namespace QtUtilities;
|
||||||
using namespace Widgets;
|
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
@ -370,7 +369,7 @@ bool StatsPage::apply()
|
||||||
void StatsPage::reset()
|
void StatsPage::reset()
|
||||||
{
|
{
|
||||||
if (hasBeenShown()) {
|
if (hasBeenShown()) {
|
||||||
m_receivedLabel->setText(QString::fromStdString(ConversionUtilities::dataSizeToString(bytesReceived(), true)));
|
m_receivedLabel->setText(QString::fromStdString(dataSizeToString(bytesReceived(), true)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,30 +396,30 @@ QWidget *StatsPage::setupWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(QWidget *parent)
|
SettingsDialog::SettingsDialog(QWidget *parent)
|
||||||
: Dialogs::SettingsDialog(parent)
|
: QtUtilities::SettingsDialog(parent)
|
||||||
{
|
{
|
||||||
// setup categories
|
// setup categories
|
||||||
QList<Dialogs::OptionCategory *> categories;
|
QList<OptionCategory *> categories;
|
||||||
Dialogs::OptionCategory *category;
|
OptionCategory *category;
|
||||||
|
|
||||||
category = new Dialogs::OptionCategory(this);
|
category = new OptionCategory(this);
|
||||||
category->setDisplayName(tr("General"));
|
category->setDisplayName(tr("General"));
|
||||||
category->assignPages(QList<Dialogs::OptionPage *>() << new TargetPage(this) << new UiPage());
|
category->assignPages(QList<OptionPage *>() << new TargetPage(this) << new UiPage());
|
||||||
category->setIcon(
|
category->setIcon(
|
||||||
QIcon::fromTheme(QStringLiteral("preferences-other"), QIcon(QStringLiteral(":/icons/hicolor/32x32/categories/preferences-general.png"))));
|
QIcon::fromTheme(QStringLiteral("preferences-other"), QIcon(QStringLiteral(":/icons/hicolor/32x32/categories/preferences-general.png"))));
|
||||||
categories << category;
|
categories << category;
|
||||||
|
|
||||||
category = new Dialogs::OptionCategory(this);
|
category = new OptionCategory(this);
|
||||||
category->setDisplayName(tr("Network"));
|
category->setDisplayName(tr("Network"));
|
||||||
category->setIcon(QIcon::fromTheme(
|
category->setIcon(QIcon::fromTheme(
|
||||||
QStringLiteral("preferences-system-network"), QIcon(QStringLiteral(":/icons/hicolor/32x32/categories/preferences-network.png"))));
|
QStringLiteral("preferences-system-network"), QIcon(QStringLiteral(":/icons/hicolor/32x32/categories/preferences-network.png"))));
|
||||||
category->assignPages(QList<Dialogs::OptionPage *>() << new ProxyPage() << new UserAgentPage() << new MiscPage() << new StatsPage());
|
category->assignPages(QList<OptionPage *>() << new ProxyPage() << new UserAgentPage() << new MiscPage() << new StatsPage());
|
||||||
categories << category;
|
categories << category;
|
||||||
|
|
||||||
category = new Dialogs::OptionCategory(this);
|
category = new OptionCategory(this);
|
||||||
category->setDisplayName(tr("Specific"));
|
category->setDisplayName(tr("Specific"));
|
||||||
category->setIcon(QIcon(QStringLiteral(":/icons/hicolor/32x32/categories/preferences-specific.png")));
|
category->setIcon(QIcon(QStringLiteral(":/icons/hicolor/32x32/categories/preferences-specific.png")));
|
||||||
category->assignPages(QList<Dialogs::OptionPage *>());
|
category->assignPages(QList<OptionPage *>());
|
||||||
categories << category;
|
categories << category;
|
||||||
|
|
||||||
categories << qtSettings().category();
|
categories << qtSettings().category();
|
||||||
|
@ -436,9 +435,9 @@ SettingsDialog::~SettingsDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialogs::QtSettings &qtSettings()
|
QtSettings &qtSettings()
|
||||||
{
|
{
|
||||||
static Dialogs::QtSettings v;
|
static QtSettings v;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ QT_FORWARD_DECLARE_CLASS(QLineEdit)
|
||||||
QT_FORWARD_DECLARE_CLASS(QCheckBox)
|
QT_FORWARD_DECLARE_CLASS(QCheckBox)
|
||||||
QT_FORWARD_DECLARE_CLASS(QNetworkProxy)
|
QT_FORWARD_DECLARE_CLASS(QNetworkProxy)
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace QtUtilities {
|
||||||
class QtSettings;
|
class QtSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,14 +75,14 @@ private:
|
||||||
QLabel *m_receivedLabel;
|
QLabel *m_receivedLabel;
|
||||||
END_DECLARE_OPTION_PAGE
|
END_DECLARE_OPTION_PAGE
|
||||||
|
|
||||||
class SettingsDialog : public Dialogs::SettingsDialog {
|
class SettingsDialog : public QtUtilities::SettingsDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SettingsDialog(QWidget *parent = nullptr);
|
explicit SettingsDialog(QWidget *parent = nullptr);
|
||||||
~SettingsDialog();
|
~SettingsDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
Dialogs::QtSettings &qtSettings();
|
QtUtilities::QtSettings &qtSettings();
|
||||||
void restoreSettings();
|
void restoreSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void applySettingsToDownload(Network::Download *download);
|
void applySettingsToDownload(Network::Download *download);
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Widgets::ClearLineEdit" name="customLineEdit">
|
<widget class="QtUtilities::ClearLineEdit" name="customLineEdit">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>Widgets::ClearLineEdit</class>
|
<class>QtUtilities::ClearLineEdit</class>
|
||||||
<extends>QLineEdit</extends>
|
<extends>QLineEdit</extends>
|
||||||
<header location="global">qtutilities/widgets/clearlineedit.h</header>
|
<header location="global">qtutilities/widgets/clearlineedit.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
using namespace ChronoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
|
|
||||||
namespace ChronoUtilities {
|
namespace CppUtilities {
|
||||||
class TimeSpan;
|
class TimeSpan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
static const QString &infoString(const QString &string);
|
static const QString &infoString(const QString &string);
|
||||||
static QString infoString(int num);
|
static QString infoString(int num);
|
||||||
static QString infoString(const ChronoUtilities::TimeSpan &timeSpan);
|
static QString infoString(const CppUtilities::TimeSpan &timeSpan);
|
||||||
|
|
||||||
Network::DownloadFinder *m_finder;
|
Network::DownloadFinder *m_finder;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <c++utilities/conversion/stringconversion.h>
|
#include <c++utilities/conversion/stringconversion.h>
|
||||||
|
|
||||||
|
using namespace CppUtilities;
|
||||||
using namespace Network;
|
using namespace Network;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
@ -297,7 +298,7 @@ QString DownloadModel::statusString(Download *download)
|
||||||
case DownloadStatus::Waiting:
|
case DownloadStatus::Waiting:
|
||||||
return tr("waiting");
|
return tr("waiting");
|
||||||
case DownloadStatus::Downloading:
|
case DownloadStatus::Downloading:
|
||||||
return tr("downloading, %1").arg(QString::fromStdString(ConversionUtilities::bitrateToString(download->speed(), true)));
|
return tr("downloading, %1").arg(QString::fromStdString(bitrateToString(download->speed(), true)));
|
||||||
case DownloadStatus::FinishOuputFile:
|
case DownloadStatus::FinishOuputFile:
|
||||||
return tr("download ended, still writing to output device");
|
return tr("download ended, still writing to output device");
|
||||||
case DownloadStatus::Interrupting:
|
case DownloadStatus::Interrupting:
|
||||||
|
@ -322,11 +323,11 @@ QString DownloadModel::progressString(Download *download)
|
||||||
if (download->bytesReceived() > 0) {
|
if (download->bytesReceived() > 0) {
|
||||||
if (download->bytesToReceive() > download->bytesReceived()) {
|
if (download->bytesToReceive() > download->bytesReceived()) {
|
||||||
return tr("%1 of %2 received, %3 %")
|
return tr("%1 of %2 received, %3 %")
|
||||||
.arg(QString::fromStdString(ConversionUtilities::dataSizeToString(download->bytesReceived())))
|
.arg(QString::fromStdString(dataSizeToString(download->bytesReceived())))
|
||||||
.arg(QString::fromStdString(ConversionUtilities::dataSizeToString(download->bytesToReceive())))
|
.arg(QString::fromStdString(dataSizeToString(download->bytesToReceive())))
|
||||||
.arg(download->progressPercentage());
|
.arg(download->progressPercentage());
|
||||||
} else {
|
} else {
|
||||||
return tr("%1 received").arg(QString::fromStdString(ConversionUtilities::dataSizeToString(download->bytesReceived())));
|
return tr("%1 received").arg(QString::fromStdString(dataSizeToString(download->bytesReceived())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
|
|
|
@ -17,8 +17,7 @@
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ChronoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace IoUtilities;
|
|
||||||
|
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,8 @@ public:
|
||||||
int progressPercentage() const;
|
int progressPercentage() const;
|
||||||
double speed() const;
|
double speed() const;
|
||||||
double shiftSpeed();
|
double shiftSpeed();
|
||||||
ChronoUtilities::TimeSpan remainingTime() const;
|
CppUtilities::TimeSpan remainingTime() const;
|
||||||
ChronoUtilities::TimeSpan shiftRemainingTime();
|
CppUtilities::TimeSpan shiftRemainingTime();
|
||||||
qint64 bytesReceived() const;
|
qint64 bytesReceived() const;
|
||||||
qint64 newBytesReceived();
|
qint64 newBytesReceived();
|
||||||
qint64 bytesToReceive() const;
|
qint64 bytesToReceive() const;
|
||||||
|
@ -103,7 +103,7 @@ public:
|
||||||
void setProxy(const QNetworkProxy &value);
|
void setProxy(const QNetworkProxy &value);
|
||||||
const QString &uploader() const;
|
const QString &uploader() const;
|
||||||
int views() const;
|
int views() const;
|
||||||
ChronoUtilities::TimeSpan duration() const;
|
CppUtilities::TimeSpan duration() const;
|
||||||
const QString &rating() const;
|
const QString &rating() const;
|
||||||
int positionInCollection() const;
|
int positionInCollection() const;
|
||||||
int progressUpdateInterval() const;
|
int progressUpdateInterval() const;
|
||||||
|
@ -114,7 +114,7 @@ public:
|
||||||
virtual bool supportsRange() const;
|
virtual bool supportsRange() const;
|
||||||
virtual QString typeName() const = 0;
|
virtual QString typeName() const = 0;
|
||||||
void provideMetaData(const QString &title = QString(), const QString &uploader = QString(),
|
void provideMetaData(const QString &title = QString(), const QString &uploader = QString(),
|
||||||
ChronoUtilities::TimeSpan duration = ChronoUtilities::TimeSpan(), const QString &collectionName = QString(), int positionInCollection = 0,
|
CppUtilities::TimeSpan duration = CppUtilities::TimeSpan(), const QString &collectionName = QString(), int positionInCollection = 0,
|
||||||
int views = 0, const QString &rating = QString());
|
int views = 0, const QString &rating = QString());
|
||||||
void setOverwritePermission(size_t optionIndex, PermissionStatus permission);
|
void setOverwritePermission(size_t optionIndex, PermissionStatus permission);
|
||||||
void setAppendPermission(size_t optionIndex, PermissionStatus permission);
|
void setAppendPermission(size_t optionIndex, PermissionStatus permission);
|
||||||
|
@ -171,7 +171,7 @@ protected slots:
|
||||||
void setTitleFromFilename(const QString &valueObtainedFromFilename);
|
void setTitleFromFilename(const QString &valueObtainedFromFilename);
|
||||||
void setUploader(const QString &value);
|
void setUploader(const QString &value);
|
||||||
void setViews(int value);
|
void setViews(int value);
|
||||||
void setDuration(ChronoUtilities::TimeSpan value);
|
void setDuration(CppUtilities::TimeSpan value);
|
||||||
void setRating(const QString &value);
|
void setRating(const QString &value);
|
||||||
void setPositionInCollection(int value);
|
void setPositionInCollection(int value);
|
||||||
void setCollectionName(const QString &value);
|
void setCollectionName(const QString &value);
|
||||||
|
@ -204,7 +204,7 @@ private:
|
||||||
QString m_uploader;
|
QString m_uploader;
|
||||||
QString m_collectionName;
|
QString m_collectionName;
|
||||||
int m_views;
|
int m_views;
|
||||||
ChronoUtilities::TimeSpan m_duration;
|
CppUtilities::TimeSpan m_duration;
|
||||||
QString m_rating;
|
QString m_rating;
|
||||||
int m_positionInCollection;
|
int m_positionInCollection;
|
||||||
AuthenticationCredentials m_initAuthData;
|
AuthenticationCredentials m_initAuthData;
|
||||||
|
@ -224,7 +224,7 @@ private:
|
||||||
qint64 m_newBytesToReceive;
|
qint64 m_newBytesToReceive;
|
||||||
double m_speed;
|
double m_speed;
|
||||||
double m_shiftSpeed;
|
double m_shiftSpeed;
|
||||||
ChronoUtilities::TimeSpan m_shiftRemainingTime;
|
CppUtilities::TimeSpan m_shiftRemainingTime;
|
||||||
QString m_statusInfo;
|
QString m_statusInfo;
|
||||||
QTime m_time;
|
QTime m_time;
|
||||||
QNetworkReply::NetworkError m_networkError;
|
QNetworkReply::NetworkError m_networkError;
|
||||||
|
@ -511,7 +511,7 @@ inline int Download::views() const
|
||||||
* \brief Returns the duration if available.
|
* \brief Returns the duration if available.
|
||||||
* \remarks This information is possibly not available before the download is initiated.
|
* \remarks This information is possibly not available before the download is initiated.
|
||||||
*/
|
*/
|
||||||
inline ChronoUtilities::TimeSpan Download::duration() const
|
inline CppUtilities::TimeSpan Download::duration() const
|
||||||
{
|
{
|
||||||
return m_duration;
|
return m_duration;
|
||||||
}
|
}
|
||||||
|
@ -718,7 +718,7 @@ inline void Download::setViews(int value)
|
||||||
*
|
*
|
||||||
* \sa duration().
|
* \sa duration().
|
||||||
*/
|
*/
|
||||||
inline void Download::setDuration(ChronoUtilities::TimeSpan value)
|
inline void Download::setDuration(CppUtilities::TimeSpan value)
|
||||||
{
|
{
|
||||||
m_duration = value;
|
m_duration = value;
|
||||||
}
|
}
|
||||||
|
@ -858,21 +858,21 @@ inline double Download::shiftSpeed()
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns the estimated remaining time.
|
* \brief Returns the estimated remaining time.
|
||||||
*/
|
*/
|
||||||
inline ChronoUtilities::TimeSpan Download::remainingTime() const
|
inline CppUtilities::TimeSpan Download::remainingTime() const
|
||||||
{
|
{
|
||||||
return (m_status == DownloadStatus::Downloading && m_bytesToReceive != -1)
|
return (m_status == DownloadStatus::Downloading && m_bytesToReceive != -1)
|
||||||
? ChronoUtilities::TimeSpan::fromSeconds(static_cast<double>(m_bytesToReceive) / (m_speed * 125.0))
|
? CppUtilities::TimeSpan::fromSeconds(static_cast<double>(m_bytesToReceive) / (m_speed * 125.0))
|
||||||
: ChronoUtilities::TimeSpan();
|
: CppUtilities::TimeSpan();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns the alteration of the estimated remaining time since the last call of this method.
|
* \brief Returns the alteration of the estimated remaining time since the last call of this method.
|
||||||
* \sa remainingTime()
|
* \sa remainingTime()
|
||||||
*/
|
*/
|
||||||
inline ChronoUtilities::TimeSpan Download::shiftRemainingTime()
|
inline CppUtilities::TimeSpan Download::shiftRemainingTime()
|
||||||
{
|
{
|
||||||
ChronoUtilities::TimeSpan absolute = remainingTime();
|
CppUtilities::TimeSpan absolute = remainingTime();
|
||||||
ChronoUtilities::TimeSpan shift = absolute - m_shiftRemainingTime;
|
CppUtilities::TimeSpan shift = absolute - m_shiftRemainingTime;
|
||||||
m_shiftRemainingTime = absolute;
|
m_shiftRemainingTime = absolute;
|
||||||
return shift;
|
return shift;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonValue>
|
#include <QJsonValue>
|
||||||
|
|
||||||
using namespace ConversionUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace ChronoUtilities;
|
|
||||||
|
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
|
|
||||||
using namespace ChronoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace Application;
|
using namespace Application;
|
||||||
|
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
|
|
||||||
using namespace ChronoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace Application;
|
using namespace Application;
|
||||||
|
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
using namespace ChronoUtilities;
|
using namespace CppUtilities;
|
||||||
using namespace Application;
|
using namespace Application;
|
||||||
|
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
@ -417,6 +417,7 @@ void GroovesharkDownload::setupFinalRequest()
|
||||||
case GroovesharkRequestType::ArtistGetSongs:
|
case GroovesharkRequestType::ArtistGetSongs:
|
||||||
method = QStringLiteral("artistGetArtistSongs");
|
method = QStringLiteral("artistGetArtistSongs");
|
||||||
params.insert(QStringLiteral("artistID"), QJsonValue(id()));
|
params.insert(QStringLiteral("artistID"), QJsonValue(id()));
|
||||||
|
break;
|
||||||
case GroovesharkRequestType::SearchForAlbum:
|
case GroovesharkRequestType::SearchForAlbum:
|
||||||
case GroovesharkRequestType::SearchForPlaylist:
|
case GroovesharkRequestType::SearchForPlaylist:
|
||||||
method = QStringLiteral("getResultsFromSearch");
|
method = QStringLiteral("getResultsFromSearch");
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
|
|
||||||
using namespace Application;
|
using namespace Application;
|
||||||
using namespace ChronoUtilities;
|
using namespace CppUtilities;
|
||||||
|
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonValue>
|
#include <QJsonValue>
|
||||||
|
|
||||||
using namespace ChronoUtilities;
|
using namespace CppUtilities;
|
||||||
|
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
|
|
||||||
using namespace ChronoUtilities;
|
using namespace CppUtilities;
|
||||||
|
using namespace QtUtilities;
|
||||||
using namespace Application;
|
using namespace Application;
|
||||||
|
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
|
Loading…
Reference in New Issue