mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Follow project coding style. Issue #2192.
This commit is contained in:
parent
bd657fe9ae
commit
2204f27de1
@ -12,19 +12,46 @@
|
|||||||
|
|
||||||
#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,
|
{
|
||||||
|
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)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||||
UPDATE_CHECK,
|
UPDATE_CHECK,
|
||||||
#endif
|
#endif
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
||||||
USE_ICON_THEME,
|
USE_ICON_THEME,
|
||||||
#endif
|
#endif
|
||||||
CONFIRM_DELETE_TORRENT, CONFIRM_RECHECK_TORRENT, TRACKER_EXCHANGE,
|
CONFIRM_DELETE_TORRENT,
|
||||||
|
CONFIRM_RECHECK_TORRENT,
|
||||||
|
TRACKER_EXCHANGE,
|
||||||
ANNOUNCE_ALL_TRACKERS,
|
ANNOUNCE_ALL_TRACKERS,
|
||||||
ROW_COUNT};
|
ROW_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
class AdvancedSettings: public QTableWidget {
|
class AdvancedSettings: public QTableWidget
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -44,7 +71,8 @@ private:
|
|||||||
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
|
// Set visual appearance
|
||||||
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
setAlternatingRowColors(true);
|
setAlternatingRowColors(true);
|
||||||
@ -62,11 +90,11 @@ public:
|
|||||||
loadAdvancedSettings();
|
loadAdvancedSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
~AdvancedSettings() {
|
~AdvancedSettings() {}
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void saveAdvancedSettings() {
|
void saveAdvancedSettings()
|
||||||
|
{
|
||||||
Preferences* const pref = Preferences::instance();
|
Preferences* const pref = Preferences::instance();
|
||||||
// Disk write cache
|
// Disk write cache
|
||||||
pref->setDiskCacheSize(spin_cache.value());
|
pref->setDiskCacheSize(spin_cache.value());
|
||||||
@ -94,7 +122,8 @@ public slots:
|
|||||||
// 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());
|
||||||
}
|
}
|
||||||
@ -129,7 +158,8 @@ 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));
|
setItem(row, PROPERTY, new QTableWidgetItem(property));
|
||||||
bool ok; Q_UNUSED(ok);
|
bool ok; Q_UNUSED(ok);
|
||||||
ok = connect(editor, SIGNAL(valueChanged(int)), SIGNAL(settingsChanged()));
|
ok = connect(editor, SIGNAL(valueChanged(int)), SIGNAL(settingsChanged()));
|
||||||
@ -137,7 +167,8 @@ private:
|
|||||||
setCellWidget(row, VALUE, editor);
|
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));
|
setItem(row, PROPERTY, new QTableWidgetItem(property));
|
||||||
bool ok; Q_UNUSED(ok);
|
bool ok; Q_UNUSED(ok);
|
||||||
ok = connect(editor, SIGNAL(currentIndexChanged(int)), SIGNAL(settingsChanged()));
|
ok = connect(editor, SIGNAL(currentIndexChanged(int)), SIGNAL(settingsChanged()));
|
||||||
@ -145,7 +176,8 @@ private:
|
|||||||
setCellWidget(row, VALUE, editor);
|
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));
|
setItem(row, PROPERTY, new QTableWidgetItem(property));
|
||||||
bool ok; Q_UNUSED(ok);
|
bool ok; Q_UNUSED(ok);
|
||||||
ok = connect(editor, SIGNAL(stateChanged(int)), SIGNAL(settingsChanged()));
|
ok = connect(editor, SIGNAL(stateChanged(int)), SIGNAL(settingsChanged()));
|
||||||
@ -153,7 +185,8 @@ private:
|
|||||||
setCellWidget(row, VALUE, editor);
|
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));
|
setItem(row, PROPERTY, new QTableWidgetItem(property));
|
||||||
bool ok; Q_UNUSED(ok);
|
bool ok; Q_UNUSED(ok);
|
||||||
ok = connect(editor, SIGNAL(textChanged(QString)), SIGNAL(settingsChanged()));
|
ok = connect(editor, SIGNAL(textChanged(QString)), SIGNAL(settingsChanged()));
|
||||||
@ -293,7 +326,6 @@ private slots:
|
|||||||
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…
Reference in New Issue
Block a user