|
|
@ -12,293 +12,320 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include "core/preferences.h" |
|
|
|
#include "core/preferences.h" |
|
|
|
|
|
|
|
|
|
|
|
enum AdvSettingsCols {PROPERTY, VALUE}; |
|
|
|
enum AdvSettingsCols |
|
|
|
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) |
|
|
|
PROPERTY, |
|
|
|
UPDATE_CHECK, |
|
|
|
VALUE |
|
|
|
#endif |
|
|
|
}; |
|
|
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) |
|
|
|
enum AdvSettingsRows |
|
|
|
USE_ICON_THEME, |
|
|
|
{ |
|
|
|
#endif |
|
|
|
DISK_CACHE, |
|
|
|
CONFIRM_DELETE_TORRENT, CONFIRM_RECHECK_TORRENT, TRACKER_EXCHANGE, |
|
|
|
DISK_CACHE_TTL, |
|
|
|
ANNOUNCE_ALL_TRACKERS, |
|
|
|
OS_CACHE, |
|
|
|
ROW_COUNT}; |
|
|
|
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)) |
|
|
|
|
|
|
|
USE_ICON_THEME, |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
CONFIRM_DELETE_TORRENT, |
|
|
|
|
|
|
|
CONFIRM_RECHECK_TORRENT, |
|
|
|
|
|
|
|
TRACKER_EXCHANGE, |
|
|
|
|
|
|
|
ANNOUNCE_ALL_TRACKERS, |
|
|
|
|
|
|
|
ROW_COUNT |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
class AdvancedSettings: public QTableWidget { |
|
|
|
class AdvancedSettings: public QTableWidget |
|
|
|
Q_OBJECT |
|
|
|
{ |
|
|
|
|
|
|
|
Q_OBJECT |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
QSpinBox spin_cache, spin_save_resume_data_interval, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port; |
|
|
|
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_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion, |
|
|
|
cb_confirm_torrent_recheck, cb_enable_tracker_ext, cb_listen_ipv6; |
|
|
|
cb_confirm_torrent_recheck, cb_enable_tracker_ext, cb_listen_ipv6; |
|
|
|
QComboBox combo_iface; |
|
|
|
QComboBox combo_iface; |
|
|
|
QSpinBox spin_cache_ttl; |
|
|
|
QSpinBox spin_cache_ttl; |
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
|
|
|
QCheckBox cb_update_check; |
|
|
|
QCheckBox cb_update_check; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) |
|
|
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) |
|
|
|
QCheckBox cb_use_icon_theme; |
|
|
|
QCheckBox cb_use_icon_theme; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
QCheckBox cb_announce_all_trackers; |
|
|
|
QCheckBox cb_announce_all_trackers; |
|
|
|
QLineEdit txt_network_address; |
|
|
|
QLineEdit txt_network_address; |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) { |
|
|
|
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) |
|
|
|
// Set visual appearance
|
|
|
|
{ |
|
|
|
setEditTriggers(QAbstractItemView::NoEditTriggers); |
|
|
|
// Set visual appearance
|
|
|
|
setAlternatingRowColors(true); |
|
|
|
setEditTriggers(QAbstractItemView::NoEditTriggers); |
|
|
|
setColumnCount(2); |
|
|
|
setAlternatingRowColors(true); |
|
|
|
QStringList header; |
|
|
|
setColumnCount(2); |
|
|
|
header << tr("Setting") << tr("Value", "Value set for this setting"); |
|
|
|
QStringList header; |
|
|
|
setHorizontalHeaderLabels(header); |
|
|
|
header << tr("Setting") << tr("Value", "Value set for this setting"); |
|
|
|
setColumnWidth(0, width()/2); |
|
|
|
setHorizontalHeaderLabels(header); |
|
|
|
horizontalHeader()->setStretchLastSection(true); |
|
|
|
setColumnWidth(0, width()/2); |
|
|
|
verticalHeader()->setVisible(false); |
|
|
|
horizontalHeader()->setStretchLastSection(true); |
|
|
|
setRowCount(ROW_COUNT); |
|
|
|
verticalHeader()->setVisible(false); |
|
|
|
// Signals
|
|
|
|
setRowCount(ROW_COUNT); |
|
|
|
connect(&spin_cache, SIGNAL(valueChanged(int)), SLOT(updateCacheSpinSuffix(int))); |
|
|
|
// Signals
|
|
|
|
// Load settings
|
|
|
|
connect(&spin_cache, SIGNAL(valueChanged(int)), SLOT(updateCacheSpinSuffix(int))); |
|
|
|
loadAdvancedSettings(); |
|
|
|
// Load settings
|
|
|
|
} |
|
|
|
loadAdvancedSettings(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
~AdvancedSettings() { |
|
|
|
~AdvancedSettings() {} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public slots: |
|
|
|
public slots: |
|
|
|
void saveAdvancedSettings() { |
|
|
|
void saveAdvancedSettings() |
|
|
|
Preferences* const pref = Preferences::instance(); |
|
|
|
{ |
|
|
|
// Disk write cache
|
|
|
|
Preferences* const pref = Preferences::instance(); |
|
|
|
pref->setDiskCacheSize(spin_cache.value()); |
|
|
|
// Disk write cache
|
|
|
|
pref->setDiskCacheTTL(spin_cache_ttl.value()); |
|
|
|
pref->setDiskCacheSize(spin_cache.value()); |
|
|
|
// Enable OS cache
|
|
|
|
pref->setDiskCacheTTL(spin_cache_ttl.value()); |
|
|
|
pref->setOsCache(cb_os_cache.isChecked()); |
|
|
|
// Enable OS cache
|
|
|
|
// Save resume data interval
|
|
|
|
pref->setOsCache(cb_os_cache.isChecked()); |
|
|
|
pref->setSaveResumeDataInterval(spin_save_resume_data_interval.value()); |
|
|
|
// Save resume data interval
|
|
|
|
// Outgoing ports
|
|
|
|
pref->setSaveResumeDataInterval(spin_save_resume_data_interval.value()); |
|
|
|
pref->setOutgoingPortsMin(outgoing_ports_min.value()); |
|
|
|
// Outgoing ports
|
|
|
|
pref->setOutgoingPortsMax(outgoing_ports_max.value()); |
|
|
|
pref->setOutgoingPortsMin(outgoing_ports_min.value()); |
|
|
|
// Ignore limits on LAN
|
|
|
|
pref->setOutgoingPortsMax(outgoing_ports_max.value()); |
|
|
|
pref->ignoreLimitsOnLAN(cb_ignore_limits_lan.isChecked()); |
|
|
|
// Recheck torrents on completion
|
|
|
|
// Recheck torrents on completion
|
|
|
|
pref->recheckTorrentsOnCompletion(cb_recheck_completed.isChecked()); |
|
|
|
pref->recheckTorrentsOnCompletion(cb_recheck_completed.isChecked()); |
|
|
|
// Transfer list refresh interval
|
|
|
|
// Transfer list refresh interval
|
|
|
|
pref->setRefreshInterval(spin_list_refresh.value()); |
|
|
|
pref->setRefreshInterval(spin_list_refresh.value()); |
|
|
|
// Peer resolution
|
|
|
|
// Peer resolution
|
|
|
|
pref->resolvePeerCountries(cb_resolve_countries.isChecked()); |
|
|
|
pref->resolvePeerCountries(cb_resolve_countries.isChecked()); |
|
|
|
pref->resolvePeerHostNames(cb_resolve_hosts.isChecked()); |
|
|
|
pref->resolvePeerHostNames(cb_resolve_hosts.isChecked()); |
|
|
|
// Max Half-Open connections
|
|
|
|
// Max Half-Open connections
|
|
|
|
pref->setMaxHalfOpenConnections(spin_maxhalfopen.value()); |
|
|
|
pref->setMaxHalfOpenConnections(spin_maxhalfopen.value()); |
|
|
|
// Super seeding
|
|
|
|
// Super seeding
|
|
|
|
pref->enableSuperSeeding(cb_super_seeding.isChecked()); |
|
|
|
pref->enableSuperSeeding(cb_super_seeding.isChecked()); |
|
|
|
// Network interface
|
|
|
|
// Network interface
|
|
|
|
if (combo_iface.currentIndex() == 0) { |
|
|
|
if (combo_iface.currentIndex() == 0) { |
|
|
|
// All interfaces (default)
|
|
|
|
// All interfaces (default)
|
|
|
|
pref->setNetworkInterface(QString::null); |
|
|
|
pref->setNetworkInterface(QString::null); |
|
|
|
pref->setNetworkInterfaceName(QString::null); |
|
|
|
pref->setNetworkInterfaceName(QString::null); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
pref->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString()); |
|
|
|
pref->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString()); |
|
|
|
pref->setNetworkInterfaceName(combo_iface.currentText()); |
|
|
|
pref->setNetworkInterfaceName(combo_iface.currentText()); |
|
|
|
} |
|
|
|
} |
|
|
|
// Listen on IPv6 address
|
|
|
|
// Listen on IPv6 address
|
|
|
|
pref->setListenIPv6(cb_listen_ipv6.isChecked()); |
|
|
|
pref->setListenIPv6(cb_listen_ipv6.isChecked()); |
|
|
|
// Network address
|
|
|
|
// Network address
|
|
|
|
QHostAddress addr(txt_network_address.text().trimmed()); |
|
|
|
QHostAddress addr(txt_network_address.text().trimmed()); |
|
|
|
if (addr.isNull()) |
|
|
|
if (addr.isNull()) |
|
|
|
pref->setNetworkAddress(""); |
|
|
|
pref->setNetworkAddress(""); |
|
|
|
else |
|
|
|
else |
|
|
|
pref->setNetworkAddress(addr.toString()); |
|
|
|
pref->setNetworkAddress(addr.toString()); |
|
|
|
// Program notification
|
|
|
|
// Program notification
|
|
|
|
pref->useProgramNotification(cb_program_notifications.isChecked()); |
|
|
|
pref->useProgramNotification(cb_program_notifications.isChecked()); |
|
|
|
// Tracker
|
|
|
|
// Tracker
|
|
|
|
pref->setTrackerEnabled(cb_tracker_status.isChecked()); |
|
|
|
pref->setTrackerEnabled(cb_tracker_status.isChecked()); |
|
|
|
pref->setTrackerPort(spin_tracker_port.value()); |
|
|
|
pref->setTrackerPort(spin_tracker_port.value()); |
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
|
|
|
pref->setUpdateCheckEnabled(cb_update_check.isChecked()); |
|
|
|
pref->setUpdateCheckEnabled(cb_update_check.isChecked()); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
// Icon theme
|
|
|
|
// Icon theme
|
|
|
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) |
|
|
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) |
|
|
|
pref->useSystemIconTheme(cb_use_icon_theme.isChecked()); |
|
|
|
pref->useSystemIconTheme(cb_use_icon_theme.isChecked()); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
pref->setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked()); |
|
|
|
pref->setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked()); |
|
|
|
pref->setConfirmTorrentRecheck(cb_confirm_torrent_recheck.isChecked()); |
|
|
|
pref->setConfirmTorrentRecheck(cb_confirm_torrent_recheck.isChecked()); |
|
|
|
// Tracker exchange
|
|
|
|
// Tracker exchange
|
|
|
|
pref->setTrackerExchangeEnabled(cb_enable_tracker_ext.isChecked()); |
|
|
|
pref->setTrackerExchangeEnabled(cb_enable_tracker_ext.isChecked()); |
|
|
|
pref->setAnnounceToAllTrackers(cb_announce_all_trackers.isChecked()); |
|
|
|
pref->setAnnounceToAllTrackers(cb_announce_all_trackers.isChecked()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
signals: |
|
|
|
signals: |
|
|
|
void settingsChanged(); |
|
|
|
void settingsChanged(); |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
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); |
|
|
|
setItem(row, PROPERTY, new QTableWidgetItem(property)); |
|
|
|
ok = connect(editor, SIGNAL(valueChanged(int)), SIGNAL(settingsChanged())); |
|
|
|
bool ok; Q_UNUSED(ok); |
|
|
|
Q_ASSERT(ok); |
|
|
|
ok = connect(editor, SIGNAL(valueChanged(int)), SIGNAL(settingsChanged())); |
|
|
|
setCellWidget(row, VALUE, editor); |
|
|
|
Q_ASSERT(ok); |
|
|
|
} |
|
|
|
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); |
|
|
|
setItem(row, PROPERTY, new QTableWidgetItem(property)); |
|
|
|
ok = connect(editor, SIGNAL(currentIndexChanged(int)), SIGNAL(settingsChanged())); |
|
|
|
bool ok; Q_UNUSED(ok); |
|
|
|
Q_ASSERT(ok); |
|
|
|
ok = connect(editor, SIGNAL(currentIndexChanged(int)), SIGNAL(settingsChanged())); |
|
|
|
setCellWidget(row, VALUE, editor); |
|
|
|
Q_ASSERT(ok); |
|
|
|
} |
|
|
|
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); |
|
|
|
setItem(row, PROPERTY, new QTableWidgetItem(property)); |
|
|
|
ok = connect(editor, SIGNAL(stateChanged(int)), SIGNAL(settingsChanged())); |
|
|
|
bool ok; Q_UNUSED(ok); |
|
|
|
Q_ASSERT(ok); |
|
|
|
ok = connect(editor, SIGNAL(stateChanged(int)), SIGNAL(settingsChanged())); |
|
|
|
setCellWidget(row, VALUE, editor); |
|
|
|
Q_ASSERT(ok); |
|
|
|
} |
|
|
|
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); |
|
|
|
setItem(row, PROPERTY, new QTableWidgetItem(property)); |
|
|
|
ok = connect(editor, SIGNAL(textChanged(QString)), SIGNAL(settingsChanged())); |
|
|
|
bool ok; Q_UNUSED(ok); |
|
|
|
Q_ASSERT(ok); |
|
|
|
ok = connect(editor, SIGNAL(textChanged(QString)), SIGNAL(settingsChanged())); |
|
|
|
setCellWidget(row, VALUE, editor); |
|
|
|
Q_ASSERT(ok); |
|
|
|
} |
|
|
|
setCellWidget(row, VALUE, editor); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private slots: |
|
|
|
private slots: |
|
|
|
void updateCacheSpinSuffix(int value) |
|
|
|
void updateCacheSpinSuffix(int value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (value <= 0) |
|
|
|
if (value <= 0) |
|
|
|
spin_cache.setSuffix(tr(" (auto)")); |
|
|
|
spin_cache.setSuffix(tr(" (auto)")); |
|
|
|
else |
|
|
|
else |
|
|
|
spin_cache.setSuffix(tr(" MiB")); |
|
|
|
spin_cache.setSuffix(tr(" MiB")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void loadAdvancedSettings() |
|
|
|
void loadAdvancedSettings() |
|
|
|
{ |
|
|
|
{ |
|
|
|
const Preferences* const pref = Preferences::instance(); |
|
|
|
const Preferences* const pref = Preferences::instance(); |
|
|
|
// Disk write cache
|
|
|
|
// Disk write cache
|
|
|
|
spin_cache.setMinimum(0); |
|
|
|
spin_cache.setMinimum(0); |
|
|
|
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes.
|
|
|
|
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes.
|
|
|
|
// These macros may not be available on compilers other than MSVC and GCC
|
|
|
|
// These macros may not be available on compilers other than MSVC and GCC
|
|
|
|
#if !defined(_M_X64) && !defined(__amd64__) |
|
|
|
#if !defined(_M_X64) && !defined(__amd64__) |
|
|
|
//1800MiB to leave 248MiB room to the rest of program data in RAM
|
|
|
|
//1800MiB to leave 248MiB room to the rest of program data in RAM
|
|
|
|
spin_cache.setMaximum(1800); |
|
|
|
spin_cache.setMaximum(1800); |
|
|
|
#else |
|
|
|
#else |
|
|
|
// 4GiB
|
|
|
|
// 4GiB
|
|
|
|
spin_cache.setMaximum(4*1024); |
|
|
|
spin_cache.setMaximum(4*1024); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
spin_cache.setValue(pref->diskCacheSize()); |
|
|
|
spin_cache.setValue(pref->diskCacheSize()); |
|
|
|
updateCacheSpinSuffix(spin_cache.value()); |
|
|
|
updateCacheSpinSuffix(spin_cache.value()); |
|
|
|
setRow(DISK_CACHE, tr("Disk write cache size"), &spin_cache); |
|
|
|
setRow(DISK_CACHE, tr("Disk write cache size"), &spin_cache); |
|
|
|
// Disk cache expiry
|
|
|
|
// Disk cache expiry
|
|
|
|
spin_cache_ttl.setMinimum(15); |
|
|
|
spin_cache_ttl.setMinimum(15); |
|
|
|
spin_cache_ttl.setMaximum(600); |
|
|
|
spin_cache_ttl.setMaximum(600); |
|
|
|
spin_cache_ttl.setValue(pref->diskCacheTTL()); |
|
|
|
spin_cache_ttl.setValue(pref->diskCacheTTL()); |
|
|
|
spin_cache_ttl.setSuffix(tr(" s", " seconds")); |
|
|
|
spin_cache_ttl.setSuffix(tr(" s", " seconds")); |
|
|
|
setRow(DISK_CACHE_TTL, tr("Disk cache expiry interval"), &spin_cache_ttl); |
|
|
|
setRow(DISK_CACHE_TTL, tr("Disk cache expiry interval"), &spin_cache_ttl); |
|
|
|
// Enable OS cache
|
|
|
|
// Enable OS cache
|
|
|
|
cb_os_cache.setChecked(pref->osCache()); |
|
|
|
cb_os_cache.setChecked(pref->osCache()); |
|
|
|
setRow(OS_CACHE, tr("Enable OS cache"), &cb_os_cache); |
|
|
|
setRow(OS_CACHE, tr("Enable OS cache"), &cb_os_cache); |
|
|
|
// Save resume data interval
|
|
|
|
// Save resume data interval
|
|
|
|
spin_save_resume_data_interval.setMinimum(1); |
|
|
|
spin_save_resume_data_interval.setMinimum(1); |
|
|
|
spin_save_resume_data_interval.setMaximum(1440); |
|
|
|
spin_save_resume_data_interval.setMaximum(1440); |
|
|
|
spin_save_resume_data_interval.setValue(pref->saveResumeDataInterval()); |
|
|
|
spin_save_resume_data_interval.setValue(pref->saveResumeDataInterval()); |
|
|
|
spin_save_resume_data_interval.setSuffix(tr(" m", " minutes")); |
|
|
|
spin_save_resume_data_interval.setSuffix(tr(" m", " minutes")); |
|
|
|
setRow(SAVE_RESUME_DATA_INTERVAL, tr("Save resume data interval", "How often the fastresume file is saved."), &spin_save_resume_data_interval); |
|
|
|
setRow(SAVE_RESUME_DATA_INTERVAL, tr("Save resume data interval", "How often the fastresume file is saved."), &spin_save_resume_data_interval); |
|
|
|
// Outgoing port Min
|
|
|
|
// Outgoing port Min
|
|
|
|
outgoing_ports_min.setMinimum(0); |
|
|
|
outgoing_ports_min.setMinimum(0); |
|
|
|
outgoing_ports_min.setMaximum(65535); |
|
|
|
outgoing_ports_min.setMaximum(65535); |
|
|
|
outgoing_ports_min.setValue(pref->outgoingPortsMin()); |
|
|
|
outgoing_ports_min.setValue(pref->outgoingPortsMin()); |
|
|
|
setRow(OUTGOING_PORT_MIN, tr("Outgoing ports (Min) [0: Disabled]"), &outgoing_ports_min); |
|
|
|
setRow(OUTGOING_PORT_MIN, tr("Outgoing ports (Min) [0: Disabled]"), &outgoing_ports_min); |
|
|
|
// Outgoing port Min
|
|
|
|
// Outgoing port Min
|
|
|
|
outgoing_ports_max.setMinimum(0); |
|
|
|
outgoing_ports_max.setMinimum(0); |
|
|
|
outgoing_ports_max.setMaximum(65535); |
|
|
|
outgoing_ports_max.setMaximum(65535); |
|
|
|
outgoing_ports_max.setValue(pref->outgoingPortsMax()); |
|
|
|
outgoing_ports_max.setValue(pref->outgoingPortsMax()); |
|
|
|
setRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &outgoing_ports_max); |
|
|
|
setRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &outgoing_ports_max); |
|
|
|
// Ignore transfer limits on local network
|
|
|
|
// Recheck completed torrents
|
|
|
|
cb_ignore_limits_lan.setChecked(pref->ignoreLimitsOnLAN()); |
|
|
|
cb_recheck_completed.setChecked(pref->recheckTorrentsOnCompletion()); |
|
|
|
setRow(IGNORE_LIMIT_LAN, tr("Ignore transfer limits on local network"), &cb_ignore_limits_lan); |
|
|
|
setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed); |
|
|
|
// Recheck completed torrents
|
|
|
|
// Transfer list refresh interval
|
|
|
|
cb_recheck_completed.setChecked(pref->recheckTorrentsOnCompletion()); |
|
|
|
spin_list_refresh.setMinimum(30); |
|
|
|
setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed); |
|
|
|
spin_list_refresh.setMaximum(99999); |
|
|
|
// Transfer list refresh interval
|
|
|
|
spin_list_refresh.setValue(pref->getRefreshInterval()); |
|
|
|
spin_list_refresh.setMinimum(30); |
|
|
|
spin_list_refresh.setSuffix(tr(" ms", " milliseconds")); |
|
|
|
spin_list_refresh.setMaximum(99999); |
|
|
|
setRow(LIST_REFRESH, tr("Transfer list refresh interval"), &spin_list_refresh); |
|
|
|
spin_list_refresh.setValue(pref->getRefreshInterval()); |
|
|
|
// Resolve Peer countries
|
|
|
|
spin_list_refresh.setSuffix(tr(" ms", " milliseconds")); |
|
|
|
cb_resolve_countries.setChecked(pref->resolvePeerCountries()); |
|
|
|
setRow(LIST_REFRESH, tr("Transfer list refresh interval"), &spin_list_refresh); |
|
|
|
setRow(RESOLVE_COUNTRIES, tr("Resolve peer countries (GeoIP)"), &cb_resolve_countries); |
|
|
|
// Resolve Peer countries
|
|
|
|
// Resolve peer hosts
|
|
|
|
cb_resolve_countries.setChecked(pref->resolvePeerCountries()); |
|
|
|
cb_resolve_hosts.setChecked(pref->resolvePeerHostNames()); |
|
|
|
setRow(RESOLVE_COUNTRIES, tr("Resolve peer countries (GeoIP)"), &cb_resolve_countries); |
|
|
|
setRow(RESOLVE_HOSTS, tr("Resolve peer host names"), &cb_resolve_hosts); |
|
|
|
// Resolve peer hosts
|
|
|
|
// Max Half Open connections
|
|
|
|
cb_resolve_hosts.setChecked(pref->resolvePeerHostNames()); |
|
|
|
spin_maxhalfopen.setMinimum(0); |
|
|
|
setRow(RESOLVE_HOSTS, tr("Resolve peer host names"), &cb_resolve_hosts); |
|
|
|
spin_maxhalfopen.setMaximum(99999); |
|
|
|
// Max Half Open connections
|
|
|
|
spin_maxhalfopen.setValue(pref->getMaxHalfOpenConnections()); |
|
|
|
spin_maxhalfopen.setMinimum(0); |
|
|
|
setRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Disabled]"), &spin_maxhalfopen); |
|
|
|
spin_maxhalfopen.setMaximum(99999); |
|
|
|
// Super seeding
|
|
|
|
spin_maxhalfopen.setValue(pref->getMaxHalfOpenConnections()); |
|
|
|
cb_super_seeding.setChecked(pref->isSuperSeedingEnabled()); |
|
|
|
setRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Disabled]"), &spin_maxhalfopen); |
|
|
|
setRow(SUPER_SEEDING, tr("Strict super seeding"), &cb_super_seeding); |
|
|
|
// Super seeding
|
|
|
|
// Network interface
|
|
|
|
cb_super_seeding.setChecked(pref->isSuperSeedingEnabled()); |
|
|
|
combo_iface.addItem(tr("Any interface", "i.e. Any network interface")); |
|
|
|
setRow(SUPER_SEEDING, tr("Strict super seeding"), &cb_super_seeding); |
|
|
|
const QString current_iface = pref->getNetworkInterface(); |
|
|
|
// Network interface
|
|
|
|
bool interface_exists = current_iface.isEmpty(); |
|
|
|
combo_iface.addItem(tr("Any interface", "i.e. Any network interface")); |
|
|
|
int i = 1; |
|
|
|
const QString current_iface = pref->getNetworkInterface(); |
|
|
|
foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) { |
|
|
|
bool interface_exists = current_iface.isEmpty(); |
|
|
|
if (iface.flags() & QNetworkInterface::IsLoopBack) continue; |
|
|
|
int i = 1; |
|
|
|
combo_iface.addItem(iface.humanReadableName(),iface.name()); |
|
|
|
foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) { |
|
|
|
if (!current_iface.isEmpty() && iface.name() == current_iface) { |
|
|
|
if (iface.flags() & QNetworkInterface::IsLoopBack) continue; |
|
|
|
combo_iface.setCurrentIndex(i); |
|
|
|
combo_iface.addItem(iface.humanReadableName(),iface.name()); |
|
|
|
interface_exists = true; |
|
|
|
if (!current_iface.isEmpty() && iface.name() == current_iface) { |
|
|
|
} |
|
|
|
combo_iface.setCurrentIndex(i); |
|
|
|
++i; |
|
|
|
interface_exists = true; |
|
|
|
} |
|
|
|
} |
|
|
|
// Saved interface does not exist, show it anyway
|
|
|
|
++i; |
|
|
|
if (!interface_exists) { |
|
|
|
} |
|
|
|
combo_iface.addItem(pref->getNetworkInterfaceName(),current_iface); |
|
|
|
// Saved interface does not exist, show it anyway
|
|
|
|
combo_iface.setCurrentIndex(i); |
|
|
|
if (!interface_exists) { |
|
|
|
} |
|
|
|
combo_iface.addItem(pref->getNetworkInterfaceName(),current_iface); |
|
|
|
setRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &combo_iface); |
|
|
|
combo_iface.setCurrentIndex(i); |
|
|
|
// Listen on IPv6 address
|
|
|
|
} |
|
|
|
cb_listen_ipv6.setChecked(pref->getListenIPv6()); |
|
|
|
setRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &combo_iface); |
|
|
|
setRow(NETWORK_LISTEN_IPV6, tr("Listen on IPv6 address (requires restart)"), &cb_listen_ipv6); |
|
|
|
// Listen on IPv6 address
|
|
|
|
// Network address
|
|
|
|
cb_listen_ipv6.setChecked(pref->getListenIPv6()); |
|
|
|
txt_network_address.setText(pref->getNetworkAddress()); |
|
|
|
setRow(NETWORK_LISTEN_IPV6, tr("Listen on IPv6 address (requires restart)"), &cb_listen_ipv6); |
|
|
|
setRow(NETWORK_ADDRESS, tr("IP Address to report to trackers (requires restart)"), &txt_network_address); |
|
|
|
// Network address
|
|
|
|
// Program notifications
|
|
|
|
txt_network_address.setText(pref->getNetworkAddress()); |
|
|
|
cb_program_notifications.setChecked(pref->useProgramNotification()); |
|
|
|
setRow(NETWORK_ADDRESS, tr("IP Address to report to trackers (requires restart)"), &txt_network_address); |
|
|
|
setRow(PROGRAM_NOTIFICATIONS, tr("Display program on-screen notifications"), &cb_program_notifications); |
|
|
|
// Program notifications
|
|
|
|
// Tracker State
|
|
|
|
cb_program_notifications.setChecked(pref->useProgramNotification()); |
|
|
|
cb_tracker_status.setChecked(pref->isTrackerEnabled()); |
|
|
|
setRow(PROGRAM_NOTIFICATIONS, tr("Display program on-screen notifications"), &cb_program_notifications); |
|
|
|
setRow(TRACKER_STATUS, tr("Enable embedded tracker"), &cb_tracker_status); |
|
|
|
// Tracker State
|
|
|
|
// Tracker port
|
|
|
|
cb_tracker_status.setChecked(pref->isTrackerEnabled()); |
|
|
|
spin_tracker_port.setMinimum(1); |
|
|
|
setRow(TRACKER_STATUS, tr("Enable embedded tracker"), &cb_tracker_status); |
|
|
|
spin_tracker_port.setMaximum(65535); |
|
|
|
// Tracker port
|
|
|
|
spin_tracker_port.setValue(pref->getTrackerPort()); |
|
|
|
spin_tracker_port.setMinimum(1); |
|
|
|
setRow(TRACKER_PORT, tr("Embedded tracker port"), &spin_tracker_port); |
|
|
|
spin_tracker_port.setMaximum(65535); |
|
|
|
|
|
|
|
spin_tracker_port.setValue(pref->getTrackerPort()); |
|
|
|
|
|
|
|
setRow(TRACKER_PORT, tr("Embedded tracker port"), &spin_tracker_port); |
|
|
|
|
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
|
|
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
|
|
|
cb_update_check.setChecked(pref->isUpdateCheckEnabled()); |
|
|
|
cb_update_check.setChecked(pref->isUpdateCheckEnabled()); |
|
|
|
setRow(UPDATE_CHECK, tr("Check for software updates"), &cb_update_check); |
|
|
|
setRow(UPDATE_CHECK, tr("Check for software updates"), &cb_update_check); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) |
|
|
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) |
|
|
|
cb_use_icon_theme.setChecked(pref->useSystemIconTheme()); |
|
|
|
cb_use_icon_theme.setChecked(pref->useSystemIconTheme()); |
|
|
|
setRow(USE_ICON_THEME, tr("Use system icon theme"), &cb_use_icon_theme); |
|
|
|
setRow(USE_ICON_THEME, tr("Use system icon theme"), &cb_use_icon_theme); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
// Torrent deletion confirmation
|
|
|
|
// Torrent deletion confirmation
|
|
|
|
cb_confirm_torrent_deletion.setChecked(pref->confirmTorrentDeletion()); |
|
|
|
cb_confirm_torrent_deletion.setChecked(pref->confirmTorrentDeletion()); |
|
|
|
setRow(CONFIRM_DELETE_TORRENT, tr("Confirm torrent deletion"), &cb_confirm_torrent_deletion); |
|
|
|
setRow(CONFIRM_DELETE_TORRENT, tr("Confirm torrent deletion"), &cb_confirm_torrent_deletion); |
|
|
|
// Torrent recheck confirmation
|
|
|
|
// Torrent recheck confirmation
|
|
|
|
cb_confirm_torrent_recheck.setChecked(pref->confirmTorrentRecheck()); |
|
|
|
cb_confirm_torrent_recheck.setChecked(pref->confirmTorrentRecheck()); |
|
|
|
setRow(CONFIRM_RECHECK_TORRENT, tr("Confirm torrent recheck"), &cb_confirm_torrent_recheck); |
|
|
|
setRow(CONFIRM_RECHECK_TORRENT, tr("Confirm torrent recheck"), &cb_confirm_torrent_recheck); |
|
|
|
// Tracker exchange
|
|
|
|
// Tracker exchange
|
|
|
|
cb_enable_tracker_ext.setChecked(pref->trackerExchangeEnabled()); |
|
|
|
cb_enable_tracker_ext.setChecked(pref->trackerExchangeEnabled()); |
|
|
|
setRow(TRACKER_EXCHANGE, tr("Exchange trackers with other peers"), &cb_enable_tracker_ext); |
|
|
|
setRow(TRACKER_EXCHANGE, tr("Exchange trackers with other peers"), &cb_enable_tracker_ext); |
|
|
|
// Announce to all trackers
|
|
|
|
// Announce to all trackers
|
|
|
|
cb_announce_all_trackers.setChecked(pref->announceToAllTrackers()); |
|
|
|
cb_announce_all_trackers.setChecked(pref->announceToAllTrackers()); |
|
|
|
setRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers"), &cb_announce_all_trackers); |
|
|
|
setRow(ANNOUNCE_ALL_TRACKERS, tr("Always announce to all trackers"), &cb_announce_all_trackers); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
#endif // ADVANCEDSETTINGS_H
|
|
|
|
#endif // ADVANCEDSETTINGS_H
|
|
|
|