Fixed crash when closing the settings dialog.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5605 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-09-25 23:51:13 +00:00
parent 29e44ddafa
commit 5726c1ec18
4 changed files with 38 additions and 36 deletions

View File

@ -60,14 +60,6 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WFlags flags)
#endif
}
AppearancePage::~AppearancePage()
{
if (wasLoaded()) {
/* reaload style sheet */
Rshare::loadStyleSheet(Settings->getSheetName());
}
}
/** Saves the changes on this page */
bool AppearancePage::save(QString &errmsg)
{

View File

@ -32,8 +32,6 @@ class AppearancePage : public ConfigPage
public:
/** Default Constructor */
AppearancePage(QWidget * parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
~AppearancePage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);

View File

@ -22,6 +22,7 @@
#include <QMessageBox>
#include <retroshare/rsplugin.h>
#include <rshare.h>
#include "GeneralPage.h"
#include "DirectoriesPage.h"
#include "ServerPage.h"
@ -37,6 +38,7 @@
#include "MessagePage.h"
#include "ForumPage.h"
#include "PluginsPage.h"
#include "rsharesettings.h"
#define IMAGE_GENERAL ":/images/kcmsystem24.png"
@ -57,6 +59,7 @@ RSettingsWin::RSettingsWin(QWidget * parent, Qt::WFlags flags)
connect(listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(setNewPage(int)));
connect(applyButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) );
connect(this, SIGNAL(finished(int)), this, SLOT(dialogFinished(int)));
}
RSettingsWin::~RSettingsWin()
@ -65,6 +68,14 @@ RSettingsWin::~RSettingsWin()
_instance = NULL;
}
void RSettingsWin::dialogFinished(int result)
{
if (result == Rejected) {
/* reaload style sheet */
Rshare::loadStyleSheet(::Settings->getSheetName());
}
}
/*static*/ void RSettingsWin::showYourself(QWidget *parent, PageType page /* = LastPage*/)
{
if(_instance == NULL) {

View File

@ -20,43 +20,44 @@
****************************************************************/
#ifndef RSETTINGSWIN_HPP_
# define RSETTINGSWIN_HPP_
# include <QtGui/QDialog>
# include <retroshare-gui/configpage.h>
# include "ui_settings.h"
#define RSETTINGSWIN_HPP_
#include <QtGui/QDialog>
#include <retroshare-gui/configpage.h>
#include "ui_settings.h"
class RSettingsWin: public QDialog, private Ui::Settings
{
Q_OBJECT
Q_OBJECT
public:
enum PageType { LastPage = -1, General = 0, Server, Transfer,Relay,
Directories, Plugins, Notify, Security, Message, Forum, Chat, Appearance, Sound, Fileassociations };
public:
enum PageType { LastPage = -1, General = 0, Server, Transfer,Relay,
Directories, Plugins, Notify, Security, Message, Forum, Chat, Appearance, Sound, Fileassociations };
static void showYourself(QWidget *parent, PageType page = LastPage);
static void postModDirectories(bool update_local);
static void showYourself(QWidget *parent, PageType page = LastPage);
static void postModDirectories(bool update_local);
protected:
RSettingsWin(QWidget * parent = 0, Qt::WFlags flags = 0);
~RSettingsWin();
protected:
RSettingsWin(QWidget * parent = 0, Qt::WFlags flags = 0);
~RSettingsWin();
void addPage(ConfigPage*) ;
public slots:
//! Go to a specific part of the control panel.
void setNewPage(int page);
void addPage(ConfigPage*) ;
private slots:
/** Called when user clicks "Save Settings" */
void saveChanges();
public slots:
//! Go to a specific part of the control panel.
void setNewPage(int page);
private:
void initStackedWidget();
private slots:
/** Called when user clicks "Save Settings" */
void saveChanges();
void dialogFinished(int result);
private:
static RSettingsWin *_instance;
static int lastPage;
private:
void initStackedWidget();
private:
static RSettingsWin *_instance;
static int lastPage;
};
#endif // !RSETTINGSWIN_HPP_