From d870ae4ef2bd1f5f094a2cfa753e96539f63c84a Mon Sep 17 00:00:00 2001 From: notdefine Date: Sun, 3 May 2009 00:41:38 +0000 Subject: [PATCH] It makes no sense if the total Transfer rate is lower than the individual rate. Avoid this due setting uper limit for individual rate, and correct old wrong saved settings. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1160 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/Preferences/ServerDialog.cpp | 19 +++++- .../src/gui/Preferences/ServerDialog.h | 68 +++++++++---------- 2 files changed, 51 insertions(+), 36 deletions(-) diff --git a/retroshare-gui/src/gui/Preferences/ServerDialog.cpp b/retroshare-gui/src/gui/Preferences/ServerDialog.cpp index 6ab85df4e..24442df3b 100644 --- a/retroshare-gui/src/gui/Preferences/ServerDialog.cpp +++ b/retroshare-gui/src/gui/Preferences/ServerDialog.cpp @@ -91,6 +91,12 @@ ServerDialog::save(QString &errmsg) } +/** Change of maxDataRate limits the Individual Data Rate */ +void ServerDialog::setMaximumIndivRate(int maximum) { + ui.indivRate->setMaximum(maximum); +} + + /** Loads the settings for this page */ void ServerDialog::load() { @@ -137,10 +143,20 @@ void ServerDialog::load() rsiface->lockData(); /* Lock Interface */ ui.totalRate->setValue(rsiface->getConfig().maxDataRate); - ui.indivRate->setValue(rsiface->getConfig().maxIndivDataRate); + + // It makes no sense if the total Transfer rate is lower than the individual rate. + // Avoid this due setting uper limit for individual rate, and correct old wrong saved settings. + if (rsiface->getConfig().maxDataRate < rsiface->getConfig().maxIndivDataRate) { + ui.indivRate->setValue(rsiface->getConfig().maxDataRate); + } else { + ui.indivRate->setValue(rsiface->getConfig().maxIndivDataRate); + } + QObject::connect(ui.totalRate, SIGNAL (valueChanged(int)), + this, SLOT (setMaximumIndivRate(int))); rsiface->unlockData(); /* UnLock Interface */ + toggleUPnP(); //ui.check_net->setCheckable(true); @@ -171,7 +187,6 @@ void ServerDialog::load() ui.extPort -> setValue(detail.extPort); } - /** Loads the settings for this page */ void ServerDialog::updateStatus() { diff --git a/retroshare-gui/src/gui/Preferences/ServerDialog.h b/retroshare-gui/src/gui/Preferences/ServerDialog.h index 25e931d67..0723d5b05 100644 --- a/retroshare-gui/src/gui/Preferences/ServerDialog.h +++ b/retroshare-gui/src/gui/Preferences/ServerDialog.h @@ -17,48 +17,48 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - ****************************************************************/ - + ****************************************************************/ + #ifndef _SERVERDIALOG_H -#define _SERVERDIALOG_H - -#include +#define _SERVERDIALOG_H + +#include #include "rsharesettings.h" - -#include "configpage.h" -#include "ui_ServerDialog.h" - -class ServerDialog : public ConfigPage -{ - Q_OBJECT - -public: - /** Default Constructor */ - ServerDialog(QWidget *parent = 0); - /** Default Destructor */ - - /** Saves the changes on this page */ - bool save(QString &errmsg); - /** Loads the settings for this page */ - void load(); + +#include "configpage.h" +#include "ui_ServerDialog.h" + +class ServerDialog : public ConfigPage +{ + Q_OBJECT + +public: + /** Default Constructor */ + ServerDialog(QWidget *parent = 0); + /** Default Destructor */ + + /** Saves the changes on this page */ + bool save(QString &errmsg); + /** Loads the settings for this page */ + void load(); public slots: void updateStatus(); -private slots: +private slots: void saveAddresses(); void toggleUPnP(); void toggleIpDetermination(bool) ; - - -private: - /** A RshareSettings object used for saving/loading settings */ + void setMaximumIndivRate(int); + +private: + /** A RshareSettings object used for saving/loading settings */ RshareSettings* _settings; - - /** Qt Designer generated object */ - Ui::ServerDialog ui; -}; - -#endif - + + /** Qt Designer generated object */ + Ui::ServerDialog ui; +}; + +#endif +