changes to speedup settings dialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1562 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
alexandrut 2009-08-21 17:58:55 +00:00
parent fbf0939cea
commit c0523dabbd
4 changed files with 13 additions and 50 deletions

View File

@ -38,7 +38,7 @@
#include "ChannelFeed.h" #include "ChannelFeed.h"
#include "ShareManager.h" #include "ShareManager.h"
#include <rshare.h> #include "rshare.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "MessengerWindow.h" #include "MessengerWindow.h"
#include "HelpDialog.h" #include "HelpDialog.h"
@ -56,6 +56,7 @@
#include "gui/connect/ConnectFriendWizard.h" #include "gui/connect/ConnectFriendWizard.h"
#include "util/rsversion.h" #include "util/rsversion.h"
#include "settings/rsettingswin.h"
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
@ -65,9 +66,9 @@
/* Images for toolbar icons */ /* Images for toolbar icons */
#define IMAGE_NETWORK ":/images/retrosharelogo1.png" #define IMAGE_NETWORK ":/images/retrosharelogo1.png"
#define IMAGE_NETWORK2 ":/images/rs1.png" #define IMAGE_NETWORK2 ":/images/rs1.png"
#define IMAGE_PEERS ":/images/groupchat.png" #define IMAGE_PEERS ":/images/groupchat.png"
#define IMAGE_SEARCH ":/images/filefind.png" #define IMAGE_SEARCH ":/images/filefind.png"
#define IMAGE_TRANSFERS ":/images/ktorrent32.png" #define IMAGE_TRANSFERS ":/images/ktorrent32.png"
#define IMAGE_LINKS ":/images/knewsticker24.png" #define IMAGE_LINKS ":/images/knewsticker24.png"
#define IMAGE_FILES ":/images/fileshare24.png" #define IMAGE_FILES ":/images/fileshare24.png"
@ -84,7 +85,7 @@
#define IMAGE_RSM32 ":/images/kdmconfig.png" #define IMAGE_RSM32 ":/images/kdmconfig.png"
#define IMAGE_RSM16 ":/images/rsmessenger16.png" #define IMAGE_RSM16 ":/images/rsmessenger16.png"
#define IMAGE_CLOSE ":/images/close_normal.png" #define IMAGE_CLOSE ":/images/close_normal.png"
#define IMAGE_SMPLAYER ":/images/smplayer_icon32.png" #define IMAGE_SMPLAYER ":/images/smplayer_icon32.png"
#define IMAGE_BLOCK ":/images/blockdevice.png" #define IMAGE_BLOCK ":/images/blockdevice.png"
#define IMAGE_COLOR ":/images/highlight.png" #define IMAGE_COLOR ":/images/highlight.png"
#define IMAGE_GAMES ":/images/kgames.png" #define IMAGE_GAMES ":/images/kgames.png"
@ -123,14 +124,13 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
/* Create all the dialogs of which we only want one instance */ /* Create all the dialogs of which we only want one instance */
_bandwidthGraph = new BandwidthGraph(); _bandwidthGraph = new BandwidthGraph();
messengerWindow = new MessengerWindow(); messengerWindow = new MessengerWindow();
_settingsWindow = new RSettingsWin();
applicationWindow = new ApplicationWindow(); applicationWindow = new ApplicationWindow();
applicationWindow->hide(); applicationWindow->hide();
/** Left Side ToolBar**/ /** Left Side ToolBar**/
connect(ui.actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) ); connect(ui.actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) );
connect(ui.actionAdd_Share, SIGNAL(triggered() ), this , SLOT( openShareManager() ) ); connect(ui.actionAdd_Share, SIGNAL(triggered() ), this , SLOT( openShareManager() ) );
connect(ui.actionOptions, SIGNAL(triggered()), this, SLOT( showPreferencesWindow()) ); connect(ui.actionOptions, SIGNAL(triggered()), this, SLOT( showSettings()) );
connect(ui.actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) ); connect(ui.actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) );
connect(ui.actionSMPlayer, SIGNAL(triggered()), this, SLOT( showsmplayer()) ); connect(ui.actionSMPlayer, SIGNAL(triggered()), this, SLOT( showsmplayer()) );
connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) ); connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) );
@ -220,9 +220,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow())); addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
#endif #endif
#ifdef NEWSETTINGS
addAction(new QAction(QIcon(IMAGE_OPTIONS), tr("Options"), ui.toolBar), SLOT(showSettings())); addAction(new QAction(QIcon(IMAGE_OPTIONS), tr("Options"), ui.toolBar), SLOT(showSettings()));
#endif
/* Select the first action */ /* Select the first action */
grp->actions()[0]->setChecked(true); grp->actions()[0]->setChecked(true);
@ -294,7 +292,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
#else #else
menu->addAction(_appAct); menu->addAction(_appAct);
#endif #endif
menu->addAction(_prefsAct); menu->addAction(_settingsAct);
menu->addAction(_helpAct); menu->addAction(_helpAct);
menu->addSeparator(); menu->addSeparator();
menu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized())); menu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized()));
@ -424,13 +422,6 @@ void MainWindow::openShareManager()
ShareManager::showYourself(); ShareManager::showYourself();
} }
/** Creates and displays the Configuration dialog with the current page set to
* <b>page</b>. */
void
MainWindow::showPreferencesWindow(RSettingsWin::PageType page)
{
_settingsWindow->showWindow(page);
}
/** Shows Messages Dialog */ /** Shows Messages Dialog */
void void
@ -441,7 +432,6 @@ MainWindow::showMess(MainWindow::Page page)
/** Shows Options */ /** Shows Options */
#ifdef NEWSETTINGS
void MainWindow::showSettings() void MainWindow::showSettings()
{ {
static RSettingsWin *win = new RSettingsWin(this); static RSettingsWin *win = new RSettingsWin(this);
@ -450,7 +440,6 @@ void MainWindow::showSettings()
win->show(); win->show();
win->activateWindow(); win->activateWindow();
} }
#endif
/** Shows Messenger window */ /** Shows Messenger window */
void MainWindow::showMessengerWindow() void MainWindow::showMessengerWindow()
@ -470,7 +459,6 @@ MainWindow::~MainWindow()
{ {
delete _bandwidthGraph; delete _bandwidthGraph;
delete _messengerwindowAct; delete _messengerwindowAct;
delete _settingsWindow;
} }
/** Create and bind actions to events. Setup for initial /** Create and bind actions to events. Setup for initial
@ -478,8 +466,8 @@ MainWindow::~MainWindow()
void MainWindow::createActions() void MainWindow::createActions()
{ {
_prefsAct = new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), this); _settingsAct = new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), this);
connect(_prefsAct, SIGNAL(triggered()), this, SLOT(showPreferencesWindow())); connect(_settingsAct, SIGNAL(triggered()), this, SLOT(showSettings()));
_bandwidthAct = new QAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), this); _bandwidthAct = new QAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), this);
connect(_bandwidthAct, SIGNAL(triggered()), connect(_bandwidthAct, SIGNAL(triggered()),
@ -718,5 +706,3 @@ void openFile(std::string path)
return; return;
} }

View File

@ -38,8 +38,6 @@
#include "ApplicationWindow.h" #include "ApplicationWindow.h"
#include "PluginsPage.h" #include "PluginsPage.h"
#include "settings/rsettingswin.h"
#include "bwgraph/bwgraph.h" #include "bwgraph/bwgraph.h"
#include "help/browser/helpbrowser.h" #include "help/browser/helpbrowser.h"
#include "channels/channelsDialog.h" #include "channels/channelsDialog.h"
@ -104,7 +102,7 @@ public slots:
void showWindow(Page page); void showWindow(Page page);
void playFiles(QStringList files); void playFiles(QStringList files);
void updateHashingInfo(const QString&) ; void updateHashingInfo(const QString&) ;
private slots: private slots:
@ -121,7 +119,7 @@ private slots:
void showApplWindow(); void showApplWindow();
void showabout(); void showabout();
void openShareManager(); void openShareManager();
void displaySystrayMsg(const QString&,const QString&) ; void displaySystrayMsg(const QString&,const QString&) ;
/** Displays the help browser and displays the most recently viewed help /** Displays the help browser and displays the most recently viewed help
* topic. */ * topic. */
@ -129,24 +127,16 @@ private slots:
/** Called when a child window requests the given help <b>topic</b>. */ /** Called when a child window requests the given help <b>topic</b>. */
void showHelpDialog(const QString &topic); void showHelpDialog(const QString &topic);
/** Creates and displays the Configuration dialog with the current page set
* to <b>page</b>. */
void showPreferencesWindow(RSettingsWin::PageType page = RSettingsWin::General);
void showMess(MainWindow::Page page = MainWindow::Messages); void showMess(MainWindow::Page page = MainWindow::Messages);
#ifdef NEWSETTINGS
void showSettings(); void showSettings();
#endif
void setStyle(); void setStyle();
/** Called when user attempts to quit via quit button*/ /** Called when user attempts to quit via quit button*/
void doQuit(); void doQuit();
protected: protected:
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);
private slots: private slots:
private: private:
@ -154,9 +144,8 @@ private:
/** Create the actions on the tray menu or menubar */ /** Create the actions on the tray menu or menubar */
void createActions(); void createActions();
/** Defines the actions for the tray menu */ /** Defines the actions for the tray menu */
QAction* _prefsAct; QAction* _settingsAct;
QAction* _bandwidthAct; QAction* _bandwidthAct;
QAction* _messengerwindowAct; QAction* _messengerwindowAct;
QAction* _messagesAct; QAction* _messagesAct;
@ -167,8 +156,6 @@ private:
/** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */ /** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */
BandwidthGraph* _bandwidthGraph; BandwidthGraph* _bandwidthGraph;
RSettingsWin *_settingsWindow;
/** A RetroShareSettings object used for saving/loading settings */ /** A RetroShareSettings object used for saving/loading settings */
RshareSettings* _settings; RshareSettings* _settings;
@ -177,7 +164,6 @@ private:
/** Adds a new action to the toolbar. */ /** Adds a new action to the toolbar. */
void addAction(QAction *action, const char *slot = 0); void addAction(QAction *action, const char *slot = 0);
void loadStyleSheet(const QString &sheetName); void loadStyleSheet(const QString &sheetName);
QSystemTrayIcon *trayIcon; QSystemTrayIcon *trayIcon;

View File

@ -47,14 +47,6 @@ RSettingsWin::RSettingsWin(QWidget * parent, Qt::WFlags flags)
connect(okButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) ); connect(okButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) );
} }
void
RSettingsWin::showWindow(int page)
{
loadSettings();
setNewPage(page);
QDialog::show();
}
void void
RSettingsWin::closeEvent (QCloseEvent * event) RSettingsWin::closeEvent (QCloseEvent * event)
{ {
@ -123,6 +115,7 @@ RSettingsWin::setNewPage(int page)
} }
pageName->setText(text); pageName->setText(text);
loadSettings(); /* load saved settings */
stackedWidget->setCurrentIndex(page); stackedWidget->setCurrentIndex(page);
listWidget->setCurrentRow(page); listWidget->setCurrentRow(page);
} }

View File

@ -37,8 +37,6 @@ class RSettingsWin: public QDialog, private Ui::Settings
RSettingsWin(QWidget * parent = 0, Qt::WFlags flags = 0); RSettingsWin(QWidget * parent = 0, Qt::WFlags flags = 0);
~RSettingsWin() {} ~RSettingsWin() {}
void showWindow(int page);
public slots: public slots:
//! Go to a specific part of the control panel. //! Go to a specific part of the control panel.
void setNewPage(int page); void setNewPage(int page);