Changed settings to local variable, no more as pointer on all classes.

RshareSettings settings;
settings.value(...);

It should lower memory usage and removes memory leaks.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2886 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-05-11 20:02:52 +00:00
parent 2f8d21ab76
commit 0c46da0dd2
52 changed files with 310 additions and 428 deletions

View file

@ -25,6 +25,7 @@
#include "GeneralPage.h"
#include <util/stringutil.h>
#include <QSystemTrayIcon>
#include "rsharesettings.h"
/** Constructor */
GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags)
@ -33,9 +34,6 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect(ui.autoLogin, SIGNAL(clicked()), this, SLOT(setAutoLogin()));
/* Hide platform specific features */
@ -51,20 +49,20 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags)
/** Destructor */
GeneralPage::~GeneralPage()
{
delete _settings;
}
/** Saves the changes on this page */
bool
GeneralPage::save(QString &errmsg)
{
_settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized());
RshareSettings settings;
settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
_settings->setValue(QString::fromUtf8("doQuit"), quit());
settings.setValue(QString::fromUtf8("doQuit"), quit());
_settings->setValue(QString::fromUtf8("ClosetoTray"), closetoTray());
settings.setValue(QString::fromUtf8("ClosetoTray"), closetoTray());
_settings->setRunRetroshareOnBoot(
settings.setRunRetroshareOnBoot(
ui.chkRunRetroshareAtSystemStartup->isChecked());
return true;
@ -74,14 +72,14 @@ GeneralPage::save(QString &errmsg)
void
GeneralPage::load()
{
ui.chkRunRetroshareAtSystemStartup->setChecked(
_settings->runRetroshareOnBoot());
RshareSettings settings;
ui.chkRunRetroshareAtSystemStartup->setChecked(settings.runRetroshareOnBoot());
ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool());
ui.checkStartMinimized->setChecked(settings.value(QString::fromUtf8("StartMinimized"), false).toBool());
ui.checkQuit->setChecked(_settings->value(QString::fromUtf8("doQuit"), false).toBool());
ui.checkQuit->setChecked(settings.value(QString::fromUtf8("doQuit"), false).toBool());
ui.checkClosetoTray->setChecked(_settings->value(QString::fromUtf8("ClosetoTray"), false).toBool());
ui.checkClosetoTray->setChecked(settings.value(QString::fromUtf8("ClosetoTray"), false).toBool());
}
@ -106,8 +104,8 @@ bool GeneralPage::closetoTray() const {
void
GeneralPage::toggleShowOnStartup(bool checked)
{
//RshareSettings _settings;
_settings->setShowMainWindowAtStart(checked);
RshareSettings settings;
settings.setShowMainWindowAtStart(checked);
}
void GeneralPage::setAutoLogin(){