mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Fix compilation warnings in smtp.h (cgreco)
This commit is contained in:
@@ -20,7 +20,7 @@ enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_L
|
||||
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
||||
USE_ICON_THEME,
|
||||
#endif
|
||||
CONFIRM_DELETE_TORRENT,
|
||||
CONFIRM_DELETE_TORRENT, TRACKER_EXCHANGE,
|
||||
ROW_COUNT};
|
||||
|
||||
class AdvancedSettings: public QTableWidget {
|
||||
@@ -29,7 +29,8 @@ class AdvancedSettings: public QTableWidget {
|
||||
private:
|
||||
QSpinBox spin_cache, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port;
|
||||
QCheckBox cb_ignore_limits_lan, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts,
|
||||
cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion;
|
||||
cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion,
|
||||
cb_enable_tracker_ext;
|
||||
QComboBox combo_iface;
|
||||
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
|
||||
QCheckBox cb_update_check;
|
||||
@@ -108,6 +109,8 @@ public slots:
|
||||
pref.useSystemIconTheme(cb_use_icon_theme.isChecked());
|
||||
#endif
|
||||
pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked());
|
||||
// Tracker exchange
|
||||
pref.setTrackerEnabled(cb_enable_tracker_ext.isChecked());
|
||||
}
|
||||
|
||||
signals:
|
||||
@@ -232,6 +235,9 @@ private slots:
|
||||
// Torrent deletion confirmation
|
||||
cb_confirm_torrent_deletion.setChecked(pref.confirmTorrentDeletion());
|
||||
setRow(CONFIRM_DELETE_TORRENT, tr("Confirm torrent deletion"), &cb_confirm_torrent_deletion);
|
||||
// Tracker exchange
|
||||
cb_enable_tracker_ext.setChecked(pref.trackerExchangeEnabled());
|
||||
setRow(TRACKER_EXCHANGE, tr("Exchange trackers with other peers"), &cb_enable_tracker_ext);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>496</width>
|
||||
<height>557</height>
|
||||
<width>488</width>
|
||||
<height>601</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
@@ -487,8 +487,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>516</width>
|
||||
<height>930</height>
|
||||
<width>501</width>
|
||||
<height>999</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@@ -662,16 +662,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QGroupBox::title {
|
||||
font-weight: normal;
|
||||
margin-left: 0px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
QGroupBox {
|
||||
border-width: 0;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Automatically add torrents from:</string>
|
||||
</property>
|
||||
@@ -956,9 +946,9 @@ QGroupBox {
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-12</y>
|
||||
<width>496</width>
|
||||
<height>520</height>
|
||||
<y>0</y>
|
||||
<width>488</width>
|
||||
<height>560</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||
@@ -1413,8 +1403,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>496</width>
|
||||
<height>454</height>
|
||||
<width>506</width>
|
||||
<height>510</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||
@@ -1825,8 +1815,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>565</width>
|
||||
<height>458</height>
|
||||
<width>545</width>
|
||||
<height>492</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
@@ -2201,8 +2191,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>496</width>
|
||||
<height>419</height>
|
||||
<width>488</width>
|
||||
<height>594</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
@@ -2265,6 +2255,137 @@ QGroupBox {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="checkWebUiHttps">
|
||||
<property name="title">
|
||||
<string>Use HTTPS instead of HTTP</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_11">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblSslCertStatus">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblWebUiCrt">
|
||||
<property name="text">
|
||||
<string>Certificate:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnWebUiCrt">
|
||||
<property name="text">
|
||||
<string>Import SSL Certificate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>138</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblSslKeyStatus">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lblWebUiKey">
|
||||
<property name="text">
|
||||
<string>Key:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnWebUiKey">
|
||||
<property name="text">
|
||||
<string>Import SSL Key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="lblWebUIInfo">
|
||||
<property name="text">
|
||||
<string><a href=http://httpd.apache.org/docs/2.1/ssl/ssl_faq.html#aboutcerts>Information about certificates</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupWebUiAuth">
|
||||
<property name="title">
|
||||
@@ -2447,8 +2568,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>512</width>
|
||||
<height>414</height>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_36"/>
|
||||
|
||||
@@ -53,6 +53,11 @@
|
||||
#include "iconprovider.h"
|
||||
#include "dnsupdater.h"
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
#include <QSslKey>
|
||||
#include <QSslCertificate>
|
||||
#endif
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
// Constructor
|
||||
@@ -111,6 +116,9 @@ options_imp::options_imp(QWidget *parent):
|
||||
#if !defined(Q_WS_X11)
|
||||
label_trayIconStyle->setVisible(false);
|
||||
comboTrayIcon->setVisible(false);
|
||||
#endif
|
||||
#if defined(QT_NO_OPENSSL)
|
||||
checkWebUiHttps->setVisible(false);
|
||||
#endif
|
||||
// Connect signals / slots
|
||||
// Proxy tab
|
||||
@@ -206,6 +214,9 @@ options_imp::options_imp(QWidget *parent):
|
||||
connect(checkWebUi, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(spinWebUiPort, SIGNAL(valueChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(checkWebUIUPnP, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
||||
connect(checkWebUiHttps, SIGNAL(toggled(bool)), SLOT(enableApplyButton()));
|
||||
connect(btnWebUiKey, SIGNAL(clicked()), SLOT(enableApplyButton()));
|
||||
connect(btnWebUiCrt, SIGNAL(clicked()), SLOT(enableApplyButton()));
|
||||
connect(textWebUiUsername, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(textWebUiPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
|
||||
connect(checkBypassLocalAuth, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
@@ -443,6 +454,12 @@ void options_imp::saveOptions(){
|
||||
{
|
||||
pref.setWebUiPort(webUiPort());
|
||||
pref.setUPnPForWebUIPort(checkWebUIUPnP->isChecked());
|
||||
pref.setWebUiHttpsEnabled(checkWebUiHttps->isChecked());
|
||||
if(checkWebUiHttps->isChecked())
|
||||
{
|
||||
pref.setWebUiHttpsCertificate(m_sslCert);
|
||||
pref.setWebUiHttpsKey(m_sslKey);
|
||||
}
|
||||
pref.setWebUiUsername(webUiUsername());
|
||||
// FIXME: Check that the password is valid (not empty at least)
|
||||
pref.setWebUiPassword(webUiPassword());
|
||||
@@ -693,6 +710,9 @@ void options_imp::loadOptions(){
|
||||
checkWebUi->setChecked(pref.isWebUiEnabled());
|
||||
spinWebUiPort->setValue(pref.getWebUiPort());
|
||||
checkWebUIUPnP->setChecked(pref.useUPnPForWebUIPort());
|
||||
checkWebUiHttps->setChecked(pref.isWebUiHttpsEnabled());
|
||||
setSslCertificate(pref.getWebUiHttpsCertificate(), false);
|
||||
setSslKey(pref.getWebUiHttpsKey(), false);
|
||||
textWebUiUsername->setText(pref.getWebUiUsername());
|
||||
textWebUiPassword->setText(pref.getWebUiPassword());
|
||||
checkBypassLocalAuth->setChecked(!pref.isWebUiLocalAuthEnabled());
|
||||
@@ -1128,6 +1148,28 @@ void options_imp::showConnectionTab()
|
||||
tabSelection->setCurrentRow(2);
|
||||
}
|
||||
|
||||
void options_imp::on_btnWebUiCrt_clicked() {
|
||||
QString filename = QFileDialog::getOpenFileName(this, QString(), QString(), tr("SSL Certificate (*.crt *.pem)"));
|
||||
if(filename.isNull())
|
||||
return;
|
||||
QFile file(filename);
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
setSslCertificate(file.readAll());
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::on_btnWebUiKey_clicked() {
|
||||
QString filename = QFileDialog::getOpenFileName(this, QString(), QString(), tr("SSL Key (*.key *.pem)"));
|
||||
if(filename.isNull())
|
||||
return;
|
||||
QFile file(filename);
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
setSslKey(file.readAll());
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::on_registerDNSBtn_clicked() {
|
||||
QDesktopServices::openUrl(DNSUpdater::getRegistrationUrl(comboDNSService->currentIndex()));
|
||||
}
|
||||
@@ -1207,3 +1249,33 @@ QString options_imp::languageToLocalizedString(QLocale::Language language, const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::setSslKey(const QByteArray &key, bool interactive)
|
||||
{
|
||||
#ifndef QT_NO_OPENSSL
|
||||
if (!key.isEmpty() && !QSslKey(key, QSsl::Rsa).isNull()) {
|
||||
lblSslKeyStatus->setPixmap(QPixmap(":/Icons/oxygen/security-high.png").scaledToHeight(20, Qt::SmoothTransformation));
|
||||
m_sslKey = key;
|
||||
} else {
|
||||
lblSslKeyStatus->setPixmap(QPixmap(":/Icons/oxygen/security-low.png").scaledToHeight(20, Qt::SmoothTransformation));
|
||||
m_sslKey.clear();
|
||||
if (interactive)
|
||||
QMessageBox::warning(this, tr("Invalid key"), tr("This is not a valid SSL key."));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void options_imp::setSslCertificate(const QByteArray &cert, bool interactive)
|
||||
{
|
||||
#ifndef QT_NO_OPENSSL
|
||||
if (!cert.isEmpty() && !QSslCertificate(cert).isNull()) {
|
||||
lblSslCertStatus->setPixmap(QPixmap(":/Icons/oxygen/security-high.png").scaledToHeight(20, Qt::SmoothTransformation));
|
||||
m_sslCert = cert;
|
||||
} else {
|
||||
lblSslCertStatus->setPixmap(QPixmap(":/Icons/oxygen/security-low.png").scaledToHeight(20, Qt::SmoothTransformation));
|
||||
m_sslCert.clear();
|
||||
if (interactive)
|
||||
QMessageBox::warning(this, tr("Invalid certificate"), tr("This is not a valid SSL certificate."));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -80,6 +80,8 @@ private slots:
|
||||
void on_randomButton_clicked();
|
||||
void on_addScanFolderButton_clicked();
|
||||
void on_removeScanFolderButton_clicked();
|
||||
void on_btnWebUiCrt_clicked();
|
||||
void on_btnWebUiKey_clicked();
|
||||
void on_registerDNSBtn_clicked();
|
||||
void setLocale(const QString &locale);
|
||||
|
||||
@@ -144,11 +146,17 @@ private:
|
||||
QString webUiPassword() const;
|
||||
QSize sizeFittingScreen() const;
|
||||
|
||||
private:
|
||||
void setSslKey(const QByteArray &key, bool interactive = true);
|
||||
void setSslCertificate(const QByteArray &cert, bool interactive = true);
|
||||
|
||||
private:
|
||||
QButtonGroup choiceLanguage;
|
||||
QAbstractButton *applyButton;
|
||||
AdvancedSettings *advancedSettings;
|
||||
QList<QString> addedScanDirs;
|
||||
// SSL Cert / key
|
||||
QByteArray m_sslCert, m_sslKey;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
#include <QTime>
|
||||
#include <QList>
|
||||
#include <QDebug>
|
||||
#include <QSslCertificate>
|
||||
#include <QSslKey>
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
@@ -64,7 +62,7 @@ namespace TrayIcon {
|
||||
enum Style { NORMAL = 0, MONO_DARK, MONO_LIGHT };
|
||||
}
|
||||
namespace DNS {
|
||||
enum Service { DYNDNS, NOIP };
|
||||
enum Service { DYNDNS, NOIP, NONE = -1 };
|
||||
}
|
||||
|
||||
class Preferences : public QIniSettings {
|
||||
@@ -783,26 +781,20 @@ public:
|
||||
setValue("Preferences/WebUI/HTTPS/Enabled", enabled);
|
||||
}
|
||||
|
||||
QSslCertificate getWebUiHttpsCertificate() const {
|
||||
return QSslCertificate(value("Preferences/WebUI/HTTPS/Certificate").toByteArray());
|
||||
QByteArray getWebUiHttpsCertificate() const {
|
||||
return value("Preferences/WebUI/HTTPS/Certificate").toByteArray();
|
||||
}
|
||||
|
||||
void setWebUiHttpsCertificate(QString filename) {
|
||||
QFile file(filename);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
setValue("Preferences/WebUI/HTTPS/Certificate", file.readAll());
|
||||
file.close();
|
||||
void setWebUiHttpsCertificate(const QByteArray &data) {
|
||||
setValue("Preferences/WebUI/HTTPS/Certificate", data);
|
||||
}
|
||||
|
||||
QSslKey getWebUiHttpsKey() const {
|
||||
return QSslKey(value("Preferences/WebUI/HTTPS/Key").toByteArray(), QSsl::Rsa);
|
||||
QByteArray getWebUiHttpsKey() const {
|
||||
return value("Preferences/WebUI/HTTPS/Key").toByteArray();
|
||||
}
|
||||
|
||||
void setWebUiHttpsKey(QString filename) {
|
||||
QFile file(filename);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
setValue("Preferences/WebUI/HTTPS/Key", file.readAll());
|
||||
file.close();
|
||||
void setWebUiHttpsKey(const QByteArray &data) {
|
||||
setValue("Preferences/WebUI/HTTPS/Key", data);
|
||||
}
|
||||
|
||||
bool isDynDNSEnabled() const {
|
||||
@@ -946,6 +938,14 @@ public:
|
||||
setValue(QString::fromUtf8("Preferences/Advanced/IncludeOverhead"), include);
|
||||
}
|
||||
|
||||
bool trackerExchangeEnabled() const {
|
||||
return value(QString::fromUtf8("Preferences/Advanced/TrackerExchange"), true).toBool();
|
||||
}
|
||||
|
||||
void setTrackerExchangeEnabled(bool enable) {
|
||||
setValue(QString::fromUtf8("Preferences/Advanced/TrackerExchange"), enable);
|
||||
}
|
||||
|
||||
bool recheckTorrentsOnCompletion() const {
|
||||
return value(QString::fromUtf8("Preferences/Advanced/RecheckOnCompletion"), false).toBool();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user