cleaned up MainWindow

Added to pro file  DEFINES += RS_RELEASE_VERSION enable it for release versions.


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1151 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-05-01 16:17:24 +00:00
parent 255b5dca39
commit 3e2993536e
4 changed files with 26 additions and 185 deletions

View File

@ -62,6 +62,10 @@ win32 {
LIBS += -lole32 -lwinmm LIBS += -lole32 -lwinmm
RC_FILE = gui/images/retroshare_win.rc RC_FILE = gui/images/retroshare_win.rc
## ENABLE THIS OPTION for release Version.
#DEFINES += RS_RELEASE_VERSION
} }
##################################### MacOS ###################################### ##################################### MacOS ######################################

View File

@ -64,8 +64,6 @@
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include "rsiface/rsfiles.h" #include "rsiface/rsfiles.h"
//#include "gui/connect/InviteDialog.h"
//#include "gui/connect/AddFriendDialog.h"
#include "gui/connect/ConnectFriendWizard.h" #include "gui/connect/ConnectFriendWizard.h"
#include <sstream> #include <sstream>
@ -116,13 +114,6 @@
/* Keys for UI Preferences */ /* Keys for UI Preferences */
#define UI_PREF_PROMPT_ON_QUIT "UIOptions/ConfirmOnQuit" #define UI_PREF_PROMPT_ON_QUIT "UIOptions/ConfirmOnQuit"
/* uncomment this for release version */
/*****
* #define RS_RELEASE_VERSION 1
****/
//#define RS_RELEASE_VERSION 1
/** Constructor */ /** Constructor */
MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
@ -134,12 +125,10 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
/* Create RshareSettings object */ /* Create RshareSettings object */
_settings = new RshareSettings(); _settings = new RshareSettings();
setWindowTitle(tr("RetroShare %1 RetroShare a private and secure decentralised commmunication platform").arg(retroshareVersion())); setWindowTitle(tr("RetroShare %1 a secure decentralised commmunication platform").arg(retroshareVersion()));
mSMPlayer = NULL; mSMPlayer = NULL;
ui.toolBarservice->hide();
// Setting icons // Setting icons
this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
@ -147,14 +136,11 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
_bandwidthGraph = new BandwidthGraph(); _bandwidthGraph = new BandwidthGraph();
messengerWindow = new MessengerWindow(); messengerWindow = new MessengerWindow();
_preferencesWindow = new PreferencesWindow(); _preferencesWindow = new PreferencesWindow();
messengerWindow->hide();
//messengerWindow->show();
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.actionInvite_Friend, SIGNAL(triggered() ), this , SLOT( inviteFriend() ) );
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( showPreferencesWindow()) );
connect(ui.actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) ); connect(ui.actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) );
@ -164,7 +150,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
//connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT( showSettings()) ); //connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT( showSettings()) );
/** adjusted quit behaviour: trigger a warning that can be switched off in the saved /** adjusted quit behaviour: trigger a warning that can be switched off in the saved
config file RetroShare.conf */ config file RetroShare.conf */
connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(doQuit())); connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(doQuit()));
@ -173,7 +158,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
loadStyleSheet(Rshare::stylesheet()); loadStyleSheet(Rshare::stylesheet());
/* Create the Main pages and actions */ /* Create the Main pages and actions */
QActionGroup *grp = new QActionGroup(this); QActionGroup *grp = new QActionGroup(this);
@ -239,6 +223,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
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));
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
#endif #endif
NewsFeed *newsFeed = NULL; NewsFeed *newsFeed = NULL;
ui.stackPages->add(newsFeed = new NewsFeed(ui.stackPages), ui.stackPages->add(newsFeed = new NewsFeed(ui.stackPages),
@ -248,12 +234,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp)); createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp));
//ui.stackPages->add(groupsDialog = new GroupsDialog(ui.stackPages),
// createPageAction(QIcon(), tr("Groups"), grp));
//ui.stackPages->add(new StatisticDialog(ui.stackPages),
// createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp));
/* also an empty list of chat windows */ /* also an empty list of chat windows */
messengerWindow->setChatDialog(peersDialog); messengerWindow->setChatDialog(peersDialog);
@ -269,51 +249,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
connect(sharedfilesDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList ))); connect(sharedfilesDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList )));
connect(transfersDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList ))); connect(transfersDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList )));
#ifdef RS_RELEASE_VERSION
//addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
#else
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow()));
toolAct = ui.toolBarservice->toggleViewAction();
toolAct->setText("Service");
toolAct->setShortcut(tr("Ctrl+T"));
toolAct->setIcon(QIcon(":/images/blockdevice2.png"));
//ui.toolBar->addAction(toolAct);
/* Create the Service pages and actions */
QActionGroup *servicegrp = new QActionGroup(this);
#if 0
LinksDialog *linksDialog = NULL;
ui.stackPages->add(linksDialog = new LinksDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_LINKS), tr("Links Cloud"), servicegrp));
ChannelsDialog *channelsDialog = NULL;
ui.stackPages->add(channelsDialog = new ChannelsDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), servicegrp));
GamesDialog *gamesDialog = NULL;
ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_GAMES), tr("Games"), servicegrp));
PhotoDialog *photoDialog = NULL;
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), servicegrp));
#endif
/* Create the toolbarservice */
ui.toolBarservice->addActions(servicegrp->actions());
ui.toolBarservice->addSeparator();
connect(servicegrp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *)));
ui.toolBarservice->addSeparator();
#endif
/** StatusBar section **/ /** StatusBar section **/
peerstatus = new PeerStatus(); peerstatus = new PeerStatus();
statusBar()->addWidget(peerstatus); statusBar()->addWidget(peerstatus);
@ -344,8 +279,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
_hashing_info_label->hide() ; _hashing_info_label->hide() ;
statusBar()->addPermanentWidget(statusRates = new QLabel(tr("<strong>Down:</strong> 0.00 (kB/s) | <strong>Up:</strong> 0.00 (kB/s) "))); statusBar()->addPermanentWidget(statusRates = new QLabel(tr("<strong>Down:</strong> 0.00 (kB/s) | <strong>Up:</strong> 0.00 (kB/s) ")));
/******* Status Bar end ******/
//servicegrp->actions()[0]->setChecked(true);
/* Create the actions that will go in the tray menu */ /* Create the actions that will go in the tray menu */
createActions(); createActions();
@ -464,29 +398,6 @@ void MainWindow::addAction(QAction *action, const char *slot)
connect(action, SIGNAL(triggered()), this, slot); connect(action, SIGNAL(triggered()), this, slot);
} }
/** Adds the given action to the toolbar and hooks its triggered() signal to
* the specified slot (if given). */
void MainWindow::addActionservice(QAction *actionservice, const char *slot)
{
actionservice->setFont(FONT);
ui.toolBarservice->addAction(actionservice);
connect(actionservice, SIGNAL(triggered()), this, slot);
}
/** Overloads the default show so we can load settings */
/*void MainWindow::show()
{
if (!this->isVisible()) {
QMainWindow::show();
} else {
QMainWindow::activateWindow();
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
QMainWindow::raise();
}
}*/
/** Shows the MainWindow with focus set to the given page. */ /** Shows the MainWindow with focus set to the given page. */
void MainWindow::showWindow(Page page) void MainWindow::showWindow(Page page)
{ {
@ -515,36 +426,6 @@ void MainWindow::addFriend()
connwiz->show(); connwiz->show();
} }
/** Add a Friend ShortCut */
/*void MainWindow::inviteFriend()
{
static InviteDialog *inviteDialog = new InviteDialog(this);
std::string invite = rsPeers->GetRetroshareInvite();
inviteDialog->setInfo(invite);
inviteDialog->show();
}
*/
/** Add a Share */
void MainWindow::addSharedDirectory()
{
/* Same Code as in Preferences Window (add Share) */
QString qdir = QFileDialog::getExistingDirectory(this, tr("Add Shared Directory"), "",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
/* add it to the server */
std::string dir = qdir.toStdString();
if (dir != "")
{
rsFiles -> addSharedDirectory(dir);
}
}
/** Shows Share Manager */ /** Shows Share Manager */
void MainWindow::openShareManager() void MainWindow::openShareManager()
{ {
@ -716,23 +597,6 @@ void MainWindow::loadStyleSheet(const QString &sheetName)
} }
void MainWindow::startgammon()
{
BgWindow *bgWindow = new BgWindow(this);
bgWindow->show();
}
void MainWindow::startqcheckers()
{
#if 0
myTopLevel* top = new myTopLevel();
top->show();
#endif
}
/** Shows smplayer */ /** Shows smplayer */
void MainWindow::showsmplayer() void MainWindow::showsmplayer()
{ {

View File

@ -108,8 +108,6 @@ public:
MessagesDialog *messagesDialog; MessagesDialog *messagesDialog;
ChannelsDialog *channelsDialog; ChannelsDialog *channelsDialog;
SharedFilesDialog *sharedfilesDialog; SharedFilesDialog *sharedfilesDialog;
//GroupsDialog *groupsDialog;
//StatisticDialog *statisticDialog;
MessengerWindow *messengerWindow; MessengerWindow *messengerWindow;
ApplicationWindow *applicationWindow; ApplicationWindow *applicationWindow;
PluginsPage* pluginsPage ; PluginsPage* pluginsPage ;
@ -122,9 +120,6 @@ public slots:
/** 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 startgammon();
void startqcheckers();
void playFiles(QStringList files); void playFiles(QStringList files);
void updateHashingInfo(const QString&) ; void updateHashingInfo(const QString&) ;
@ -139,8 +134,6 @@ private slots:
/** Toolbar fns. */ /** Toolbar fns. */
void addFriend(); void addFriend();
//void inviteFriend();
void addSharedDirectory();
void showMessengerWindow(); void showMessengerWindow();
void showApplWindow(); void showApplWindow();
void showsmplayer(); void showsmplayer();

View File

@ -1024,26 +1024,6 @@
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
</widget> </widget>
<widget class="QToolBar" name="toolBarservice" >
<property name="windowTitle" >
<string/>
</property>
<property name="allowedAreas" >
<set>Qt::BottomToolBarArea|Qt::LeftToolBarArea|Qt::RightToolBarArea</set>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<attribute name="toolBarArea" >
<enum>RightToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak" >
<bool>false</bool>
</attribute>
</widget>
<widget class="QToolBar" name="toolBar_2" > <widget class="QToolBar" name="toolBar_2" >
<property name="enabled" > <property name="enabled" >
<bool>true</bool> <bool>true</bool>