mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-04 15:15:15 -04:00
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:
parent
2f8d21ab76
commit
0c46da0dd2
52 changed files with 310 additions and 428 deletions
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2006-2007, crypton
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2006-2007, crypton
|
||||
* Copyright (c) 2006, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include <QDesktopWidget>
|
||||
#include <rshare.h>
|
||||
#include "rwindow.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
||||
|
||||
/** Default constructor. */
|
||||
|
@ -36,14 +37,12 @@ RWindow::RWindow(QString name, QWidget *parent, Qt::WFlags flags)
|
|||
: QMainWindow(parent, flags)
|
||||
{
|
||||
_name = name;
|
||||
_settings = new RSettings(name);
|
||||
}
|
||||
|
||||
/** Destructor. */
|
||||
RWindow::~RWindow()
|
||||
{
|
||||
saveWindowState();
|
||||
delete _settings;
|
||||
}
|
||||
|
||||
/** Associates a shortcut key sequence with a slot. */
|
||||
|
@ -98,14 +97,16 @@ RWindow::restoreWindowState()
|
|||
QVariant
|
||||
RWindow::getSetting(QString setting, QVariant defaultValue)
|
||||
{
|
||||
return _settings->value(setting, defaultValue);
|
||||
RshareSettings settings;
|
||||
return settings.value(setting, defaultValue);
|
||||
}
|
||||
|
||||
/** Saves a value associated with a property name for this window object. */
|
||||
void
|
||||
RWindow::saveSetting(QString prop, QVariant value)
|
||||
{
|
||||
_settings->setValue(prop, value);
|
||||
RshareSettings settings;
|
||||
settings.setValue(prop, value);
|
||||
}
|
||||
|
||||
/** Overloaded QWidget::setVisible(). If this window is already visible and
|
||||
|
|
|
@ -68,7 +68,6 @@ signals:
|
|||
|
||||
private:
|
||||
QString _name; /**< Name associated with this window. */
|
||||
RSettings* _settings; /**< Object used to store window properties */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue