|
|
@ -46,7 +46,7 @@ public: |
|
|
|
setAlternatingRowColors(true); |
|
|
|
setAlternatingRowColors(true); |
|
|
|
setColumnCount(2); |
|
|
|
setColumnCount(2); |
|
|
|
QStringList header; |
|
|
|
QStringList header; |
|
|
|
header << tr("Property") << tr("Value"); |
|
|
|
header << tr("Setting") << tr("Value", "Value set for this setting"); |
|
|
|
setHorizontalHeaderLabels(header); |
|
|
|
setHorizontalHeaderLabels(header); |
|
|
|
setColumnWidth(0, width()/2); |
|
|
|
setColumnWidth(0, width()/2); |
|
|
|
horizontalHeader()->setStretchLastSection(true); |
|
|
|
horizontalHeader()->setStretchLastSection(true); |
|
|
@ -112,141 +112,133 @@ public slots: |
|
|
|
pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked()); |
|
|
|
pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected slots: |
|
|
|
signals: |
|
|
|
|
|
|
|
void settingsChanged(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
|
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())); |
|
|
|
|
|
|
|
Q_ASSERT(ok); |
|
|
|
|
|
|
|
setCellWidget(row, VALUE, 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())); |
|
|
|
|
|
|
|
Q_ASSERT(ok); |
|
|
|
|
|
|
|
setCellWidget(row, VALUE, 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())); |
|
|
|
|
|
|
|
Q_ASSERT(ok); |
|
|
|
|
|
|
|
setCellWidget(row, VALUE, 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())); |
|
|
|
|
|
|
|
Q_ASSERT(ok); |
|
|
|
|
|
|
|
setCellWidget(row, VALUE, editor); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private slots: |
|
|
|
void loadAdvancedSettings() { |
|
|
|
void loadAdvancedSettings() { |
|
|
|
const Preferences pref; |
|
|
|
const Preferences pref; |
|
|
|
// Disk write cache
|
|
|
|
// Disk write cache
|
|
|
|
setItem(DISK_CACHE, PROPERTY, new QTableWidgetItem(tr("Disk write cache size"))); |
|
|
|
|
|
|
|
connect(&spin_cache, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
spin_cache.setMinimum(1); |
|
|
|
spin_cache.setMinimum(1); |
|
|
|
spin_cache.setMaximum(200); |
|
|
|
spin_cache.setMaximum(200); |
|
|
|
spin_cache.setValue(pref.diskCacheSize()); |
|
|
|
spin_cache.setValue(pref.diskCacheSize()); |
|
|
|
spin_cache.setSuffix(tr(" MiB")); |
|
|
|
spin_cache.setSuffix(tr(" MiB")); |
|
|
|
setCellWidget(DISK_CACHE, VALUE, &spin_cache); |
|
|
|
setRow(DISK_CACHE, tr("Disk write cache size"), &spin_cache); |
|
|
|
// Outgoing port Min
|
|
|
|
// Outgoing port Min
|
|
|
|
setItem(OUTGOING_PORT_MIN, PROPERTY, new QTableWidgetItem(tr("Outgoing ports (Min) [0: Disabled]"))); |
|
|
|
|
|
|
|
connect(&outgoing_ports_min, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
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()); |
|
|
|
setCellWidget(OUTGOING_PORT_MIN, VALUE, &outgoing_ports_min); |
|
|
|
setRow(OUTGOING_PORT_MIN, tr("Outgoing ports (Min) [0: Disabled]"), &outgoing_ports_min); |
|
|
|
// Outgoing port Min
|
|
|
|
// Outgoing port Min
|
|
|
|
setItem(OUTGOING_PORT_MAX, PROPERTY, new QTableWidgetItem(tr("Outgoing ports (Max) [0: Disabled]"))); |
|
|
|
|
|
|
|
connect(&outgoing_ports_max, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
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()); |
|
|
|
setCellWidget(OUTGOING_PORT_MAX, VALUE, &outgoing_ports_max); |
|
|
|
setRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &outgoing_ports_max); |
|
|
|
// Ignore transfer limits on local network
|
|
|
|
// Ignore transfer limits on local network
|
|
|
|
setItem(IGNORE_LIMIT_LAN, PROPERTY, new QTableWidgetItem(tr("Ignore transfer limits on local network"))); |
|
|
|
|
|
|
|
connect(&cb_ignore_limits_lan, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
cb_ignore_limits_lan.setChecked(pref.ignoreLimitsOnLAN()); |
|
|
|
cb_ignore_limits_lan.setChecked(pref.ignoreLimitsOnLAN()); |
|
|
|
setCellWidget(IGNORE_LIMIT_LAN, VALUE, &cb_ignore_limits_lan); |
|
|
|
setRow(IGNORE_LIMIT_LAN, tr("Ignore transfer limits on local network"), &cb_ignore_limits_lan); |
|
|
|
// Consider protocol overhead in transfer limits
|
|
|
|
// Consider protocol overhead in transfer limits
|
|
|
|
setItem(COUNT_OVERHEAD, PROPERTY, new QTableWidgetItem(tr("Include TCP/IP overhead in transfer limits"))); |
|
|
|
|
|
|
|
connect(&cb_count_overhead, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
cb_count_overhead.setChecked(pref.includeOverheadInLimits()); |
|
|
|
cb_count_overhead.setChecked(pref.includeOverheadInLimits()); |
|
|
|
setCellWidget(COUNT_OVERHEAD, VALUE, &cb_count_overhead); |
|
|
|
setRow(COUNT_OVERHEAD, tr("Include TCP/IP overhead in transfer limits"), &cb_count_overhead); |
|
|
|
// Recheck completed torrents
|
|
|
|
// Recheck completed torrents
|
|
|
|
setItem(RECHECK_COMPLETED, PROPERTY, new QTableWidgetItem(tr("Recheck torrents on completion"))); |
|
|
|
|
|
|
|
connect(&cb_recheck_completed, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
cb_recheck_completed.setChecked(pref.recheckTorrentsOnCompletion()); |
|
|
|
cb_recheck_completed.setChecked(pref.recheckTorrentsOnCompletion()); |
|
|
|
setCellWidget(RECHECK_COMPLETED, VALUE, &cb_recheck_completed); |
|
|
|
setRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed); |
|
|
|
// Transfer list refresh interval
|
|
|
|
// Transfer list refresh interval
|
|
|
|
setItem(LIST_REFRESH, PROPERTY, new QTableWidgetItem(tr("Transfer list refresh interval"))); |
|
|
|
|
|
|
|
connect(&spin_list_refresh, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
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")); |
|
|
|
setCellWidget(LIST_REFRESH, VALUE, &spin_list_refresh); |
|
|
|
setRow(LIST_REFRESH, tr("Transfer list refresh interval"), &spin_list_refresh); |
|
|
|
// Resolve Peer countries
|
|
|
|
// Resolve Peer countries
|
|
|
|
setItem(RESOLVE_COUNTRIES, PROPERTY, new QTableWidgetItem(tr("Resolve peer countries (GeoIP)"))); |
|
|
|
|
|
|
|
connect(&cb_resolve_countries, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
cb_resolve_countries.setChecked(pref.resolvePeerCountries()); |
|
|
|
cb_resolve_countries.setChecked(pref.resolvePeerCountries()); |
|
|
|
setCellWidget(RESOLVE_COUNTRIES, VALUE, &cb_resolve_countries); |
|
|
|
setRow(RESOLVE_COUNTRIES, tr("Resolve peer countries (GeoIP)"), &cb_resolve_countries); |
|
|
|
// Resolve peer hosts
|
|
|
|
// Resolve peer hosts
|
|
|
|
setItem(RESOLVE_HOSTS, PROPERTY, new QTableWidgetItem(tr("Resolve peer host names"))); |
|
|
|
|
|
|
|
connect(&cb_resolve_hosts, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
cb_resolve_hosts.setChecked(pref.resolvePeerHostNames()); |
|
|
|
cb_resolve_hosts.setChecked(pref.resolvePeerHostNames()); |
|
|
|
setCellWidget(RESOLVE_HOSTS, VALUE, &cb_resolve_hosts); |
|
|
|
setRow(RESOLVE_HOSTS, tr("Resolve peer host names"), &cb_resolve_hosts); |
|
|
|
// Max Half Open connections
|
|
|
|
// Max Half Open connections
|
|
|
|
setItem(MAX_HALF_OPEN, PROPERTY, new QTableWidgetItem(tr("Maximum number of half-open connections [0: Disabled]"))); |
|
|
|
|
|
|
|
connect(&spin_maxhalfopen, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
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()); |
|
|
|
setCellWidget(MAX_HALF_OPEN, VALUE, &spin_maxhalfopen); |
|
|
|
setRow(MAX_HALF_OPEN, tr("Maximum number of half-open connections [0: Disabled]"), &spin_maxhalfopen); |
|
|
|
// Super seeding
|
|
|
|
// Super seeding
|
|
|
|
setItem(SUPER_SEEDING, PROPERTY, new QTableWidgetItem(tr("Strict super seeding"))); |
|
|
|
|
|
|
|
connect(&cb_super_seeding, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
#if LIBTORRENT_VERSION_MINOR > 14 |
|
|
|
#if LIBTORRENT_VERSION_MINOR > 14 |
|
|
|
cb_super_seeding.setChecked(pref.isSuperSeedingEnabled()); |
|
|
|
cb_super_seeding.setChecked(pref.isSuperSeedingEnabled()); |
|
|
|
#else |
|
|
|
#else |
|
|
|
cb_super_seeding.setEnabled(false); |
|
|
|
cb_super_seeding.setEnabled(false); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
setCellWidget(SUPER_SEEDING, VALUE, &cb_super_seeding); |
|
|
|
setRow(SUPER_SEEDING, tr("Strict super seeding"), &cb_super_seeding); |
|
|
|
// Network interface
|
|
|
|
// Network interface
|
|
|
|
setItem(NETWORK_IFACE, PROPERTY, new QTableWidgetItem(tr("Network Interface (requires restart)"))); |
|
|
|
|
|
|
|
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(); |
|
|
|
int i = 1; |
|
|
|
int i = 1; |
|
|
|
foreach(const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) { |
|
|
|
foreach(const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) { |
|
|
|
if(iface.name() == "lo") continue; |
|
|
|
if(iface.flags() & QNetworkInterface::IsLoopBack) continue; |
|
|
|
combo_iface.addItem(iface.name()); |
|
|
|
combo_iface.addItem(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); |
|
|
|
++i; |
|
|
|
++i; |
|
|
|
} |
|
|
|
} |
|
|
|
connect(&combo_iface, SIGNAL(currentIndexChanged(int)), this, SLOT(emitSettingsChanged())); |
|
|
|
setRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &combo_iface); |
|
|
|
setCellWidget(NETWORK_IFACE, VALUE, &combo_iface); |
|
|
|
|
|
|
|
// Network address
|
|
|
|
// Network address
|
|
|
|
setItem(NETWORK_ADDRESS, PROPERTY, new QTableWidgetItem(tr("IP Address to report to trackers (requires restart)"))); |
|
|
|
|
|
|
|
txt_network_address.setText(pref.getNetworkAddress()); |
|
|
|
txt_network_address.setText(pref.getNetworkAddress()); |
|
|
|
connect(&txt_network_address, SIGNAL(textChanged(QString)), this, SLOT(emitSettingsChanged())); |
|
|
|
setRow(NETWORK_ADDRESS, tr("IP Address to report to trackers (requires restart)"), &txt_network_address); |
|
|
|
setCellWidget(NETWORK_ADDRESS, VALUE, &txt_network_address); |
|
|
|
|
|
|
|
// Program notifications
|
|
|
|
// Program notifications
|
|
|
|
setItem(PROGRAM_NOTIFICATIONS, PROPERTY, new QTableWidgetItem(tr("Display program on-screen notifications"))); |
|
|
|
|
|
|
|
connect(&cb_program_notifications, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
cb_program_notifications.setChecked(pref.useProgramNotification()); |
|
|
|
cb_program_notifications.setChecked(pref.useProgramNotification()); |
|
|
|
setCellWidget(PROGRAM_NOTIFICATIONS, VALUE, &cb_program_notifications); |
|
|
|
setRow(PROGRAM_NOTIFICATIONS, "Display program on-screen notifications", &cb_program_notifications); |
|
|
|
// Tracker State
|
|
|
|
// Tracker State
|
|
|
|
setItem(TRACKER_STATUS, PROPERTY, new QTableWidgetItem(tr("Enable embedded tracker"))); |
|
|
|
|
|
|
|
connect(&cb_tracker_status, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
cb_tracker_status.setChecked(pref.isTrackerEnabled()); |
|
|
|
cb_tracker_status.setChecked(pref.isTrackerEnabled()); |
|
|
|
setCellWidget(TRACKER_STATUS, VALUE, &cb_tracker_status); |
|
|
|
setRow(TRACKER_STATUS, tr("Enable embedded tracker"), &cb_tracker_status); |
|
|
|
// Tracker port
|
|
|
|
// Tracker port
|
|
|
|
setItem(TRACKER_PORT, PROPERTY, new QTableWidgetItem(tr("Embedded tracker port"))); |
|
|
|
|
|
|
|
connect(&spin_tracker_port, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
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()); |
|
|
|
setCellWidget(TRACKER_PORT, VALUE, &spin_tracker_port); |
|
|
|
setRow(TRACKER_PORT, tr("Embedded tracker port"), &spin_tracker_port); |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_WS_MAC) |
|
|
|
#if defined(Q_WS_WIN) || defined(Q_WS_MAC) |
|
|
|
setItem(UPDATE_CHECK, PROPERTY, new QTableWidgetItem(tr("Check for software updates"))); |
|
|
|
|
|
|
|
connect(&cb_update_check, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
cb_update_check.setChecked(pref.isUpdateCheckEnabled()); |
|
|
|
cb_update_check.setChecked(pref.isUpdateCheckEnabled()); |
|
|
|
setCellWidget(UPDATE_CHECK, VALUE, &cb_update_check); |
|
|
|
setRow(UPDATE_CHECK, tr("Check for software updates"), &cb_update_check); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) |
|
|
|
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) |
|
|
|
setItem(USE_ICON_THEME, PROPERTY, new QTableWidgetItem(tr("Use system icon theme"))); |
|
|
|
|
|
|
|
connect(&cb_use_icon_theme, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
cb_use_icon_theme.setChecked(pref.useSystemIconTheme()); |
|
|
|
cb_use_icon_theme.setChecked(pref.useSystemIconTheme()); |
|
|
|
setCellWidget(USE_ICON_THEME, VALUE, &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
|
|
|
|
setItem(CONFIRM_DELETE_TORRENT, PROPERTY, new QTableWidgetItem(tr("Confirm torrent deletion"))); |
|
|
|
|
|
|
|
connect(&cb_confirm_torrent_deletion, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
cb_confirm_torrent_deletion.setChecked(pref.confirmTorrentDeletion()); |
|
|
|
cb_confirm_torrent_deletion.setChecked(pref.confirmTorrentDeletion()); |
|
|
|
setCellWidget(CONFIRM_DELETE_TORRENT, VALUE, &cb_confirm_torrent_deletion); |
|
|
|
setRow(CONFIRM_DELETE_TORRENT, tr("Confirm torrent deletion"), &cb_confirm_torrent_deletion); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void emitSettingsChanged() { |
|
|
|
|
|
|
|
emit settingsChanged(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signals: |
|
|
|
|
|
|
|
void settingsChanged(); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
#endif // ADVANCEDSETTINGS_H
|
|
|
|
#endif // ADVANCEDSETTINGS_H
|
|
|
|