add new settings

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1559 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
alexandrut 2009-08-19 22:19:35 +00:00
parent 19920e95bc
commit 1c93c63ba4
4 changed files with 54 additions and 66 deletions

View file

@ -1,4 +1,4 @@
CONFIG += qt gui uic qrc resources uitools debug pluginmgr #release newsettings CONFIG += qt gui uic qrc resources uitools debug pluginmgr newsettings #release
QT += network xml script QT += network xml script
TEMPLATE = app TEMPLATE = app
TARGET = RetroShare TARGET = RetroShare

View file

@ -15,7 +15,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
@ -30,8 +30,6 @@
#include <rshare.h> #include <rshare.h>
#include "ApplicationWindow.h" #include "ApplicationWindow.h"
#include "Preferences/PreferencesWindow.h"
//#include "Settings/gsettingswin.h" //#include "Settings/gsettingswin.h"
#include "rsiface/rsiface.h" #include "rsiface/rsiface.h"
@ -101,12 +99,12 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
{ {
/* Invoke the Qt Designer generated QObject setup routine */ /* Invoke the Qt Designer generated QObject setup routine */
ui.setupUi(this); ui.setupUi(this);
setWindowTitle(tr("RetroShare")); setWindowTitle(tr("RetroShare"));
RshareSettings config; RshareSettings config;
config.loadWidgetInformation(this); config.loadWidgetInformation(this);
// Setting icons // Setting icons
this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
loadStyleSheet("Default"); loadStyleSheet("Default");
@ -121,27 +119,27 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
// ChannelsDialog *channelsDialog = NULL; // ChannelsDialog *channelsDialog = NULL;
// ui.stackPages->add(channelsDialog = new ChannelsDialog(ui.stackPages), // ui.stackPages->add(channelsDialog = new ChannelsDialog(ui.stackPages),
// createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp)); // createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
//NewsFeed *newsFeed = NULL; //NewsFeed *newsFeed = NULL;
//ui.stackPages->add(newsFeed = new NewsFeed(ui.stackPages), //ui.stackPages->add(newsFeed = new NewsFeed(ui.stackPages),
// createPageAction(QIcon(IMAGE_NEWSFEED), tr("News Feed"), grp)); // createPageAction(QIcon(IMAGE_NEWSFEED), tr("News Feed"), grp));
StatisticDialog *statisticDialog = NULL; StatisticDialog *statisticDialog = NULL;
ui.stackPages->add(statisticDialog = new StatisticDialog(ui.stackPages), ui.stackPages->add(statisticDialog = new StatisticDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp)); createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp));
PeersFeed *peersFeed = NULL; PeersFeed *peersFeed = NULL;
ui.stackPages->add(peersFeed = new PeersFeed(ui.stackPages), ui.stackPages->add(peersFeed = new PeersFeed(ui.stackPages),
createPageAction(QIcon(IMAGE_PEERS), tr("Peers"), grp)); createPageAction(QIcon(IMAGE_PEERS), tr("Peers"), grp));
TransferFeed *transferFeed = NULL; TransferFeed *transferFeed = NULL;
ui.stackPages->add(transferFeed = new TransferFeed(ui.stackPages), ui.stackPages->add(transferFeed = new TransferFeed(ui.stackPages),
createPageAction(QIcon(IMAGE_LINKS), tr("Transfers"), grp)); createPageAction(QIcon(IMAGE_LINKS), tr("Transfers"), grp));
MsgFeed *msgFeed = NULL; MsgFeed *msgFeed = NULL;
ui.stackPages->add(msgFeed = new MsgFeed(ui.stackPages), ui.stackPages->add(msgFeed = new MsgFeed(ui.stackPages),
createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp)); createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
BlogDialog *blogDialog = NULL; BlogDialog *blogDialog = NULL;
ui.stackPages->add(blogDialog = new BlogDialog(ui.stackPages), ui.stackPages->add(blogDialog = new BlogDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_BLOGS), tr("Blog Feed"), grp)); createPageAction(QIcon(IMAGE_BLOGS), tr("Blog Feed"), grp));
@ -153,7 +151,7 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
// ForumsDialog *forumsDialog = NULL; // ForumsDialog *forumsDialog = NULL;
// ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages), // ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages),
// createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp)); // createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp));
GamesDialog *gamesDialog = NULL; GamesDialog *gamesDialog = NULL;
ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages), ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp)); createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp));
@ -161,21 +159,21 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
PhotoDialog *photoDialog = NULL; PhotoDialog *photoDialog = NULL;
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages), ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp)); createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
LibraryDialog *libraryDialog = NULL; LibraryDialog *libraryDialog = NULL;
ui.stackPages->add(libraryDialog = new LibraryDialog(ui.stackPages), ui.stackPages->add(libraryDialog = new LibraryDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_LIBRARY), tr("Library"), grp)); createPageAction(QIcon(IMAGE_LIBRARY), tr("Library"), grp));
CalDialog *calDialog = NULL; CalDialog *calDialog = NULL;
ui.stackPages->add(calDialog = new CalDialog(ui.stackPages), ui.stackPages->add(calDialog = new CalDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_CALENDAR), tr("Shared Calendars"), grp)); createPageAction(QIcon(IMAGE_CALENDAR), tr("Shared Calendars"), grp));
//ui.stackPages->add(groupsDialog = new GroupsDialog(ui.stackPages), //ui.stackPages->add(groupsDialog = new GroupsDialog(ui.stackPages),
// createPageAction(QIcon(), tr("Groups"), grp)); // createPageAction(QIcon(), tr("Groups"), grp));
//ui.stackPages->add(new StatisticDialog(ui.stackPages), //ui.stackPages->add(new StatisticDialog(ui.stackPages),
// createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp)); // createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp));
@ -210,7 +208,7 @@ void ApplicationWindow::addAction(QAction *action, const char *slot)
/** Overloads the default show so we can load settings */ /** Overloads the default show so we can load settings */
void ApplicationWindow::show() void ApplicationWindow::show()
{ {
if (!this->isVisible()) { if (!this->isVisible()) {
QMainWindow::show(); QMainWindow::show();
} else { } else {
@ -295,9 +293,9 @@ void ApplicationWindow::loadStyleSheet(const QString &sheetName)
file.open(QFile::ReadOnly); file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll()); QString styleSheet = QLatin1String(file.readAll());
qApp->setStyleSheet(styleSheet); qApp->setStyleSheet(styleSheet);
} }
/** Shows smplayer */ /** Shows smplayer */
@ -305,11 +303,11 @@ void ApplicationWindow::showsmplayer()
{ {
#if 0 #if 0
static SMPlayer * smplayer = 0; static SMPlayer * smplayer = 0;
if (smplayer == 0) { if (smplayer == 0) {
smplayer = new SMPlayer(QString::null, this); smplayer = new SMPlayer(QString::null, this);
} }
smplayer->gui()->show(); smplayer->gui()->show();
#endif #endif
} }

View file

@ -50,12 +50,6 @@
#include "statusbar/natstatus.h" #include "statusbar/natstatus.h"
#include "statusbar/ratesstatus.h" #include "statusbar/ratesstatus.h"
#include "Preferences/PreferencesWindow.h"
#ifdef NEWSETTINGS
#include "settings/rsettingswin.h"
#endif
#include "rsiface/rsiface.h" #include "rsiface/rsiface.h"
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include "rsiface/rsfiles.h" #include "rsiface/rsfiles.h"
@ -129,7 +123,7 @@ 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();
_preferencesWindow = new PreferencesWindow(); _settingsWindow = new RSettingsWin();
applicationWindow = new ApplicationWindow(); applicationWindow = new ApplicationWindow();
applicationWindow->hide(); applicationWindow->hide();
@ -433,9 +427,9 @@ void MainWindow::openShareManager()
/** Creates and displays the Configuration dialog with the current page set to /** Creates and displays the Configuration dialog with the current page set to
* <b>page</b>. */ * <b>page</b>. */
void void
MainWindow::showPreferencesWindow(PreferencesWindow::Page page) MainWindow::showPreferencesWindow(RSettingsWin::PageType page)
{ {
_preferencesWindow->showWindow(page); _settingsWindow->showWindow(page);
} }
/** Shows Messages Dialog */ /** Shows Messages Dialog */
@ -476,7 +470,7 @@ MainWindow::~MainWindow()
{ {
delete _bandwidthGraph; delete _bandwidthGraph;
delete _messengerwindowAct; delete _messengerwindowAct;
delete _preferencesWindow; delete _settingsWindow;
} }
/** Create and bind actions to events. Setup for initial /** Create and bind actions to events. Setup for initial
@ -511,8 +505,8 @@ void MainWindow::createActions()
*/ */
void MainWindow::doQuit() void MainWindow::doQuit()
{ {
if(!_settings->value(QString::fromUtf8("doQuit"), false).toBool()) if(!_settings->value(QString::fromUtf8("doQuit"), false).toBool())
{ {
QString queryWrn; QString queryWrn;
queryWrn.clear(); queryWrn.clear();

View file

@ -15,7 +15,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
@ -38,8 +38,7 @@
#include "ApplicationWindow.h" #include "ApplicationWindow.h"
#include "PluginsPage.h" #include "PluginsPage.h"
#include "Preferences/PreferencesWindow.h" #include "settings/rsettingswin.h"
#include "Preferences/rsharesettings.h"
#include "bwgraph/bwgraph.h" #include "bwgraph/bwgraph.h"
#include "help/browser/helpbrowser.h" #include "help/browser/helpbrowser.h"
@ -47,7 +46,6 @@
#include "ui_MainWindow.h" #include "ui_MainWindow.h"
class PeerStatus; class PeerStatus;
class DHTStatus; class DHTStatus;
class NATStatus; class NATStatus;
@ -72,20 +70,20 @@ public:
Channels, /** Channels page. */ Channels, /** Channels page. */
Forums /** Forums page. */ Forums /** Forums page. */
}; };
/** Default Constructor */ /** Default Constructor */
MainWindow(QWidget *parent = 0, Qt::WFlags flags = 0); MainWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Destructor. */ /** Destructor. */
~MainWindow(); ~MainWindow();
/* A Bit of a Hack... but public variables for /* A Bit of a Hack... but public variables for
* the dialogs, so we can add them to the * the dialogs, so we can add them to the
* Notify Class... * Notify Class...
*/ */
NetworkDialog *networkDialog; NetworkDialog *networkDialog;
PeersDialog *peersDialog; PeersDialog *peersDialog;
SearchDialog *searchDialog; SearchDialog *searchDialog;
@ -104,7 +102,7 @@ public slots:
//void show(); //void show();
/** Shows the config dialog with focus set to the given page. */ /** Shows the config dialog with focus set to the given page. */
void showWindow(Page page); void showWindow(Page page);
void playFiles(QStringList files); void playFiles(QStringList files);
void updateHashingInfo(const QString&) ; void updateHashingInfo(const QString&) ;
@ -112,7 +110,7 @@ private slots:
void updateMenu(); void updateMenu();
void updateStatus(); void updateStatus();
void toggleVisibility(QSystemTrayIcon::ActivationReason e); void toggleVisibility(QSystemTrayIcon::ActivationReason e);
void toggleVisibilitycontextmenu(); void toggleVisibilitycontextmenu();
@ -124,7 +122,7 @@ private slots:
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. */
void showHelpDialog(); void showHelpDialog();
@ -133,16 +131,16 @@ private slots:
/** Creates and displays the Configuration dialog with the current page set /** Creates and displays the Configuration dialog with the current page set
* to <b>page</b>. */ * to <b>page</b>. */
void showPreferencesWindow(PreferencesWindow::Page page = PreferencesWindow::General); void showPreferencesWindow(RSettingsWin::PageType page = RSettingsWin::General);
void showMess(MainWindow::Page page = MainWindow::Messages); void showMess(MainWindow::Page page = MainWindow::Messages);
#ifdef NEWSETTINGS #ifdef NEWSETTINGS
void showSettings(); void showSettings();
#endif #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:
@ -151,14 +149,12 @@ protected:
private slots: private slots:
private: 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* _prefsAct;
QAction* _bandwidthAct; QAction* _bandwidthAct;
@ -167,23 +163,23 @@ private:
QAction* _smplayerAct; QAction* _smplayerAct;
QAction* _helpAct; QAction* _helpAct;
QAction* _appAct; QAction* _appAct;
/** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */ /** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */
BandwidthGraph* _bandwidthGraph; BandwidthGraph* _bandwidthGraph;
PreferencesWindow* _preferencesWindow; RSettingsWin *_settingsWindow;
/** A RetroShareSettings object used for saving/loading settings */ /** A RetroShareSettings object used for saving/loading settings */
RshareSettings* _settings; RshareSettings* _settings;
/** Creates a new action for a Main page. */ /** Creates a new action for a Main page. */
QAction* createPageAction(QIcon img, QString text, QActionGroup *group); QAction* createPageAction(QIcon img, QString text, QActionGroup *group);
/** 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;
QAction *toggleVisibilityAction, *toolAct; QAction *toggleVisibilityAction, *toolAct;
QMenu *menu; QMenu *menu;
@ -194,7 +190,7 @@ private:
RatesStatus *ratesstatus; RatesStatus *ratesstatus;
QLabel *_hashing_info_label ; QLabel *_hashing_info_label ;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::MainWindow ui; Ui::MainWindow ui;
}; };