|
|
@ -7,15 +7,14 @@ |
|
|
|
#include "preferences.h" |
|
|
|
#include "preferences.h" |
|
|
|
|
|
|
|
|
|
|
|
enum AdvSettingsCols {PROPERTY, VALUE}; |
|
|
|
enum AdvSettingsCols {PROPERTY, VALUE}; |
|
|
|
enum AdvSettingsRows {DISK_CACHE}; |
|
|
|
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX }; |
|
|
|
#define ROW_COUNT 1 |
|
|
|
#define ROW_COUNT 3 |
|
|
|
enum AdvValueTYPE {UINT=1001}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AdvancedSettings: public QTableWidget { |
|
|
|
class AdvancedSettings: public QTableWidget { |
|
|
|
Q_OBJECT |
|
|
|
Q_OBJECT |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
QSpinBox *spin_cache; |
|
|
|
QSpinBox *spin_cache, *outgoing_ports_min, *outgoing_ports_max; |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) { |
|
|
|
AdvancedSettings(QWidget *parent=0): QTableWidget(parent) { |
|
|
@ -33,24 +32,45 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
~AdvancedSettings() { |
|
|
|
~AdvancedSettings() { |
|
|
|
delete spin_cache; |
|
|
|
delete spin_cache; |
|
|
|
|
|
|
|
delete outgoing_ports_min; |
|
|
|
|
|
|
|
delete outgoing_ports_max; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public slots: |
|
|
|
public slots: |
|
|
|
void saveAdvancedSettings() { |
|
|
|
void saveAdvancedSettings() { |
|
|
|
// Disk cache
|
|
|
|
// Disk write cache
|
|
|
|
Preferences::setDiskCacheSize(spin_cache->value()); |
|
|
|
Preferences::setDiskCacheSize(spin_cache->value()); |
|
|
|
|
|
|
|
// Outgoing ports
|
|
|
|
|
|
|
|
Preferences::setOutgoingPortsMin(outgoing_ports_min->value()); |
|
|
|
|
|
|
|
Preferences::setOutgoingPortsMax(outgoing_ports_max->value()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected slots: |
|
|
|
protected slots: |
|
|
|
void loadAdvancedSettings() { |
|
|
|
void loadAdvancedSettings() { |
|
|
|
// Disk write cache
|
|
|
|
// Disk write cache
|
|
|
|
setItem(DISK_CACHE, PROPERTY, new QTableWidgetItem(tr("Disk write cache size (MiB)"), UINT)); |
|
|
|
setItem(DISK_CACHE, PROPERTY, new QTableWidgetItem(tr("Disk write cache size (MiB)"))); |
|
|
|
spin_cache = new QSpinBox(); |
|
|
|
spin_cache = new QSpinBox(); |
|
|
|
connect(spin_cache, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged())); |
|
|
|
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(Preferences::diskCacheSize()); |
|
|
|
spin_cache->setValue(Preferences::diskCacheSize()); |
|
|
|
setCellWidget(DISK_CACHE, VALUE, spin_cache); |
|
|
|
setCellWidget(DISK_CACHE, VALUE, spin_cache); |
|
|
|
|
|
|
|
// Outgoing port Min
|
|
|
|
|
|
|
|
setItem(OUTGOING_PORT_MIN, PROPERTY, new QTableWidgetItem(tr("Outgoing ports (Min)"))); |
|
|
|
|
|
|
|
outgoing_ports_min = new QSpinBox(); |
|
|
|
|
|
|
|
connect(outgoing_ports_min, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
outgoing_ports_min->setMinimum(0); |
|
|
|
|
|
|
|
outgoing_ports_min->setMaximum(65535); |
|
|
|
|
|
|
|
outgoing_ports_min->setValue(Preferences::outgoingPortsMin()); |
|
|
|
|
|
|
|
setCellWidget(OUTGOING_PORT_MIN, VALUE, outgoing_ports_min); |
|
|
|
|
|
|
|
// Outgoing port Min
|
|
|
|
|
|
|
|
setItem(OUTGOING_PORT_MAX, PROPERTY, new QTableWidgetItem(tr("Outgoing ports (Max)"))); |
|
|
|
|
|
|
|
outgoing_ports_max = new QSpinBox(); |
|
|
|
|
|
|
|
connect(outgoing_ports_max, SIGNAL(valueChanged(int)), this, SLOT(emitSettingsChanged())); |
|
|
|
|
|
|
|
outgoing_ports_max->setMinimum(0); |
|
|
|
|
|
|
|
outgoing_ports_max->setMaximum(65535); |
|
|
|
|
|
|
|
outgoing_ports_max->setValue(Preferences::outgoingPortsMax()); |
|
|
|
|
|
|
|
setCellWidget(OUTGOING_PORT_MAX, VALUE, outgoing_ports_max); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void emitSettingsChanged() { |
|
|
|
void emitSettingsChanged() { |
|
|
|