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 "rsiface/rsdisc.h"
#include "rsiface/rsiface.h"
#include "settings/rsharesettings.h"
#include <QtGui/QHBoxLayout>
#include <QtGui/QPainter>
@ -355,9 +356,6 @@ void AWidget::drawWater(QRgb* srcImage,QRgb* dstImage) {
TBoard::TBoard(QWidget *parent) {
Q_UNUSED(parent);
/* Create RshareSettings object */
_settings = new RshareSettings();
setFocusPolicy(Qt::StrongFocus);
isStarted = false;
isPaused = false;
@ -365,13 +363,16 @@ TBoard::TBoard(QWidget *parent) {
nextPiece.setRandomShape();
score = 0;
level = 0;
maxScore = _settings->value("/about/maxsc").toInt();
RshareSettings settings;
maxScore = settings.value("/about/maxsc").toInt();
}
TBoard::~TBoard() {
int oldMax = _settings->value("/about/maxsc").toInt();
RshareSettings settings;
int oldMax = settings.value("/about/maxsc").toInt();
int newMax = qMax(maxScore, score);
if (oldMax < newMax) {
_settings->setValue("/about/maxsc", newMax);
settings.setValue("/about/maxsc", newMax);
}
}

View File

@ -23,8 +23,6 @@
#ifndef _GB2_ABOUT_DIALOG_
#define _GB2_ABOUT_DIALOG_
#include "settings/rsharesettings.h"
#include "ui_AboutDialog.h"
#include <QtCore/QBasicTimer>
@ -194,9 +192,6 @@ private:
int maxScore;
int level;
TPiece::Shape board[BoardWidth * BoardHeight];
/** A RetroShare Settings object used for saving/loading settings */
RshareSettings *_settings;
};
class NextPieceLabel : public QLabel {

View File

@ -57,6 +57,7 @@
#include "gui/connect/ConnectFriendWizard.h"
#include "util/rsversion.h"
#include "settings/rsettingswin.h"
#include "settings/rsharesettings.h"
#include <sstream>
#include <iomanip>
@ -121,12 +122,11 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated QObject setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
if (_settings->value(QString::fromUtf8("FirstRun"), true).toBool())
RshareSettings settings;
if (settings.value(QString::fromUtf8("FirstRun"), true).toBool())
{
_settings->setValue(QString::fromUtf8("FirstRun"), false);
settings.setValue(QString::fromUtf8("FirstRun"), false);
QuickStartWizard *qstartWizard = new QuickStartWizard(this);
qstartWizard->exec();
}
@ -287,8 +287,9 @@ MainWindow::~MainWindow()
delete peerstatus;
delete natstatus;
delete ratesstatus;
delete _settings;
#ifdef UNFINISHED
MessengerWindow::releaseInstance();
messengerWindow = NULL;
#ifdef UNFINISHED
delete applicationWindow;
#endif
}
@ -580,8 +581,9 @@ void MainWindow::createActions()
*/
void MainWindow::doQuit()
{
RshareSettings settings;
if(!_settings->value(QString::fromUtf8("doQuit"), false).toBool())
if(!settings.value(QString::fromUtf8("doQuit"), false).toBool())
{
QString queryWrn;
queryWrn.clear();
@ -609,7 +611,9 @@ void MainWindow::closeEvent(QCloseEvent *e)
{
static bool firstTime = true;
if(!_settings->value(QString::fromUtf8("ClosetoTray"), false).toBool())
RshareSettings settings;
if(!settings.value(QString::fromUtf8("ClosetoTray"), false).toBool())
{
if (trayIcon->isVisible()) {
if (firstTime)

View File

@ -205,9 +205,6 @@ private:
/** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */
BandwidthGraph* _bandwidthGraph;
/** A RetroShareSettings object used for saving/loading settings */
RshareSettings* _settings;
/** Creates a new action for a Main page. */
QAction* createPageAction(QIcon img, QString text, QActionGroup *group);
/** Adds a new action to the toolbar. */

View File

@ -72,9 +72,6 @@ MessagesDialog::MessagesDialog(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect( ui.messagestreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messageslistWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.msgList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgfilelistWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.messagestreeView, SIGNAL(clicked ( const QModelIndex &) ) , this, SLOT( clicked( const QModelIndex & ) ) );
@ -1252,7 +1249,9 @@ void MessagesDialog::setCurrentFileName(const QString &fileName)
void MessagesDialog::buttonsicononly()
{
_settings->beginGroup("MessageDialog");
RshareSettings settings;
settings.beginGroup("MessageDialog");
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
ui.removemessageButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
@ -1262,20 +1261,22 @@ void MessagesDialog::buttonsicononly()
ui.printbutton->setToolButtonStyle(Qt::ToolButtonIconOnly);
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
_settings->setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
settings.setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
_settings->endGroup();
settings.endGroup();
}
void MessagesDialog::buttonstextbesideicon()
{
_settings->beginGroup("MessageDialog");
RshareSettings settings;
settings.beginGroup("MessageDialog");
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui.removemessageButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@ -1285,21 +1286,23 @@ void MessagesDialog::buttonstextbesideicon()
ui.printbutton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
_settings->setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
settings.setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
_settings->endGroup();
settings.endGroup();
}
void MessagesDialog::buttonstextundericon()
{
_settings->beginGroup("MessageDialog");
RshareSettings settings;
settings.beginGroup("MessageDialog");
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
ui.removemessageButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
@ -1309,22 +1312,24 @@ void MessagesDialog::buttonstextundericon()
ui.printbutton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
_settings->setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
_settings->setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye1",ui.newmessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye2",ui.removemessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye3",ui.replymessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye4",ui.replyallmessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye5",ui.forwardmessageButton->toolButtonStyle());
settings.setValue("ToolButon_Stlye6",ui.printbutton->toolButtonStyle());
settings.setValue("ToolButon_Stlye7",ui.viewtoolButton->toolButtonStyle());
_settings->endGroup();
settings.endGroup();
}
void MessagesDialog::loadToolButtonsettings()
{
_settings->beginGroup("MessageDialog");
RshareSettings settings;
if(_settings->value("ToolButon_Stlye1","0").toInt() == 0)
settings.beginGroup("MessageDialog");
if(settings.value("ToolButon_Stlye1","0").toInt() == 0)
{
qDebug() << "ToolButon IconOnly";
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
@ -1336,7 +1341,7 @@ void MessagesDialog::loadToolButtonsettings()
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
}
else if (_settings->value("ToolButon_Stlye1","2").toInt() ==2)
else if (settings.value("ToolButon_Stlye1","2").toInt() ==2)
{
qDebug() << "ToolButon TextBesideIcon";
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
@ -1348,7 +1353,7 @@ void MessagesDialog::loadToolButtonsettings()
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
}
else if(_settings->value("ToolButon_Stlye1","3").toInt() ==3)
else if(settings.value("ToolButon_Stlye1","3").toInt() ==3)
{
qDebug() << "ToolButton TextUnderIcon";
ui.newmessageButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
@ -1360,7 +1365,7 @@ void MessagesDialog::loadToolButtonsettings()
ui.viewtoolButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
}
_settings->endGroup();
settings.endGroup();
}
void MessagesDialog::filterRegExpChanged()

View File

@ -22,7 +22,6 @@
#ifndef _MESSAGESDIALOG_H
#define _MESSAGESDIALOG_H
#include "settings/rsharesettings.h"
#include <list>
#include <QFileDialog>
#include <QModelIndex>
@ -99,9 +98,6 @@ private slots:
void toggleclearButton();
private:
/** A RetroShare Settings object used for saving/loading settings */
RshareSettings *_settings;
class QStandardItemModel *MessagesModel;
QSortFilterProxyModel *proxyModel;

View File

@ -39,6 +39,7 @@
#include "util/PixmapMerging.h"
#include "LogoBar.h"
#include "util/Widget.h"
#include "settings/rsharesettings.h"
#include "gui/connect/ConnectFriendWizard.h"
@ -102,9 +103,6 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect( ui.messengertreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( messengertreeWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.messengertreeWidget, SIGNAL(itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(chatfriend()));
@ -921,14 +919,14 @@ void MessengerWindow::loadmystatusmessage()
/** Save own status message */
void MessengerWindow::savestatusmessage()
{
_settings->beginGroup("Profile");
RshareSettings settings;
settings.beginGroup("Profile");
_settings->setValue("StatusMessage",ui.messagelineEdit->text());
settings.setValue("StatusMessage",ui.messagelineEdit->text());
_settings->endGroup();
settings.endGroup();
rsMsgs->setCustomStateString(ui.messagelineEdit->text().toStdString());
rsMsgs->setCustomStateString(ui.messagelineEdit->text().toStdString());
}
void MessengerWindow::on_actionSort_Peers_Descending_Order_activated()

View File

@ -26,7 +26,6 @@
#include "mainpage.h"
#include "ui_MessengerWindow.h"
#include <gui/settings/rsharesettings.h>
#include <gui/common/rwindow.h>
#include "chat/PopupChatDialog.h"
#include "RsAutoUpdatePage.h"
@ -66,7 +65,6 @@ protected:
void closeEvent (QCloseEvent * event);
/** Default Constructor */
MessengerWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
private slots:
@ -151,9 +149,6 @@ private:
QFont itemFont;
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::MessengerWindow ui;
};

View File

@ -33,6 +33,7 @@
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include "rsiface/rsdisc.h"
#include "settings/rsharesettings.h"
#include <algorithm>
/* for GPGME */
@ -80,9 +81,6 @@ NetworkDialog::NetworkDialog(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect( ui.connecttreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connecttreeWidgetCostumPopupMenu( QPoint ) ) );
connect( ui.connecttreeWidget, SIGNAL( itemSelectionChanged()), ui.unvalidGPGkeyWidget, SLOT( clearSelection() ) );
connect( ui.unvalidGPGkeyWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connecttreeWidgetCostumPopupMenu( QPoint ) ) );
@ -813,42 +811,46 @@ void NetworkDialog::updateNetworkStatus()
void NetworkDialog::on_actionTabsnorth_activated()
{
_settings->beginGroup("NetworkDialog");
RshareSettings settings;
settings.beginGroup("NetworkDialog");
ui.networkTab->setTabPosition(QTabWidget::North);
_settings->setValue("TabWidget_Position",ui.networkTab->tabPosition());
_settings->endGroup();
settings.setValue("TabWidget_Position",ui.networkTab->tabPosition());
settings.endGroup();
}
void NetworkDialog::on_actionTabssouth_activated()
{
_settings->beginGroup("NetworkDialog");
RshareSettings settings;
settings.beginGroup("NetworkDialog");
ui.networkTab->setTabPosition(QTabWidget::South);
_settings->setValue("TabWidget_Position",ui.networkTab->tabPosition());
_settings->endGroup();
settings.setValue("TabWidget_Position",ui.networkTab->tabPosition());
settings.endGroup();
}
void NetworkDialog::on_actionTabswest_activated()
{
_settings->beginGroup("NetworkDialog");
RshareSettings settings;
settings.beginGroup("NetworkDialog");
ui.networkTab->setTabPosition(QTabWidget::West);
_settings->setValue("TabWidget_Position",ui.networkTab->tabPosition());
_settings->endGroup();
settings.setValue("TabWidget_Position",ui.networkTab->tabPosition());
settings.endGroup();
}
void NetworkDialog::on_actionTabsright_activated()
{
_settings->beginGroup("NetworkDialog");
RshareSettings settings;
settings.beginGroup("NetworkDialog");
ui.networkTab->setTabPosition(QTabWidget::East);
_settings->setValue("TabWidget_Position",ui.networkTab->tabPosition());
_settings->endGroup();
settings.setValue("TabWidget_Position",ui.networkTab->tabPosition());
settings.endGroup();
}
void NetworkDialog::on_actionTabsTriangular_activated()
@ -865,31 +867,29 @@ void NetworkDialog::on_actionTabsRounded_activated()
void NetworkDialog::loadtabsettings()
{
_settings->beginGroup("NetworkDialog");
RshareSettings settings;
settings.beginGroup("NetworkDialog");
if(_settings->value("TabWidget_Position","0").toInt() == 0)
{
qDebug() << "Tab North";
ui.networkTab->setTabPosition(QTabWidget::North);
}
if(settings.value("TabWidget_Position","0").toInt() == 0)
{
qDebug() << "Tab North";
ui.networkTab->setTabPosition(QTabWidget::North);
}
else if (settings.value("TabWidget_Position","1").toInt() == 1)
{
qDebug() << "Tab South";
ui.networkTab->setTabPosition(QTabWidget::South);
}
else if (settings.value("TabWidget_Position","2").toInt() ==2)
{
qDebug() << "Tab West";
ui.networkTab->setTabPosition(QTabWidget::West);
}
else if(settings.value("TabWidget_Position","3").toInt() ==3)
{
qDebug() << "Tab East";
ui.networkTab->setTabPosition(QTabWidget::East);
}
else if (_settings->value("TabWidget_Position","1").toInt() == 1)
{
qDebug() << "Tab South";
ui.networkTab->setTabPosition(QTabWidget::South);
}
else if (_settings->value("TabWidget_Position","2").toInt() ==2)
{
qDebug() << "Tab West";
ui.networkTab->setTabPosition(QTabWidget::West);
}
else if(_settings->value("TabWidget_Position","3").toInt() ==3)
{
qDebug() << "Tab East";
ui.networkTab->setTabPosition(QTabWidget::East);
}
_settings->endGroup();
settings.endGroup();
}

View File

@ -26,8 +26,6 @@
#include <QFileDialog>
#include <QtGui>
#include "settings/rsharesettings.h"
#include "mainpage.h"
#include "ui_NetworkDialog.h"
#include "RsAutoUpdatePage.h"
@ -42,7 +40,6 @@ class NetworkDialog : public RsAutoUpdatePage
public:
/** Default Constructor */
NetworkDialog(QWidget *parent = 0);
/** Default Destructor */
//void load();
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage
@ -95,9 +92,6 @@ private slots:
private:
/** A RetroShare Settings object used for saving/loading settings */
RshareSettings *_settings;
QTreeWidgetItem *getCurrentNeighbour();
/** Define the popup menus for the Context menu */

View File

@ -32,6 +32,7 @@
#include "rsiface/rsstatus.h"
#include "rsiface/rsmsgs.h"
#include "rsiface/rsnotify.h"
#include "settings/rsharesettings.h"
#include "chat/PopupChatDialog.h"
#include "msgs/ChanMsgDialog.h"
@ -100,9 +101,6 @@ PeersDialog::PeersDialog(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
last_status_send_time = 0 ;
@ -176,8 +174,9 @@ PeersDialog::PeersDialog(QWidget *parent)
QString::fromUtf8("blue"));
QStringList him;
if (_settings->value(QString::fromUtf8("GroupChat_History"), true).toBool())
RshareSettings settings;
if (settings.value(QString::fromUtf8("GroupChat_History"), true).toBool())
{
historyKeeper.getMessages(him, "", "THIS", 8);
foreach(QString mess, him)
@ -231,6 +230,16 @@ PeersDialog::PeersDialog(QWidget *parent)
#endif
}
PeersDialog::~PeersDialog ()
{
std::map<std::string, PopupChatDialog *>::iterator it;
for (it = chatDialogs.begin(); it != chatDialogs.end(); it++) {
if (it->second) {
delete (it->second);
}
}
}
void PeersDialog::pasteLink()
{
ui.lineEdit->insertHtml(RSLinkClipboard::toHtml()) ;
@ -1025,7 +1034,7 @@ void PeersDialog::insertChat()
count ++;
}
if (_settings->value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool())
if (settings.value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool())
{
QHashIterator<QString, QString> i(smileys);
while(i.hasNext())
@ -1849,16 +1858,16 @@ void PeersDialog::setCurrentFileName(const QString &fileName)
////play sound when recv a message
void PeersDialog::playsound(){
_settings = new RshareSettings();
_settings->beginGroup("Sound");
_settings->beginGroup("SoundFilePath");
QString OnlineSound= _settings->value("NewChatMessage","").toString();
_settings->endGroup();
_settings->beginGroup("Enable");
bool flag= _settings->value("NewChatMessage",false).toBool();
_settings->endGroup();
_settings->endGroup();
RshareSettings settings;
settings.beginGroup("Sound");
settings.beginGroup("SoundFilePath");
QString OnlineSound= settings.value("NewChatMessage","").toString();
settings.endGroup();
settings.beginGroup("Enable");
bool flag= settings.value("NewChatMessage",false).toBool();
settings.endGroup();
settings.endGroup();
if(!OnlineSound.isEmpty()&&flag)
if(QSound::isAvailable())
QSound::play(OnlineSound);
QSound::play(OnlineSound);
}

View File

@ -46,6 +46,7 @@ public:
/** Default Constructor */
PeersDialog(QWidget *parent = 0);
/** Default Destructor */
~PeersDialog ();
PopupChatDialog *getPrivateChat(std::string id, std::string name, uint chatflags);
void clearOldChats();
@ -193,9 +194,6 @@ private:
QFont mCurrentFont; /* how the text will come out */
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::PeersDialog ui;
};

View File

@ -31,6 +31,7 @@
#include "rsiface/rsfiles.h"
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include "settings/rsharesettings.h"
QuickStartWizard::QuickStartWizard(QWidget *parent) :
@ -40,9 +41,6 @@ QuickStartWizard::QuickStartWizard(QWidget *parent) :
ui.pagesWizard->setCurrentIndex(0);
/* Create RshareSettings object */
_settings = new RshareSettings();
loadNetwork();
loadShare();
loadGeneral();
@ -72,7 +70,6 @@ QuickStartWizard::QuickStartWizard(QWidget *parent) :
QuickStartWizard::~QuickStartWizard()
{
//delete ui;
}
void QuickStartWizard::changeEvent(QEvent *e)
@ -173,12 +170,12 @@ void QuickStartWizard::on_pushButtonSystemBack_clicked()
void QuickStartWizard::on_pushButtonSystemFinish_clicked()
{
_settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized());
RshareSettings settings;
settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
_settings->setValue(QString::fromUtf8("doQuit"), quitbox());
settings.setValue(QString::fromUtf8("doQuit"), quitbox());
_settings->setRunRetroshareOnBoot(ui.checkBoxRunRetroshareAtSystemStartup->isChecked());
settings.setRunRetroshareOnBoot(ui.checkBoxRunRetroshareAtSystemStartup->isChecked());
saveChanges();
@ -359,13 +356,14 @@ bool QuickStartWizard::messageBoxOk(QString msg)
void
QuickStartWizard::loadGeneral()
{
ui.checkBoxRunRetroshareAtSystemStartup->setChecked(_settings->runRetroshareOnBoot());
RshareSettings settings;
ui.checkBoxRunRetroshareAtSystemStartup->setChecked(settings.runRetroshareOnBoot());
ui.checkBoxStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool());
ui.checkBoxStartMinimized->setChecked(settings.value(QString::fromUtf8("StartMinimized"), false).toBool());
ui.checkBoxQuit->setChecked(_settings->value(QString::fromUtf8("doQuit"), false).toBool());
ui.checkBoxQuit->setChecked(settings.value(QString::fromUtf8("doQuit"), false).toBool());
//ui.checkBoxQuickWizard->setChecked(_settings->value(QString::fromUtf8("FirstRun"), false).toBool());
//ui.checkBoxQuickWizard->setChecked(settings.value(QString::fromUtf8("FirstRun"), false).toBool());
}
bool QuickStartWizard::quitbox() const {

View File

@ -25,7 +25,6 @@
#include <QtGui/QDialog>
#include <QtGui/QWizard>
#include "settings/rsharesettings.h"
#include "ui_QuickStartWizard.h"
@ -54,9 +53,6 @@ private:
Ui::QuickStartWizard ui;
bool messageBoxOk(QString);
/** A RetroShare Settings object used for saving/loading settings */
RshareSettings *_settings;
private Q_SLOTS:
void on_pushButtonSharesRemove_clicked();

View File

@ -33,6 +33,7 @@
#include "rsiface/rspeers.h"
#include "rsiface/rsturtle.h"
#include "util/misc.h"
#include "settings/rsharesettings.h"
#include <iostream>
#include <sstream>

View File

@ -27,13 +27,10 @@
#include <QMessageBox>
#include <QModelIndex>
//#include <config/rsharesettings.h>
#include <rsiface/rsfiles.h>
#include "mainpage.h"
#include "ui_SearchDialog.h"
#include "advsearch/advancedsearchdialog.h"
#include "settings/rsharesettings.h"
#define FRIEND_SEARCH 1
#define ANONYMOUS_SEARCH 2

View File

@ -25,8 +25,6 @@
#include <QDialog>
#include <gui/settings/rsharesettings.h>
#include "ui_SendLinkDialog.h"
class SendLinkDialog : public QDialog
@ -50,10 +48,6 @@ private slots:
private:
/** A RshareSettings object used for saving/loading settings */
//RshareSettings* _settings;
/** Qt Designer generated object */
Ui::SendLinkDialog ui;

View File

@ -787,15 +787,15 @@ SharedFilesDialog::tryToAddNewAssotiation()
if (ti==QDialog::Accepted)
{
RshareSettings* settings = new RshareSettings();
RshareSettings settings;
//QSettings settings( qApp->applicationDirPath()+"/sett.ini",
// QSettings::IniFormat);
settings->beginGroup("FileAssotiations");
settings.beginGroup("FileAssotiations");
QString currType = afad.resultFileType() ;
QString currCmd = afad.resultCommand() ;
settings->setValue(currType, currCmd);
settings.setValue(currType, currCmd);
}
}

View File

@ -25,8 +25,6 @@
#include <QFileDialog>
#include <QMovie>
//#include <config/rsharesettings.h>
#include "RsAutoUpdatePage.h"
#include "ui_SharedFilesDialog.h"

View File

@ -19,12 +19,10 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "SoundManager.h"
#include "settings/rsharesettings.h"
SoundManager::SoundManager()
{
/* Create RshareSettings object */
_settings = new RshareSettings();
isMute=false;
reInit();
}
@ -80,25 +78,26 @@ void SoundManager::event_NewChatMessage()
void SoundManager::reInit()
{
_settings->beginGroup("Sound");
_settings->beginGroup("Enable");
enable_eventUser_go_Online = _settings->value("User_go_Online",false).toBool();
enable_eventUser_go_Offline = _settings->value("User_go_Offline",false).toBool();
enable_eventFileSend_Finished = _settings->value("FileSend_Finished",false).toBool();
enable_eventFileRecive_Incoming = _settings->value("FileRecive_Incoming",false).toBool();
enable_eventFileRecive_Finished = _settings->value("FileRecive_Finished",false).toBool();
enable_eventNewChatMessage = _settings->value("NewChatMessage",false).toBool();
_settings->endGroup();
RshareSettings settings;
_settings->beginGroup("SoundFilePath");
SoundFileUser_go_Online = _settings->value("User_go_Online","").toString();
SoundFileUser_go_Offline =_settings->value("User_go_Offline","").toString();
SoundFileFileSend_Finished = _settings->value("FileSend_Finished","").toString();
SoundFileFileRecive_Incoming = _settings->value("FileRecive_Incoming","").toString();
SoundFileFileRecive_Finished = _settings->value("FileRecive_Finished","").toString();
SoundFileNewChatMessage = _settings->value("NewChatMessage","").toString();
_settings->endGroup();
_settings->endGroup();
delete _settings;
settings.beginGroup("Sound");
settings.beginGroup("Enable");
enable_eventUser_go_Online = settings.value("User_go_Online",false).toBool();
enable_eventUser_go_Offline = settings.value("User_go_Offline",false).toBool();
enable_eventFileSend_Finished = settings.value("FileSend_Finished",false).toBool();
enable_eventFileRecive_Incoming = settings.value("FileRecive_Incoming",false).toBool();
enable_eventFileRecive_Finished = settings.value("FileRecive_Finished",false).toBool();
enable_eventNewChatMessage = settings.value("NewChatMessage",false).toBool();
settings.endGroup();
settings.beginGroup("SoundFilePath");
SoundFileUser_go_Online = settings.value("User_go_Online","").toString();
SoundFileUser_go_Offline =settings.value("User_go_Offline","").toString();
SoundFileFileSend_Finished = settings.value("FileSend_Finished","").toString();
SoundFileFileRecive_Incoming = settings.value("FileRecive_Incoming","").toString();
SoundFileFileRecive_Finished = settings.value("FileRecive_Finished","").toString();
SoundFileNewChatMessage = settings.value("NewChatMessage","").toString();
settings.endGroup();
settings.endGroup();
}

View File

@ -25,9 +25,6 @@
#include <QSettings>
#include <QtGui>
#include "settings/rsharesettings.h"
class SoundManager :public QObject
{
Q_OBJECT
@ -60,8 +57,6 @@ class SoundManager :public QObject
bool enable_eventFileRecive_Incoming;
bool enable_eventFileRecive_Finished;
bool enable_eventNewChatMessage;
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
};
#endif

View File

@ -27,6 +27,7 @@
#include <QFileDialog>
#include <QMessageBox>
#include "util/Widget.h"
#include "settings/rsharesettings.h"
/* Define the format used for displaying the date and time */
#define DATETIME_FMT "MMM dd hh:mm:ss"
@ -40,17 +41,15 @@ StartDialog::StartDialog(QWidget *parent, Qt::WFlags flags)
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
RshareSettings config;
config.loadWidgetInformation(this);
/* Create Bandwidth Graph related QObjects */
RshareSettings settings;
settings.loadWidgetInformation(this);
_rsLogoBar = NULL;
//LogoBar
_rsLogoBar = new LogoBar(ui.callBarFrame);
Widget::createLayout(ui.callBarFrame)->addWidget(_rsLogoBar);
/* Create Bandwidth Graph related QObjects */
_settings = new RshareSettings();
ui.loadButton->setFocus();
@ -110,8 +109,8 @@ void StartDialog::show()
void StartDialog::closeEvent (QCloseEvent * event)
{
RshareSettings config;
config.saveWidgetInformation(this);
RshareSettings settings;
settings.saveWidgetInformation(this);
QWidget::closeEvent(event);
}

View File

@ -23,7 +23,6 @@
#ifndef _STARTDIALOG_H
#define _STARTDIALOG_H
#include "settings/rsharesettings.h"
#include "rsiface/rsiface.h"
/********
#if (QT_VERSION >= 040300)
@ -42,8 +41,6 @@ class StartDialog : public QMainWindow
public:
/** Default constructor */
StartDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default destructor */
//~StartDialog();
bool requestedNewCert();
@ -74,10 +71,6 @@ private:
/** Loads the saved connectidialog settings */
// void loadSettings();
void loadCertificates();
/** A VidaliaSettings object that handles getting/saving settings */
RshareSettings* _settings;
LogoBar * _rsLogoBar;

View File

@ -28,7 +28,6 @@
#include <QEvent>
#include <QTimer>
#include <gui/settings/rsharesettings.h>
#include <gui/common/rwindow.h>
#include "ui_bwgraph.h"
@ -77,11 +76,6 @@ private:
/** Loads the saved Bandwidth Graph settings */
void loadSettings();
/** A TorControl object used to talk to Tor. */
// TorControl* _torControl;
/** A VidaliaSettings object that handles getting/saving settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::BandwidthGraph ui;
};

View File

@ -41,6 +41,7 @@
#include "rsiface/rspeers.h"
#include "rsiface/rsmsgs.h"
#include "rsiface/rsfiles.h"
#include "gui/settings/rsharesettings.h"
#include "gui/feeds/AttachFileItem.h"
@ -67,11 +68,9 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
RshareSettings settings;
RshareSettings config;
config.loadWidgetInformation(this);
settings.loadWidgetInformation(this);
this->move(qrand()%100, qrand()%100); //avoid to stack multiple popup chat windows on the same position
@ -201,7 +200,6 @@ void PopupChatDialog::updateStatusString(const QString& status_string)
/** Destructor. */
PopupChatDialog::~PopupChatDialog()
{
}
/**
@ -244,8 +242,8 @@ void PopupChatDialog::flash()
void PopupChatDialog::closeEvent (QCloseEvent * event)
{
RshareSettings config;
config.saveWidgetInformation(this);
RshareSettings settings;
settings.saveWidgetInformation(this);
hide();
event->ignore();
@ -306,7 +304,8 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() << std::endl;
#endif
if (_settings->value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool())
RshareSettings settings;
if (settings.value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool())
{
QHashIterator<QString, QString> i(smileys);
while(i.hasNext())

View File

@ -27,7 +27,6 @@
#include <QDialog>
#include "ui_PopupChatDialog.h"
#include <gui/settings/rsharesettings.h>
#include "rsiface/rsiface.h"
#include "gui/feeds/AttachFileItem.h"
@ -136,9 +135,6 @@ private:
QString wholeChat;
QString fileName;
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::PopupChatDialog ui;

View File

@ -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

View File

@ -68,7 +68,6 @@ signals:
private:
QString _name; /**< Name associated with this window. */
RSettings* _settings; /**< Object used to store window properties */
};
#endif

View File

@ -35,9 +35,6 @@ ConnectDialog::ConnectDialog(QWidget *parent, Qt::WFlags flags)
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
/* Create Bandwidth Graph related QObjects */
_settings = new RshareSettings();
// Create the status bar
statusBar()->showMessage("Peer Informations");
@ -53,7 +50,6 @@ ConnectDialog::ConnectDialog(QWidget *parent, Qt::WFlags flags)
/** Destructor. */
ConnectDialog::~ConnectDialog()
{
delete _settings;
}
/**

View File

@ -23,8 +23,6 @@
#ifndef _CONNECTDIALOG_H
#define _CONNECTDIALOG_H
#include <gui/settings/rsharesettings.h>
#include "ui_ConnectDialog.h"
@ -69,9 +67,6 @@ void setAuthCode(std::string id, std::string code);
std::string authCode;
std::string authId;
/** A VidaliaSettings object that handles getting/saving settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::ConnectDialog ui;
};

View File

@ -1,7 +1,7 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
@ -30,6 +30,7 @@
#include <QDir>
#include <rshare.h>
#include "gui/MainWindow.h"
#include "gui/settings/rsharesettings.h"
#include "helpbrowser.h"

View File

@ -24,6 +24,7 @@
#include "rsiface/rspeers.h"
#include "rsiface/rsdisc.h"
#include "rsiface/rsmsgs.h"
#include "gui/settings/rsharesettings.h"
#include <QTime>
@ -39,9 +40,6 @@ StatusMessage::StatusMessage(QWidget *parent, Qt::WFlags flags)
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(close()));
connect(ui.okButton, SIGNAL(clicked()), this, SLOT(save()));
@ -52,8 +50,6 @@ StatusMessage::StatusMessage(QWidget *parent, Qt::WFlags flags)
/** Destructor. */
StatusMessage::~StatusMessage()
{
delete _settings;
}
void StatusMessage::closeEvent (QCloseEvent * event)
@ -65,11 +61,12 @@ void StatusMessage::closeEvent (QCloseEvent * event)
/** Saves the changes on this page */
void StatusMessage::save()
{
_settings->beginGroup("Profile");
RshareSettings settings;
settings.beginGroup("Profile");
_settings->setValue("StatusMessage",ui.txt_StatusMessage->text());
settings.setValue("StatusMessage",ui.txt_StatusMessage->text());
_settings->endGroup();
settings.endGroup();
rsMsgs->setCustomStateString(ui.txt_StatusMessage->text().toStdString());

View File

@ -25,8 +25,6 @@
#include <QDialog>
#include <gui/settings/rsharesettings.h>
#include "ui_StatusMessage.h"
class StatusMessage : public QDialog
@ -51,10 +49,6 @@ private slots:
private:
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::StatusMessage ui;

View File

@ -22,6 +22,7 @@
#include <rshare.h>
#include "AppearancePage.h"
#include "rsharesettings.h"
/** Constructor */
@ -31,9 +32,6 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect(ui.styleSheetCombo, SIGNAL(clicked()), this, SLOT(loadStyleSheet()));
/* Populate combo boxes */
@ -61,7 +59,6 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WFlags flags)
AppearancePage::~AppearancePage()
{
delete _settings;
}
/** Saves the changes on this page */
@ -72,9 +69,10 @@ AppearancePage::save(QString &errmsg)
QString languageCode =
LanguageSupport::languageCode(ui.cmboLanguage->currentText());
_settings->setLanguageCode(languageCode);
_settings->setInterfaceStyle(ui.cmboStyle->currentText());
_settings->setSheetName(ui.styleSheetCombo->currentText());
RshareSettings settings;
settings.setLanguageCode(languageCode);
settings.setInterfaceStyle(ui.cmboStyle->currentText());
settings.setSheetName(ui.styleSheetCombo->currentText());
/* Set to new style */
Rshare::setStyle(ui.cmboStyle->currentText());
@ -87,20 +85,21 @@ AppearancePage::save(QString &errmsg)
void
AppearancePage::load()
{
RshareSettings settings;
int index = ui.cmboLanguage->findData(_settings->getLanguageCode());
int index = ui.cmboLanguage->findData(settings.getLanguageCode());
ui.cmboLanguage->setCurrentIndex(index);
index = ui.cmboStyle->findData(Rshare::style().toLower());
ui.cmboStyle->setCurrentIndex(index);
ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText(_settings->getSheetName()));
ui.styleSheetCombo->setCurrentIndex(ui.styleSheetCombo->findText(settings.getSheetName()));
/** load saved internal styleSheet **/
//QFile file(":/qss/" + (_settings->getSheetName().toLower()) + ".qss");
//QFile file(":/qss/" + (settings.getSheetName().toLower()) + ".qss");
/** load saved extern Stylesheets **/
QFile file(QApplication::applicationDirPath() + "/qss/" + (_settings->getSheetName().toLower()) + ".qss");
QFile file(QApplication::applicationDirPath() + "/qss/" + (settings.getSheetName().toLower()) + ".qss");
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());

View File

@ -26,7 +26,6 @@
#include <QStyleFactory>
#include <QtGui>
#include "rsharesettings.h"
#include <lang/languagesupport.h>
#include "configpage.h"
@ -53,9 +52,6 @@ class AppearancePage : public ConfigPage
private:
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
void loadStyleSheet(const QString &sheetName);
void loadqss();

View File

@ -21,6 +21,7 @@
#include "rsiface/rspeers.h" //for rsPeers variable
#include "rsiface/rsiface.h"
#include "rsharesettings.h"
#include <QtGui>
#include <QClipboard>
@ -39,9 +40,6 @@ ChatPage::ChatPage(QWidget * parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
//connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
//connect(ui.saveButton, SIGNAL(clicked()), this, SLOT(fileSaveAs()));
@ -66,11 +64,12 @@ ChatPage::closeEvent (QCloseEvent * event)
bool
ChatPage::save(QString &errmsg)
{
_settings->setValue(QString::fromUtf8("Emoteicons_PrivatChat"), emotePrivatChat());
RshareSettings settings;
settings.setValue(QString::fromUtf8("Emoteicons_PrivatChat"), emotePrivatChat());
_settings->setValue(QString::fromUtf8("Emoteicons_GroupChat"), emoteGroupChat());
settings.setValue(QString::fromUtf8("Emoteicons_GroupChat"), emoteGroupChat());
_settings->setValue(QString::fromUtf8("GroupChat_History"), groupchatHistory());
settings.setValue(QString::fromUtf8("GroupChat_History"), groupchatHistory());
return true;
}
@ -79,12 +78,13 @@ ChatPage::save(QString &errmsg)
void
ChatPage::load()
{
RshareSettings settings;
ui.checkBox_emoteprivchat->setChecked(_settings->value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool());
ui.checkBox_emoteprivchat->setChecked(settings.value(QString::fromUtf8("Emoteicons_PrivatChat"), true).toBool());
ui.checkBox_emotegroupchat->setChecked(_settings->value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool());
ui.checkBox_emotegroupchat->setChecked(settings.value(QString::fromUtf8("Emoteicons_GroupChat"), true).toBool());
ui.checkBox_groupchathistory->setChecked(_settings->value(QString::fromUtf8("GroupChat_History"), true).toBool());
ui.checkBox_groupchathistory->setChecked(settings.value(QString::fromUtf8("GroupChat_History"), true).toBool());
}

View File

@ -25,8 +25,6 @@
#include <QFileDialog>
#include <QtGui/QWidget>
#include "rsharesettings.h"
#include "configpage.h"
#include "ui_ChatPage.h"
@ -53,9 +51,6 @@ class ChatPage : public ConfigPage
private:
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
void closeEvent (QCloseEvent * event);

View File

@ -39,9 +39,6 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
connect(ui.saveButton, SIGNAL(clicked()), this, SLOT(fileSaveAs()));
@ -57,7 +54,6 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
CryptoPage::~CryptoPage()
{
delete _settings;
}
void

View File

@ -25,7 +25,6 @@
#include <QFileDialog>
#include <QtGui/QWidget>
#include "rsharesettings.h"
#include "gui/connect/ConnectFriendWizard.h"
#include "configpage.h"
@ -58,9 +57,6 @@ class CryptoPage : public ConfigPage
private:
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
void closeEvent (QCloseEvent * event);
void setCurrentFileName(const QString &fileName);

View File

@ -116,10 +116,10 @@ FileAssociationsPage::FileAssociationsPage(QWidget * parent, Qt::WFlags flags)
// connect( addNewAssotiationButton, SIGNAL( clicked() ),
// this, SLOT( testButtonClicked() ) );
settings = new RshareSettings();
// RshareSettings settings;
//new QSettings( qApp->applicationDirPath()+"/sett.ini",
// QSettings::IniFormat);
settings->beginGroup("FileAssociations");
// settings.beginGroup("FileAssociations");
@ -129,7 +129,6 @@ FileAssociationsPage::FileAssociationsPage(QWidget * parent, Qt::WFlags flags)
FileAssociationsPage::~FileAssociationsPage()
{
delete settings ;
}
//============================================================================
@ -137,25 +136,25 @@ FileAssociationsPage::~FileAssociationsPage()
bool
FileAssociationsPage::save (QString &errmsg)
{
//RshareSettings* settings = new RshareSettings();
// RshareSettings settings;
// settings->beginGroup("FileAssotiations");
// settings->setValue(".s01", "s01 test");
// settings->setValue(".s02", "s02 test");
// settings->setValue(".s03", "s03 test");
// settings->setValue(".s04", "s04 test");
// settings.beginGroup("FileAssotiations");
// settings.setValue(".s01", "s01 test");
// settings.setValue(".s02", "s02 test");
// settings.setValue(".s03", "s03 test");
// settings.setValue(".s04", "s04 test");
// QMap<QString, QString>::const_iterator ati = ations.constBegin();
// while (ati != ations.constEnd())
// {
// settings->setValue( ati.key(), ati.value() );
// settings.setValue( ati.key(), ati.value() );
// qDebug() << " - " << ati.key() << ati.value() << "\n" ;
// ati++;
// }
//
// settings->endGroup();
// settings.endGroup();
settings->sync();
// settings.sync();
// delete settings;
/* */
@ -167,12 +166,12 @@ FileAssociationsPage::save (QString &errmsg)
void
FileAssociationsPage::load()
{
//RshareSettings* settings = new RshareSettings();
RshareSettings settings;
// QSettings* settings = new QSettings( qApp->applicationDirPath()+"/sett.ini",
// QSettings::IniFormat);
//
// settings->beginGroup("FileAssotiations");
QStringList keys = settings->allKeys();
// settings.beginGroup("FileAssotiations");
QStringList keys = settings.allKeys();
table->setRowCount( keys.count() );
@ -180,7 +179,7 @@ FileAssociationsPage::load()
QStringList::const_iterator ki;
for(ki=keys.constBegin(); ki!=keys.constEnd(); ki++)
{
QString val = (settings->value(*ki, "")).toString();
QString val = (settings.value(*ki, "")).toString();
addNewItemToTable( rowi, 0, *ki );
addNewItemToTable( rowi, 1, val );
@ -207,7 +206,8 @@ FileAssociationsPage::remove()
QTableWidgetItem const * titem = table->item( currentRow,0);
QString key = (titem->data(QTableWidgetItem::Type)).toString();
settings->remove(key);
RshareSettings settings;
settings.remove(key);
table->removeRow( currentRow );
if ( table->rowCount()==0 )
@ -235,7 +235,8 @@ FileAssociationsPage::addnew()
QString currCmd = afad.resultCommand() ;
if ( !settings->contains(currType) )//new item should be added only if
RshareSettings settings;
if ( !settings.contains(currType) )//new item should be added only if
{ // it wasn't entered before.
int nridx = table->rowCount();//new row index
table->setRowCount(nridx+1);
@ -256,7 +257,7 @@ FileAssociationsPage::addnew()
}
}
settings->setValue(currType, currCmd);
settings.setValue(currType, currCmd);
removeAction->setEnabled(true);
editAction->setEnabled(true);
@ -289,7 +290,8 @@ FileAssociationsPage::edit()
titem->setData(QTableWidgetItem::Type, currCmd);
settings->setValue(currType, currCmd);
RshareSettings settings;
settings.setValue(currType, currCmd);
}
}

View File

@ -44,7 +44,6 @@ class QLabel;
class QLineEdit;
//class QSettings;
class RshareSettings;
//=============================================================================
//! Dialog for setting file assotiations for RS
@ -74,9 +73,6 @@ protected:
QPushButton* addNewAssotiationButton;
QString settingsFileName;
RshareSettings* settings;
// QSettings* settings;
void addNewItemToTable(int row, int column, QString itemText);
protected slots:

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(){

View File

@ -27,7 +27,6 @@
#include <QFileDialog>
#include <QLineEdit>
#include "rsharesettings.h"
#include "rsiface/rsiface.h"
#include "configpage.h"
@ -64,11 +63,6 @@ private slots:
void setAutoLogin();
private:
/** A RetroShare Settings object used for saving/loading settings */
RshareSettings *_settings;
/** Qt Designer generated object */
Ui::GeneralPage ui;
};

View File

@ -26,6 +26,7 @@
#include <sstream>
#include "rsiface/rsnotify.h"
#include "rsharesettings.h"
#include <QTimer>
@ -39,9 +40,6 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WFlags flags)
setAttribute(Qt::WA_QuitOnClose, false);
setWindowTitle(windowTitle() + QLatin1String(" - Notify"));
/* Create RshareSettings object */
_settings = new RshareSettings();
//load();
//QTimer *timer = new QTimer(this);
@ -57,7 +55,6 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WFlags flags)
NotifyPage::~NotifyPage()
{
delete _settings;
}
void
@ -111,9 +108,10 @@ NotifyPage::save(QString &errmsg)
if (ui.chat_Focus->isChecked())
chatflags |= RS_CHAT_FOCUS;
_settings->setNotifyFlags(notifyflags);
_settings->setNewsFeedFlags(newsflags);
_settings->setChatFlags(chatflags);
RshareSettings settings;
settings.setNotifyFlags(notifyflags);
settings.setNewsFeedFlags(newsflags);
settings.setChatFlags(chatflags);
load();
return true;
@ -124,10 +122,11 @@ NotifyPage::save(QString &errmsg)
void NotifyPage::load()
{
/* extract from rsNotify the flags */
RshareSettings settings;
uint notifyflags = _settings->getNotifyFlags();
uint newsflags = _settings->getNewsFeedFlags();
uint chatflags = _settings->getChatFlags();
uint notifyflags = settings.getNotifyFlags();
uint newsflags = settings.getNewsFeedFlags();
uint chatflags = settings.getChatFlags();
ui.popup_Connect->setChecked(notifyflags & RS_POPUP_CONNECT);
ui.popup_NewMsg->setChecked(notifyflags & RS_POPUP_MSG);

View File

@ -25,8 +25,6 @@
#include <QFileDialog>
#include <QtGui/QWidget>
#include "rsharesettings.h"
#include "configpage.h"
#include "ui_NotifyPage.h"
@ -54,9 +52,6 @@ class NotifyPage : public ConfigPage
void closeEvent (QCloseEvent * event);
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::NotifyPage ui;
};

View File

@ -22,6 +22,7 @@
#include <rshare.h>
#include "SoundPage.h"
#include "rsharesettings.h"
/** Constructor */
@ -31,9 +32,6 @@ SoundPage::SoundPage(QWidget * parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Create RshareSettings object */
_settings = new RshareSettings();
connect(ui.cmd_openFile, SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile()));
//connect(ui.cmd_openFile_2,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile2()));
connect(ui.cmd_openFile_3,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile3()));
@ -52,31 +50,31 @@ SoundPage::SoundPage(QWidget * parent, Qt::WFlags flags)
SoundPage::~SoundPage()
{
delete _settings;
}
/** Saves the changes on this page */
bool
SoundPage::save(QString &errmsg)
{
_settings->beginGroup("Sound");
_settings->beginGroup("Enable");
_settings->setValue("User_go_Online",ui.checkBoxSound->isChecked());
//_settings->setValue("User_go_Offline",ui.checkBoxSound_2->isChecked());
_settings->setValue("FileSend_Finished",ui.checkBoxSound_3->isChecked());
_settings->setValue("FileRecive_Incoming",ui.checkBoxSound_4->isChecked());
_settings->setValue("FileRecive_Finished",ui.checkBoxSound_5->isChecked());
_settings->setValue("NewChatMessage",ui.checkBoxSound_6->isChecked());
_settings->endGroup();
_settings->beginGroup("SoundFilePath");
_settings->setValue("User_go_Online",ui.txt_SoundFile->text());
//_settings->setValue("User_go_Offline",ui.txt_SoundFile2->text());
_settings->setValue("FileSend_Finished",ui.txt_SoundFile3->text());
_settings->setValue("FileRecive_Incoming",ui.txt_SoundFile4->text());
_settings->setValue("FileRecive_Finished",ui.txt_SoundFile5->text());
_settings->setValue("NewChatMessage",ui.txt_SoundFile6->text());
_settings->endGroup();
_settings->endGroup();
RshareSettings settings;
settings.beginGroup("Sound");
settings.beginGroup("Enable");
settings.setValue("User_go_Online",ui.checkBoxSound->isChecked());
//settings.setValue("User_go_Offline",ui.checkBoxSound_2->isChecked());
settings.setValue("FileSend_Finished",ui.checkBoxSound_3->isChecked());
settings.setValue("FileRecive_Incoming",ui.checkBoxSound_4->isChecked());
settings.setValue("FileRecive_Finished",ui.checkBoxSound_5->isChecked());
settings.setValue("NewChatMessage",ui.checkBoxSound_6->isChecked());
settings.endGroup();
settings.beginGroup("SoundFilePath");
settings.setValue("User_go_Online",ui.txt_SoundFile->text());
//settings.setValue("User_go_Offline",ui.txt_SoundFile2->text());
settings.setValue("FileSend_Finished",ui.txt_SoundFile3->text());
settings.setValue("FileRecive_Incoming",ui.txt_SoundFile4->text());
settings.setValue("FileRecive_Finished",ui.txt_SoundFile5->text());
settings.setValue("NewChatMessage",ui.txt_SoundFile6->text());
settings.endGroup();
settings.endGroup();
return true;
}
@ -87,14 +85,15 @@ SoundPage::save(QString &errmsg)
void
SoundPage::load()
{
_settings->beginGroup("Sound");
_settings->beginGroup("SoundFilePath");
ui.txt_SoundFile->setText(_settings->value("User_go_Online","").toString());
//ui.txt_SoundFile2->setText(_settings->value("User_go_Offline","").toString());
ui.txt_SoundFile3->setText(_settings->value("FileSend_Finished","").toString());
ui.txt_SoundFile4->setText(_settings->value("FileRecive_Incoming","").toString());
ui.txt_SoundFile5->setText(_settings->value("FileRecive_Finished","").toString());
ui.txt_SoundFile6->setText(_settings->value("NewChatMessage","").toString());
RshareSettings settings;
settings.beginGroup("Sound");
settings.beginGroup("SoundFilePath");
ui.txt_SoundFile->setText(settings.value("User_go_Online","").toString());
//ui.txt_SoundFile2->setText(settings.value("User_go_Offline","").toString());
ui.txt_SoundFile3->setText(settings.value("FileSend_Finished","").toString());
ui.txt_SoundFile4->setText(settings.value("FileRecive_Incoming","").toString());
ui.txt_SoundFile5->setText(settings.value("FileRecive_Finished","").toString());
ui.txt_SoundFile6->setText(settings.value("NewChatMessage","").toString());
if(!ui.txt_SoundFile->text().isEmpty())ui.checkBoxSound->setEnabled(true);
//if(!ui.txt_SoundFile2->text().isEmpty())ui.checkBoxSound_2->setEnabled(true);
@ -103,17 +102,17 @@ SoundPage::load()
if(!ui.txt_SoundFile5->text().isEmpty())ui.checkBoxSound_5->setEnabled(true);
if(!ui.txt_SoundFile6->text().isEmpty())ui.checkBoxSound_6->setEnabled(true);
_settings->endGroup();
settings.endGroup();
_settings->beginGroup("Enable");
ui.checkBoxSound->setChecked(_settings->value("User_go_Online",false).toBool());
//ui.checkBoxSound_2->setChecked(_settings->value("User_go_Offline",false).toBool());
ui.checkBoxSound_3->setChecked(_settings->value("FileSend_Finished",false).toBool());
ui.checkBoxSound_4->setChecked(_settings->value("FileRecive_Incoming",false).toBool());
ui.checkBoxSound_5->setChecked(_settings->value("FileRecive_Finished",false).toBool());
ui.checkBoxSound_6->setChecked(_settings->value("NewChatMessage",false).toBool());
_settings->endGroup();
_settings->endGroup();
settings.beginGroup("Enable");
ui.checkBoxSound->setChecked(settings.value("User_go_Online",false).toBool());
//ui.checkBoxSound_2->setChecked(settings.value("User_go_Offline",false).toBool());
ui.checkBoxSound_3->setChecked(settings.value("FileSend_Finished",false).toBool());
ui.checkBoxSound_4->setChecked(settings.value("FileRecive_Incoming",false).toBool());
ui.checkBoxSound_5->setChecked(settings.value("FileRecive_Finished",false).toBool());
ui.checkBoxSound_6->setChecked(settings.value("NewChatMessage",false).toBool());
settings.endGroup();
settings.endGroup();
}
void SoundPage::on_cmd_openFile()

View File

@ -24,8 +24,6 @@
#include <QFileDialog>
#include "rsharesettings.h"
#include "configpage.h"
#include "ui_SoundPage.h"
@ -54,9 +52,6 @@ private slots:
void on_cmd_openFile6();
private:
/** A RshareSettings object used for saving/loading settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::SoundPage ui;
};

View File

@ -22,6 +22,7 @@
#include "ui_OnlineToaster.h"
#include "QtToaster.h"
#include "gui/settings/rsharesettings.h"
#include <QtGui/QtGui>
@ -67,19 +68,16 @@ void OnlineToaster::chatButtonSlot() {
}
void OnlineToaster::play(){
_settings = new RshareSettings();
_settings->beginGroup("Sound");
_settings->beginGroup("SoundFilePath");
QString OnlineSound= _settings->value("User_go_Online","").toString();
_settings->endGroup();
_settings->beginGroup("Enable");
bool flag= _settings->value("User_go_Online",false).toBool();
_settings->endGroup();
_settings->endGroup();
RshareSettings settings;
settings.beginGroup("Sound");
settings.beginGroup("SoundFilePath");
QString OnlineSound= settings.value("User_go_Online","").toString();
settings.endGroup();
settings.beginGroup("Enable");
bool flag= settings.value("User_go_Online",false).toBool();
settings.endGroup();
settings.endGroup();
if(!OnlineSound.isEmpty()&&flag)
if(QSound::isAvailable())
QSound::play(OnlineSound);
// delete _settings;
}

View File

@ -21,7 +21,6 @@
#define ONLINETOASTER_H
#include "IQtToaster.h"
#include <gui/settings/rsharesettings.h>
#include <QtCore/QObject>
#include <QSound>
@ -64,8 +63,6 @@ private Q_SLOTS:
void close();
private:
RshareSettings* _settings;
Ui::OnlineToaster * _ui;
QWidget * _onlineToasterWidget;

View File

@ -30,8 +30,6 @@
#include "gui/mainpage.h"
#include "gui/linetypes.h"
#include "gui/settings/rsharesettings.h"
#include "ui_StatisticDialog.h"
/** Redraw graph every 1000ms **/
@ -73,9 +71,6 @@ private:
/** Loads the saved Bandwidth Graph settings */
void loadSettings();
/** A RetroShareSettings object that handles getting/saving settings */
RshareSettings* _settings;
/** Qt Designer generated object */
Ui::StatisticDialog ui;
};

View File

@ -26,7 +26,6 @@
#include <QMap>
#include <QPointer>
#include <QObject>
#include <gui/settings/rsharesettings.h>
#include "ui_CreateBlogMsg.h"
#include <stdint.h>

View File

@ -36,7 +36,6 @@
#include <QKeySequence>
#include "util/log.h"
#include "gui/settings/rsharesettings.h"
/** Rshare's version string */
#define RSHARE_VERSION "0.7"