From c0523dabbd56f65c61e7c04bc29e69fb963c9ad0 Mon Sep 17 00:00:00 2001 From: alexandrut Date: Fri, 21 Aug 2009 17:58:55 +0000 Subject: [PATCH] changes to speedup settings dialog git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1562 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/MainWindow.cpp | 32 ++++++------------- retroshare-gui/src/gui/MainWindow.h | 20 ++---------- .../src/gui/settings/rsettingswin.cpp | 9 +----- .../src/gui/settings/rsettingswin.h | 2 -- 4 files changed, 13 insertions(+), 50 deletions(-) diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 73208d7ae..b6af3caac 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -38,7 +38,7 @@ #include "ChannelFeed.h" #include "ShareManager.h" -#include +#include "rshare.h" #include "MainWindow.h" #include "MessengerWindow.h" #include "HelpDialog.h" @@ -56,6 +56,7 @@ #include "gui/connect/ConnectFriendWizard.h" #include "util/rsversion.h" +#include "settings/rsettingswin.h" #include #include @@ -65,9 +66,9 @@ /* Images for toolbar icons */ #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_SEARCH ":/images/filefind.png" +#define IMAGE_SEARCH ":/images/filefind.png" #define IMAGE_TRANSFERS ":/images/ktorrent32.png" #define IMAGE_LINKS ":/images/knewsticker24.png" #define IMAGE_FILES ":/images/fileshare24.png" @@ -84,7 +85,7 @@ #define IMAGE_RSM32 ":/images/kdmconfig.png" #define IMAGE_RSM16 ":/images/rsmessenger16.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_COLOR ":/images/highlight.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 */ _bandwidthGraph = new BandwidthGraph(); messengerWindow = new MessengerWindow(); - _settingsWindow = new RSettingsWin(); applicationWindow = new ApplicationWindow(); applicationWindow->hide(); /** Left Side ToolBar**/ connect(ui.actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) ); 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.actionSMPlayer, SIGNAL(triggered()), this, SLOT( showsmplayer()) ); 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())); #endif -#ifdef NEWSETTINGS addAction(new QAction(QIcon(IMAGE_OPTIONS), tr("Options"), ui.toolBar), SLOT(showSettings())); -#endif /* Select the first action */ grp->actions()[0]->setChecked(true); @@ -294,7 +292,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) #else menu->addAction(_appAct); #endif - menu->addAction(_prefsAct); + menu->addAction(_settingsAct); menu->addAction(_helpAct); menu->addSeparator(); menu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized())); @@ -424,13 +422,6 @@ void MainWindow::openShareManager() ShareManager::showYourself(); } -/** Creates and displays the Configuration dialog with the current page set to - * page. */ -void -MainWindow::showPreferencesWindow(RSettingsWin::PageType page) -{ - _settingsWindow->showWindow(page); -} /** Shows Messages Dialog */ void @@ -441,7 +432,6 @@ MainWindow::showMess(MainWindow::Page page) /** Shows Options */ -#ifdef NEWSETTINGS void MainWindow::showSettings() { static RSettingsWin *win = new RSettingsWin(this); @@ -450,7 +440,6 @@ void MainWindow::showSettings() win->show(); win->activateWindow(); } -#endif /** Shows Messenger window */ void MainWindow::showMessengerWindow() @@ -470,7 +459,6 @@ MainWindow::~MainWindow() { delete _bandwidthGraph; delete _messengerwindowAct; - delete _settingsWindow; } /** Create and bind actions to events. Setup for initial @@ -478,8 +466,8 @@ MainWindow::~MainWindow() void MainWindow::createActions() { - _prefsAct = new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), this); - connect(_prefsAct, SIGNAL(triggered()), this, SLOT(showPreferencesWindow())); + _settingsAct = new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), this); + connect(_settingsAct, SIGNAL(triggered()), this, SLOT(showSettings())); _bandwidthAct = new QAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), this); connect(_bandwidthAct, SIGNAL(triggered()), @@ -718,5 +706,3 @@ void openFile(std::string path) return; } - - diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index 52a7345bc..fd3b06054 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -38,8 +38,6 @@ #include "ApplicationWindow.h" #include "PluginsPage.h" -#include "settings/rsettingswin.h" - #include "bwgraph/bwgraph.h" #include "help/browser/helpbrowser.h" #include "channels/channelsDialog.h" @@ -104,7 +102,7 @@ public slots: void showWindow(Page page); void playFiles(QStringList files); - void updateHashingInfo(const QString&) ; + void updateHashingInfo(const QString&) ; private slots: @@ -121,7 +119,7 @@ private slots: void showApplWindow(); void showabout(); 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 * topic. */ @@ -129,24 +127,16 @@ private slots: /** Called when a child window requests the given help topic. */ void showHelpDialog(const QString &topic); - /** Creates and displays the Configuration dialog with the current page set - * to page. */ - void showPreferencesWindow(RSettingsWin::PageType page = RSettingsWin::General); void showMess(MainWindow::Page page = MainWindow::Messages); -#ifdef NEWSETTINGS void showSettings(); -#endif void setStyle(); /** Called when user attempts to quit via quit button*/ void doQuit(); - - protected: void closeEvent(QCloseEvent *); - private slots: private: @@ -154,9 +144,8 @@ private: /** Create the actions on the tray menu or menubar */ void createActions(); - /** Defines the actions for the tray menu */ - QAction* _prefsAct; + QAction* _settingsAct; QAction* _bandwidthAct; QAction* _messengerwindowAct; QAction* _messagesAct; @@ -167,8 +156,6 @@ private: /** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */ BandwidthGraph* _bandwidthGraph; - RSettingsWin *_settingsWindow; - /** A RetroShareSettings object used for saving/loading settings */ RshareSettings* _settings; @@ -177,7 +164,6 @@ private: /** Adds a new action to the toolbar. */ void addAction(QAction *action, const char *slot = 0); - void loadStyleSheet(const QString &sheetName); QSystemTrayIcon *trayIcon; diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index 16b47bfa9..7d240f45c 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -47,14 +47,6 @@ RSettingsWin::RSettingsWin(QWidget * parent, Qt::WFlags flags) connect(okButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) ); } -void -RSettingsWin::showWindow(int page) -{ - loadSettings(); - setNewPage(page); - QDialog::show(); -} - void RSettingsWin::closeEvent (QCloseEvent * event) { @@ -123,6 +115,7 @@ RSettingsWin::setNewPage(int page) } pageName->setText(text); + loadSettings(); /* load saved settings */ stackedWidget->setCurrentIndex(page); listWidget->setCurrentRow(page); } diff --git a/retroshare-gui/src/gui/settings/rsettingswin.h b/retroshare-gui/src/gui/settings/rsettingswin.h index 712e7a7b1..4e354b381 100755 --- a/retroshare-gui/src/gui/settings/rsettingswin.h +++ b/retroshare-gui/src/gui/settings/rsettingswin.h @@ -37,8 +37,6 @@ class RSettingsWin: public QDialog, private Ui::Settings RSettingsWin(QWidget * parent = 0, Qt::WFlags flags = 0); ~RSettingsWin() {} - void showWindow(int page); - public slots: //! Go to a specific part of the control panel. void setNewPage(int page);