Browse Source

Follow project coding style. Issue #2192.

adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
2204f27de1
  1. 530
      src/gui/advancedsettings.h

530
src/gui/advancedsettings.h

@ -12,288 +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, 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_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());
// Recheck torrents on completion pref->setOutgoingPortsMax(outgoing_ports_max.value());
pref->recheckTorrentsOnCompletion(cb_recheck_completed.isChecked()); // Recheck torrents on completion
// Transfer list refresh interval pref->recheckTorrentsOnCompletion(cb_recheck_completed.isChecked());
pref->setRefreshInterval(spin_list_refresh.value()); // Transfer list refresh interval
// Peer resolution pref->setRefreshInterval(spin_list_refresh.value());
pref->resolvePeerCountries(cb_resolve_countries.isChecked()); // Peer resolution
pref->resolvePeerHostNames(cb_resolve_hosts.isChecked()); pref->resolvePeerCountries(cb_resolve_countries.isChecked());
// Max Half-Open connections pref->resolvePeerHostNames(cb_resolve_hosts.isChecked());
pref->setMaxHalfOpenConnections(spin_maxhalfopen.value()); // Max Half-Open connections
// Super seeding pref->setMaxHalfOpenConnections(spin_maxhalfopen.value());
pref->enableSuperSeeding(cb_super_seeding.isChecked()); // Super seeding
// Network interface pref->enableSuperSeeding(cb_super_seeding.isChecked());
if (combo_iface.currentIndex() == 0) { // Network interface
// All interfaces (default) if (combo_iface.currentIndex() == 0) {
pref->setNetworkInterface(QString::null); // All interfaces (default)
pref->setNetworkInterfaceName(QString::null); pref->setNetworkInterface(QString::null);
} else { pref->setNetworkInterfaceName(QString::null);
pref->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString()); }
pref->setNetworkInterfaceName(combo_iface.currentText()); else {
} pref->setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString());
// Listen on IPv6 address pref->setNetworkInterfaceName(combo_iface.currentText());
pref->setListenIPv6(cb_listen_ipv6.isChecked()); }
// Network address // Listen on IPv6 address
QHostAddress addr(txt_network_address.text().trimmed()); pref->setListenIPv6(cb_listen_ipv6.isChecked());
if (addr.isNull()) // Network address
pref->setNetworkAddress(""); QHostAddress addr(txt_network_address.text().trimmed());
else if (addr.isNull())
pref->setNetworkAddress(addr.toString()); pref->setNetworkAddress("");
// Program notification else
pref->useProgramNotification(cb_program_notifications.isChecked()); pref->setNetworkAddress(addr.toString());
// Tracker // Program notification
pref->setTrackerEnabled(cb_tracker_status.isChecked()); pref->useProgramNotification(cb_program_notifications.isChecked());
pref->setTrackerPort(spin_tracker_port.value()); // Tracker
pref->setTrackerEnabled(cb_tracker_status.isChecked());
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);
// Recheck completed torrents // Recheck completed torrents
cb_recheck_completed.setChecked(pref->recheckTorrentsOnCompletion()); cb_recheck_completed.setChecked(pref->recheckTorrentsOnCompletion());
setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed); setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed);
// Transfer list refresh interval // Transfer list refresh interval
spin_list_refresh.setMinimum(30); spin_list_refresh.setMinimum(30);
spin_list_refresh.setMaximum(99999); spin_list_refresh.setMaximum(99999);
spin_list_refresh.setValue(pref->getRefreshInterval()); spin_list_refresh.setValue(pref->getRefreshInterval());
spin_list_refresh.setSuffix(tr(" ms", " milliseconds")); spin_list_refresh.setSuffix(tr(" ms", " milliseconds"));
setRow(LIST_REFRESH, tr("Transfer list refresh interval"), &spin_list_refresh); setRow(LIST_REFRESH, tr("Transfer list refresh interval"), &spin_list_refresh);
// Resolve Peer countries // Resolve Peer countries
cb_resolve_countries.setChecked(pref->resolvePeerCountries()); cb_resolve_countries.setChecked(pref->resolvePeerCountries());
setRow(RESOLVE_COUNTRIES, tr("Resolve peer countries (GeoIP)"), &cb_resolve_countries); setRow(RESOLVE_COUNTRIES, tr("Resolve peer countries (GeoIP)"), &cb_resolve_countries);
// Resolve peer hosts // Resolve peer hosts
cb_resolve_hosts.setChecked(pref->resolvePeerHostNames()); cb_resolve_hosts.setChecked(pref->resolvePeerHostNames());
setRow(RESOLVE_HOSTS, tr("Resolve peer host names"), &cb_resolve_hosts); setRow(RESOLVE_HOSTS, tr("Resolve peer host names"), &cb_resolve_hosts);
// Max Half Open connections // Max Half Open connections
spin_maxhalfopen.setMinimum(0); spin_maxhalfopen.setMinimum(0);
spin_maxhalfopen.setMaximum(99999); spin_maxhalfopen.setMaximum(99999);
spin_maxhalfopen.setValue(pref->getMaxHalfOpenConnections()); spin_maxhalfopen.setValue(pref->getMaxHalfOpenConnections());
setRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Disabled]"), &spin_maxhalfopen); setRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Disabled]"), &spin_maxhalfopen);
// Super seeding // Super seeding
cb_super_seeding.setChecked(pref->isSuperSeedingEnabled()); cb_super_seeding.setChecked(pref->isSuperSeedingEnabled());
setRow(SUPER_SEEDING, tr("Strict super seeding"), &cb_super_seeding); setRow(SUPER_SEEDING, tr("Strict super seeding"), &cb_super_seeding);
// Network interface // Network interface
combo_iface.addItem(tr("Any interface", "i.e. Any network interface")); combo_iface.addItem(tr("Any interface", "i.e. Any network interface"));
const QString current_iface = pref->getNetworkInterface(); const QString current_iface = pref->getNetworkInterface();
bool interface_exists = current_iface.isEmpty(); bool interface_exists = current_iface.isEmpty();
int i = 1; int i = 1;
foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) { foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) {
if (iface.flags() & QNetworkInterface::IsLoopBack) continue; if (iface.flags() & QNetworkInterface::IsLoopBack) continue;
combo_iface.addItem(iface.humanReadableName(),iface.name()); combo_iface.addItem(iface.humanReadableName(),iface.name());
if (!current_iface.isEmpty() && iface.name() == current_iface) { if (!current_iface.isEmpty() && iface.name() == current_iface) {
combo_iface.setCurrentIndex(i); combo_iface.setCurrentIndex(i);
interface_exists = true; interface_exists = true;
} }
++i; ++i;
} }
// Saved interface does not exist, show it anyway // Saved interface does not exist, show it anyway
if (!interface_exists) { if (!interface_exists) {
combo_iface.addItem(pref->getNetworkInterfaceName(),current_iface); combo_iface.addItem(pref->getNetworkInterfaceName(),current_iface);
combo_iface.setCurrentIndex(i); combo_iface.setCurrentIndex(i);
} }
setRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &combo_iface); setRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &combo_iface);
// Listen on IPv6 address // Listen on IPv6 address
cb_listen_ipv6.setChecked(pref->getListenIPv6()); cb_listen_ipv6.setChecked(pref->getListenIPv6());
setRow(NETWORK_LISTEN_IPV6, tr("Listen on IPv6 address (requires restart)"), &cb_listen_ipv6); setRow(NETWORK_LISTEN_IPV6, tr("Listen on IPv6 address (requires restart)"), &cb_listen_ipv6);
// Network address // Network address
txt_network_address.setText(pref->getNetworkAddress()); txt_network_address.setText(pref->getNetworkAddress());
setRow(NETWORK_ADDRESS, tr("IP Address to report to trackers (requires restart)"), &txt_network_address); setRow(NETWORK_ADDRESS, tr("IP Address to report to trackers (requires restart)"), &txt_network_address);
// Program notifications // Program notifications
cb_program_notifications.setChecked(pref->useProgramNotification()); cb_program_notifications.setChecked(pref->useProgramNotification());
setRow(PROGRAM_NOTIFICATIONS, tr("Display program on-screen notifications"), &cb_program_notifications); setRow(PROGRAM_NOTIFICATIONS, tr("Display program on-screen notifications"), &cb_program_notifications);
// Tracker State // Tracker State
cb_tracker_status.setChecked(pref->isTrackerEnabled()); cb_tracker_status.setChecked(pref->isTrackerEnabled());
setRow(TRACKER_STATUS, tr("Enable embedded tracker"), &cb_tracker_status); setRow(TRACKER_STATUS, tr("Enable embedded tracker"), &cb_tracker_status);
// Tracker port // Tracker port
spin_tracker_port.setMinimum(1); spin_tracker_port.setMinimum(1);
spin_tracker_port.setMaximum(65535); spin_tracker_port.setMaximum(65535);
spin_tracker_port.setValue(pref->getTrackerPort()); spin_tracker_port.setValue(pref->getTrackerPort());
setRow(TRACKER_PORT, tr("Embedded tracker port"), &spin_tracker_port); 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

Loading…
Cancel
Save