2015-04-22 19:32:04 +02:00
|
|
|
#ifndef SETTINGSDIALOG_H
|
|
|
|
#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
|
2015-12-05 22:56:32 +01:00
|
|
|
#include "ui_targetpage.h"
|
|
|
|
#include "ui_proxypage.h"
|
|
|
|
#include "ui_useragentpage.h"
|
2015-04-22 19:32:04 +02:00
|
|
|
|
|
|
|
#include <qtutilities/settingsdialog/settingsdialog.h>
|
|
|
|
#include <qtutilities/settingsdialog/optionpage.h>
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QByteArray;
|
|
|
|
class QLabel;
|
|
|
|
class QLineEdit;
|
|
|
|
class QCheckBox;
|
|
|
|
class QNetworkProxy;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
namespace Network {
|
|
|
|
class Download;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace QtGui {
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class TargetPage;
|
|
|
|
class ProxyPage;
|
|
|
|
class UserAgentPage;
|
|
|
|
}
|
|
|
|
|
|
|
|
class GeneralTargetOptionPage : public Dialogs::UiFileBasedOptionPage<Ui::TargetPage>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit GeneralTargetOptionPage(QWidget *parentWindow);
|
|
|
|
~GeneralTargetOptionPage();
|
|
|
|
|
|
|
|
QString displayName() const;
|
|
|
|
bool apply();
|
|
|
|
void reset();
|
|
|
|
static QString &targetDirectory();
|
|
|
|
static bool &overwriteWithoutAsking();
|
|
|
|
static bool &determineTargetFileWithoutAsking();
|
2015-09-16 17:32:33 +02:00
|
|
|
|
2015-04-22 19:32:04 +02:00
|
|
|
protected:
|
|
|
|
QWidget *setupWidget();
|
2015-09-16 17:32:33 +02:00
|
|
|
|
2015-04-22 19:32:04 +02:00
|
|
|
private:
|
|
|
|
void selectTargetDirectory();
|
|
|
|
};
|
|
|
|
|
|
|
|
class GeneralUiOptionPage : public Dialogs::OptionPage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit GeneralUiOptionPage();
|
|
|
|
~GeneralUiOptionPage();
|
|
|
|
|
|
|
|
QString displayName() const;
|
|
|
|
bool apply();
|
|
|
|
void reset();
|
|
|
|
static QByteArray &mainWindowGeometry();
|
|
|
|
static QByteArray &mainWindowState();
|
|
|
|
static bool &multiSelection();
|
2015-09-16 17:32:33 +02:00
|
|
|
|
2015-04-22 19:32:04 +02:00
|
|
|
protected:
|
|
|
|
QWidget *setupWidget();
|
2015-09-16 17:32:33 +02:00
|
|
|
|
2015-04-22 19:32:04 +02:00
|
|
|
private:
|
|
|
|
QCheckBox *m_multiSelectionCheckBox;
|
|
|
|
};
|
|
|
|
|
|
|
|
class NetworkProxyOptionPage : public Dialogs::UiFileBasedOptionPage<Ui::ProxyPage>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit NetworkProxyOptionPage();
|
|
|
|
~NetworkProxyOptionPage();
|
|
|
|
|
|
|
|
QString displayName() const;
|
|
|
|
bool apply();
|
|
|
|
void reset();
|
|
|
|
static QNetworkProxy &proxy();
|
2015-09-16 17:32:33 +02:00
|
|
|
|
2015-04-22 19:32:04 +02:00
|
|
|
protected:
|
|
|
|
QWidget *setupWidget();
|
2015-09-16 17:32:33 +02:00
|
|
|
|
2015-04-22 19:32:04 +02:00
|
|
|
private:
|
|
|
|
void updateProxy();
|
|
|
|
};
|
|
|
|
|
|
|
|
class NetworkUserAgentOptionPage : public Dialogs::UiFileBasedOptionPage<Ui::UserAgentPage>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit NetworkUserAgentOptionPage();
|
|
|
|
~NetworkUserAgentOptionPage();
|
|
|
|
|
|
|
|
QString displayName() const;
|
|
|
|
bool apply();
|
|
|
|
void reset();
|
|
|
|
static bool &useCustomUserAgent();
|
|
|
|
static QString &customUserAgent();
|
|
|
|
};
|
|
|
|
|
|
|
|
class NetworkMiscOptionPage : public Dialogs::OptionPage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit NetworkMiscOptionPage();
|
|
|
|
~NetworkMiscOptionPage();
|
|
|
|
|
|
|
|
QString displayName() const;
|
|
|
|
bool apply();
|
|
|
|
void reset();
|
|
|
|
static bool &redirectWithoutAsking();
|
2015-09-16 17:32:33 +02:00
|
|
|
|
2015-04-22 19:32:04 +02:00
|
|
|
protected:
|
|
|
|
QWidget *setupWidget();
|
2015-09-16 17:32:33 +02:00
|
|
|
|
2015-04-22 19:32:04 +02:00
|
|
|
private:
|
|
|
|
QCheckBox *m_redirectCheckBox;
|
|
|
|
};
|
|
|
|
|
|
|
|
class NetworkStatsOptionPage : public Dialogs::OptionPage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit NetworkStatsOptionPage();
|
|
|
|
~NetworkStatsOptionPage();
|
|
|
|
|
|
|
|
QString displayName() const;
|
|
|
|
bool apply();
|
|
|
|
void reset();
|
|
|
|
static quint64 &bytesReceived();
|
2015-09-16 17:32:33 +02:00
|
|
|
|
2015-04-22 19:32:04 +02:00
|
|
|
protected:
|
|
|
|
QWidget *setupWidget();
|
2015-09-16 17:32:33 +02:00
|
|
|
|
2015-04-22 19:32:04 +02:00
|
|
|
private:
|
|
|
|
QLabel *m_receivedLabel;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SettingsDialog : public Dialogs::SettingsDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit SettingsDialog(QWidget *parent = nullptr);
|
|
|
|
~SettingsDialog();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
extern void restoreSettings();
|
|
|
|
extern void saveSettings();
|
|
|
|
extern void applySettingsToDownload(Network::Download *download);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SETTINGSDIALOG_H
|