|
|
|
@ -12,24 +12,51 @@
@@ -12,24 +12,51 @@
|
|
|
|
|
|
|
|
|
|
#include "core/preferences.h" |
|
|
|
|
|
|
|
|
|
enum AdvSettingsCols {PROPERTY, VALUE}; |
|
|
|
|
enum AdvSettingsRows {DISK_CACHE, DISK_CACHE_TTL, OS_CACHE, SAVE_RESUME_DATA_INTERVAL, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, NETWORK_LISTEN_IPV6, NETWORK_ADDRESS, PROGRAM_NOTIFICATIONS, TRACKER_STATUS, TRACKER_PORT, |
|
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
|
|
|
|
enum AdvSettingsCols |
|
|
|
|
{ |
|
|
|
|
PROPERTY, |
|
|
|
|
VALUE |
|
|
|
|
}; |
|
|
|
|
enum AdvSettingsRows |
|
|
|
|
{ |
|
|
|
|
DISK_CACHE, |
|
|
|
|
DISK_CACHE_TTL, |
|
|
|
|
OS_CACHE, |
|
|
|
|
SAVE_RESUME_DATA_INTERVAL, |
|
|
|
|
OUTGOING_PORT_MIN, |
|
|
|
|
OUTGOING_PORT_MAX, |
|
|
|
|
RECHECK_COMPLETED, |
|
|
|
|
LIST_REFRESH, |
|
|
|
|
RESOLVE_COUNTRIES, |
|
|
|
|
RESOLVE_HOSTS, |
|
|
|
|
MAX_HALF_OPEN, |
|
|
|
|
SUPER_SEEDING, |
|
|
|
|
NETWORK_IFACE, |
|
|
|
|
NETWORK_LISTEN_IPV6, |
|
|
|
|
NETWORK_ADDRESS, |
|
|
|
|
PROGRAM_NOTIFICATIONS, |
|
|
|
|
TRACKER_STATUS, |
|
|
|
|
TRACKER_PORT, |
|
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
|
|
|
|
UPDATE_CHECK, |
|
|
|
|
#endif |
|
|
|
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) |
|
|
|
|
#endif |
|
|
|
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) |
|
|
|
|
USE_ICON_THEME, |
|
|
|
|
#endif |
|
|
|
|
CONFIRM_DELETE_TORRENT, CONFIRM_RECHECK_TORRENT, TRACKER_EXCHANGE, |
|
|
|
|
#endif |
|
|
|
|
CONFIRM_DELETE_TORRENT, |
|
|
|
|
CONFIRM_RECHECK_TORRENT, |
|
|
|
|
TRACKER_EXCHANGE, |
|
|
|
|
ANNOUNCE_ALL_TRACKERS, |
|
|
|
|
ROW_COUNT}; |
|
|
|
|
ROW_COUNT |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
class AdvancedSettings: public QTableWidget { |
|
|
|
|
class AdvancedSettings: public QTableWidget |
|
|
|
|
{ |
|
|
|
|
Q_OBJECT |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
QSpinBox spin_cache, spin_save_resume_data_interval, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port; |
|
|
|
|
QCheckBox cb_os_cache, cb_ignore_limits_lan, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts, |
|
|
|
|
QCheckBox cb_os_cache, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts, |
|
|
|
|
cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion, |
|
|
|
|
cb_confirm_torrent_recheck, cb_enable_tracker_ext, cb_listen_ipv6; |
|
|
|
|
QComboBox combo_iface; |
|
|
|
@ -44,7 +71,8 @@ private:
@@ -44,7 +71,8 @@ private:
|
|
|
|
|
QLineEdit txt_network_address; |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) { |
|
|
|
|
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) |
|
|
|
|
{ |
|
|
|
|
// Set visual appearance
|
|
|
|
|
setEditTriggers(QAbstractItemView::NoEditTriggers); |
|
|
|
|
setAlternatingRowColors(true); |
|
|
|
@ -62,11 +90,11 @@ public:
@@ -62,11 +90,11 @@ public:
|
|
|
|
|
loadAdvancedSettings(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
~AdvancedSettings() { |
|
|
|
|
} |
|
|
|
|
~AdvancedSettings() {} |
|
|
|
|
|
|
|
|
|
public slots: |
|
|
|
|
void saveAdvancedSettings() { |
|
|
|
|
void saveAdvancedSettings() |
|
|
|
|
{ |
|
|
|
|
Preferences* const pref = Preferences::instance(); |
|
|
|
|
// Disk write cache
|
|
|
|
|
pref->setDiskCacheSize(spin_cache.value()); |
|
|
|
@ -78,8 +106,6 @@ public slots:
@@ -78,8 +106,6 @@ public slots:
|
|
|
|
|
// Outgoing ports
|
|
|
|
|
pref->setOutgoingPortsMin(outgoing_ports_min.value()); |
|
|
|
|
pref->setOutgoingPortsMax(outgoing_ports_max.value()); |
|
|
|
|
// Ignore limits on LAN
|
|
|
|
|
pref->ignoreLimitsOnLAN(cb_ignore_limits_lan.isChecked()); |
|
|
|
|
// Recheck torrents on completion
|
|
|
|
|
pref->recheckTorrentsOnCompletion(cb_recheck_completed.isChecked()); |
|
|
|
|
// Transfer list refresh interval
|
|
|
|
@ -96,7 +122,8 @@ public slots:
@@ -96,7 +122,8 @@ public slots:
|
|
|
|
|
// All interfaces (default)
|
|
|
|
|
pref->setNetworkInterface(QString::null); |
|
|
|
|
pref->setNetworkInterfaceName(QString::null); |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
pref->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString()); |
|
|
|
|
pref->setNetworkInterfaceName(combo_iface.currentText()); |
|
|
|
|
} |
|
|
|
@ -131,7 +158,8 @@ signals:
@@ -131,7 +158,8 @@ signals:
|
|
|
|
|
void settingsChanged(); |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
void setRow(int row, const QString &property, QSpinBox* editor) { |
|
|
|
|
void setRow(int row, const QString &property, QSpinBox* editor) |
|
|
|
|
{ |
|
|
|
|
setItem(row, PROPERTY, new QTableWidgetItem(property)); |
|
|
|
|
bool ok; Q_UNUSED(ok); |
|
|
|
|
ok = connect(editor, SIGNAL(valueChanged(int)), SIGNAL(settingsChanged())); |
|
|
|
@ -139,7 +167,8 @@ private:
@@ -139,7 +167,8 @@ private:
|
|
|
|
|
setCellWidget(row, VALUE, editor); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void setRow(int row, const QString &property, QComboBox* editor) { |
|
|
|
|
void setRow(int row, const QString &property, QComboBox* editor) |
|
|
|
|
{ |
|
|
|
|
setItem(row, PROPERTY, new QTableWidgetItem(property)); |
|
|
|
|
bool ok; Q_UNUSED(ok); |
|
|
|
|
ok = connect(editor, SIGNAL(currentIndexChanged(int)), SIGNAL(settingsChanged())); |
|
|
|
@ -147,7 +176,8 @@ private:
@@ -147,7 +176,8 @@ private:
|
|
|
|
|
setCellWidget(row, VALUE, editor); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void setRow(int row, const QString &property, QCheckBox* editor) { |
|
|
|
|
void setRow(int row, const QString &property, QCheckBox* editor) |
|
|
|
|
{ |
|
|
|
|
setItem(row, PROPERTY, new QTableWidgetItem(property)); |
|
|
|
|
bool ok; Q_UNUSED(ok); |
|
|
|
|
ok = connect(editor, SIGNAL(stateChanged(int)), SIGNAL(settingsChanged())); |
|
|
|
@ -155,7 +185,8 @@ private:
@@ -155,7 +185,8 @@ private:
|
|
|
|
|
setCellWidget(row, VALUE, editor); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void setRow(int row, const QString &property, QLineEdit* editor) { |
|
|
|
|
void setRow(int row, const QString &property, QLineEdit* editor) |
|
|
|
|
{ |
|
|
|
|
setItem(row, PROPERTY, new QTableWidgetItem(property)); |
|
|
|
|
bool ok; Q_UNUSED(ok); |
|
|
|
|
ok = connect(editor, SIGNAL(textChanged(QString)), SIGNAL(settingsChanged())); |
|
|
|
@ -214,9 +245,6 @@ private slots:
@@ -214,9 +245,6 @@ private slots:
|
|
|
|
|
outgoing_ports_max.setMaximum(65535); |
|
|
|
|
outgoing_ports_max.setValue(pref->outgoingPortsMax()); |
|
|
|
|
setRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &outgoing_ports_max); |
|
|
|
|
// Ignore transfer limits on local network
|
|
|
|
|
cb_ignore_limits_lan.setChecked(pref->ignoreLimitsOnLAN()); |
|
|
|
|
setRow(IGNORE_LIMIT_LAN, tr("Ignore transfer limits on local network"), &cb_ignore_limits_lan); |
|
|
|
|
// Recheck completed torrents
|
|
|
|
|
cb_recheck_completed.setChecked(pref->recheckTorrentsOnCompletion()); |
|
|
|
|
setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed); |
|
|
|
@ -298,7 +326,6 @@ private slots:
@@ -298,7 +326,6 @@ private slots:
|
|
|
|
|
cb_announce_all_trackers.setChecked(pref->announceToAllTrackers()); |
|
|
|
|
setRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers"), &cb_announce_all_trackers); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#endif // ADVANCEDSETTINGS_H
|
|
|
|
|