Moved Forums and Channels to main window. Renamed Friends->Network. Code simplification in MainWindow. Next step: merge Circles and Identities

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7308 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-04-27 14:23:27 +00:00
parent b184bc1809
commit 4569c21cb0
4 changed files with 68 additions and 58 deletions

View File

@ -92,6 +92,8 @@
#include "gui/gxschannels/ChannelDialog.h" #include "gui/gxschannels/ChannelDialog.h"
#include "gui/gxsforums/GxsForumsDialog.h" #include "gui/gxsforums/GxsForumsDialog.h"
#include "gui/Identity/IdDialog.h"
#include "gui/Circles/CirclesDialog.h"
#include "gui/connect/ConnectFriendWizard.h" #include "gui/connect/ConnectFriendWizard.h"
#include "util/rsguiversion.h" #include "util/rsguiversion.h"
@ -159,6 +161,9 @@
#define IMAGE_CHATLOBBY ":/images/chat_32.png" #define IMAGE_CHATLOBBY ":/images/chat_32.png"
#define IMAGE_GXSCHANNELS ":/images/channels.png" #define IMAGE_GXSCHANNELS ":/images/channels.png"
#define IMAGE_GXSFORUMS ":/images/konversation.png" #define IMAGE_GXSFORUMS ":/images/konversation.png"
#define IMAGE_IDENTITY ":/images/identity/identities_32.png"
#define IMAGE_CIRCLES ":/images/user/agt_forum24.png"
/*static*/ MainWindow *MainWindow::_instance = NULL; /*static*/ MainWindow *MainWindow::_instance = NULL;
@ -180,10 +185,10 @@
/** Constructor */ /** Constructor */
MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
: RWindow("MainWindow", parent, flags), ui(new Ui::MainWindow) : RWindow("MainWindow", parent, flags)
{ {
/* Invoke the Qt Designer generated QObject setup routine */ /* Invoke the Qt Designer generated QObject setup routine */
ui->setupUi(this); setupUi(this);
_instance = this; _instance = this;
@ -225,20 +230,20 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
#endif #endif
/** Left Side ToolBar**/ /** Left Side ToolBar**/
connect(ui->actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) ); connect(actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) );
connect(ui->actionAdd_Share, SIGNAL(triggered() ), this , SLOT( openShareManager() ) ); connect(actionAdd_Share, SIGNAL(triggered() ), this , SLOT( openShareManager() ) );
connect(ui->actionOptions, SIGNAL(triggered()), this, SLOT( showSettings()) ); connect(actionOptions, SIGNAL(triggered()), this, SLOT( showSettings()) );
// connect(ui->actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) ); // connect(actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) );
connect(ui->actionServicePermissions, SIGNAL(triggered()), this, SLOT(servicePermission())); connect(actionServicePermissions, SIGNAL(triggered()), this, SLOT(servicePermission()));
ui->actionMessenger->setVisible(false); actionMessenger->setVisible(false);
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) ); connect(actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) );
//connect(ui->actionColor, SIGNAL(triggered()), this, SLOT( setStyle()) ); //connect(actionColor, SIGNAL(triggered()), this, SLOT( setStyle()) );
/** 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(actionQuit, SIGNAL(triggered()), this, SLOT(doQuit()));
QList<QPair<MainPage*, QAction*> > notify; QList<QPair<MainPage*, QAction*> > notify;
@ -246,47 +251,55 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
QActionGroup *grp = new QActionGroup(this); QActionGroup *grp = new QActionGroup(this);
QAction *action; QAction *action;
ui->stackPages->add(newsFeed = new NewsFeed(ui->stackPages), stackPages->add(newsFeed = new NewsFeed(stackPages),
action = createPageAction(QIcon(IMAGE_NEWSFEED), tr("News feed"), grp)); action = createPageAction(QIcon(IMAGE_NEWSFEED), tr("News feed"), grp));
notify.push_back(QPair<MainPage*, QAction*>(newsFeed, action)); notify.push_back(QPair<MainPage*, QAction*>(newsFeed, action));
// ui->stackPages->add(networkDialog = new NetworkDialog(ui->stackPages), // stackPages->add(networkDialog = new NetworkDialog(stackPages),
// createPageAction(QIcon(IMAGE_NETWORK2), tr("Network"), grp)); // createPageAction(QIcon(IMAGE_NETWORK2), tr("Network"), grp));
ui->stackPages->add(friendsDialog = new FriendsDialog(ui->stackPages), stackPages->add(friendsDialog = new FriendsDialog(stackPages),
action = createPageAction(QIcon(IMAGE_PEERS), tr("Friends"), grp)); action = createPageAction(QIcon(IMAGE_PEERS), tr("Network"), grp));
notify.push_back(QPair<MainPage*, QAction*>(friendsDialog, action)); notify.push_back(QPair<MainPage*, QAction*>(friendsDialog, action));
// ui->stackPages->add(searchDialog = new SearchDialog(ui->stackPages), IdDialog *idDialog = NULL;
stackPages->add(idDialog = new IdDialog(stackPages), action = createPageAction(QIcon(IMAGE_IDENTITY), tr("People"), grp));
notify.push_back(QPair<MainPage*, QAction*>(idDialog, action));
CirclesDialog *circlesDialog = NULL;
stackPages->add(circlesDialog = new CirclesDialog(stackPages), createPageAction(QIcon(IMAGE_CIRCLES ), tr("Circles"), grp));
notify.push_back(QPair<MainPage*, QAction*>(circlesDialog, action));
// stackPages->add(searchDialog = new SearchDialog(stackPages),
// createPageAction(QIcon(IMAGE_SEARCH), tr("Search"), grp)); // createPageAction(QIcon(IMAGE_SEARCH), tr("Search"), grp));
ui->stackPages->add(transfersDialog = new TransfersDialog(ui->stackPages), stackPages->add(transfersDialog = new TransfersDialog(stackPages),
action = createPageAction(QIcon(IMAGE_TRANSFERS), tr("File sharing"), grp)); action = createPageAction(QIcon(IMAGE_TRANSFERS), tr("File sharing"), grp));
notify.push_back(QPair<MainPage*, QAction*>(transfersDialog, action)); notify.push_back(QPair<MainPage*, QAction*>(transfersDialog, action));
ui->stackPages->add(chatLobbyDialog = new ChatLobbyWidget(ui->stackPages), stackPages->add(chatLobbyDialog = new ChatLobbyWidget(stackPages),
action = createPageAction(QIcon(IMAGE_CHATLOBBY), tr("Chat Lobbies"), grp)); action = createPageAction(QIcon(IMAGE_CHATLOBBY), tr("Chat Lobbies"), grp));
notify.push_back(QPair<MainPage*, QAction*>(chatLobbyDialog, action)); notify.push_back(QPair<MainPage*, QAction*>(chatLobbyDialog, action));
ui->stackPages->add(messagesDialog = new MessagesDialog(ui->stackPages), stackPages->add(messagesDialog = new MessagesDialog(stackPages),
action = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp)); action = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp));
notify.push_back(QPair<MainPage*, QAction*>(messagesDialog, action)); notify.push_back(QPair<MainPage*, QAction*>(messagesDialog, action));
ui->stackPages->add(gxschannelDialog = new ChannelDialog(ui->stackPages), stackPages->add(gxschannelDialog = new ChannelDialog(stackPages),
action = createPageAction(QIcon(IMAGE_GXSCHANNELS), tr("Channels"), grp)); action = createPageAction(QIcon(IMAGE_GXSCHANNELS), tr("Channels"), grp));
gxschannelDialog->setup(); gxschannelDialog->setup();
notify.push_back(QPair<MainPage*, QAction*>(gxschannelDialog, action)); notify.push_back(QPair<MainPage*, QAction*>(gxschannelDialog, action));
ui->stackPages->add(gxsforumDialog = new GxsForumsDialog(ui->stackPages), stackPages->add(gxsforumDialog = new GxsForumsDialog(stackPages),
action = createPageAction(QIcon(IMAGE_GXSFORUMS), tr("Forums"), grp)); action = createPageAction(QIcon(IMAGE_GXSFORUMS), tr("Forums"), grp));
notify.push_back(QPair<MainPage*, QAction*>(gxsforumDialog, action)); notify.push_back(QPair<MainPage*, QAction*>(gxsforumDialog, action));
#ifdef BLOGS #ifdef BLOGS
ui->stackPages->add(blogsFeed = new BlogsDialog(ui->stackPages), createPageAction(QIcon(IMAGE_BLOGS), tr("Blogs"), grp)); stackPages->add(blogsFeed = new BlogsDialog(stackPages), createPageAction(QIcon(IMAGE_BLOGS), tr("Blogs"), grp));
#endif #endif
#if 0 #if 0
ui->stackPages->add(forumsDialog = new ForumsDialog(ui->stackPages), stackPages->add(forumsDialog = new ForumsDialog(stackPages),
action = createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp)); action = createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp));
notify.push_back(QPair<MainPage*, QAction*>(forumsDialog, action)); notify.push_back(QPair<MainPage*, QAction*>(forumsDialog, action));
#endif #endif
@ -306,7 +319,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
std::cerr << " Addign widget page for plugin " << rsPlugins->plugin(i)->getPluginName() << std::endl; std::cerr << " Addign widget page for plugin " << rsPlugins->plugin(i)->getPluginName() << std::endl;
MainPage *pluginPage = rsPlugins->plugin(i)->qt_page(); MainPage *pluginPage = rsPlugins->plugin(i)->qt_page();
QAction *pluginAction = createPageAction(icon, QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str()), grp); QAction *pluginAction = createPageAction(icon, QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str()), grp);
ui->stackPages->add(pluginPage, pluginAction); stackPages->add(pluginPage, pluginAction);
notify.push_back(QPair<MainPage*, QAction*>(pluginPage, pluginAction)); notify.push_back(QPair<MainPage*, QAction*>(pluginPage, pluginAction));
} }
else if(rsPlugins->plugin(i) == NULL) else if(rsPlugins->plugin(i) == NULL)
@ -318,7 +331,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
#ifndef RS_RELEASE_VERSION #ifndef RS_RELEASE_VERSION
#ifdef PLUGINMGR #ifdef PLUGINMGR
ui->stackPages->add(pluginsPage = new PluginsPage(ui->stackPages), stackPages->add(pluginsPage = new PluginsPage(stackPages),
createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp)); createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp));
#endif #endif
#endif #endif
@ -328,22 +341,22 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
if (!advancedMode) if (!advancedMode)
{ {
ui->stackPages->add(getStartedPage = new GetStartedDialog(ui->stackPages), stackPages->add(getStartedPage = new GetStartedDialog(stackPages),
createPageAction(QIcon(IMG_HELP), tr("Getting Started"), grp)); createPageAction(QIcon(IMG_HELP), tr("Getting Started"), grp));
} }
#endif #endif
/* Create the toolbar */ /* Create the toolbar */
ui->toolBar->addActions(grp->actions()); toolBar->addActions(grp->actions());
connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *))); connect(grp, SIGNAL(triggered(QAction *)), stackPages, SLOT(showPage(QAction *)));
#ifdef UNFINISHED #ifdef UNFINISHED
ui->toolBar->addSeparator(); toolBar->addSeparator();
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), SLOT(showApplWindow())); addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), toolBar), SLOT(showApplWindow()));
#endif #endif
ui->stackPages->setCurrentIndex(Settings->getLastPageInMainWindow()); stackPages->setCurrentIndex(Settings->getLastPageInMainWindow());
/** StatusBar section ********/ /** StatusBar section ********/
/* initialize combobox in status bar */ /* initialize combobox in status bar */
@ -389,7 +402,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) { for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) {
UserNotify *userNotify = notifyIt->first->getUserNotify(this); UserNotify *userNotify = notifyIt->first->getUserNotify(this);
if (userNotify) { if (userNotify) {
userNotify->initialize(ui->toolBar, notifyIt->second); userNotify->initialize(toolBar, notifyIt->second);
connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine())); connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine()));
userNotifyList.push_back(userNotify); userNotifyList.push_back(userNotify);
} }
@ -405,7 +418,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
loadOwnStatus(); loadOwnStatus();
/* Set focus to the current page */ /* Set focus to the current page */
ui->stackPages->currentWidget()->setFocus(); stackPages->currentWidget()->setFocus();
idle = new Idle(); idle = new Idle();
idle->start(); idle->start();
@ -419,7 +432,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
/** Destructor. */ /** Destructor. */
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
Settings->setLastPageInMainWindow(ui->stackPages->currentIndex()); Settings->setLastPageInMainWindow(stackPages->currentIndex());
delete peerstatus; delete peerstatus;
delete natstatus; delete natstatus;
@ -430,8 +443,6 @@ MainWindow::~MainWindow()
#ifdef UNFINISHED #ifdef UNFINISHED
delete applicationWindow; delete applicationWindow;
#endif #endif
delete(ui);
} }
void MainWindow::displayDiskSpaceWarning(int loc,int size_limit_mb) void MainWindow::displayDiskSpaceWarning(int loc,int size_limit_mb)
@ -702,7 +713,7 @@ void MainWindow::addAction(QAction *action, const char *slot)
font = action->font(); font = action->font();
font.setPointSize(9); font.setPointSize(9);
action->setFont(font); action->setFont(font);
ui->toolBar->addAction(action); toolBar->addAction(action);
connect(action, SIGNAL(triggered()), this, slot); connect(action, SIGNAL(triggered()), this, slot);
} }
@ -795,7 +806,7 @@ void SetForegroundWindowInternal(HWND hWnd)
/* Show the dialog. */ /* Show the dialog. */
raiseWindow(); raiseWindow();
/* Set the focus to the specified page. */ /* Set the focus to the specified page. */
_instance->ui->stackPages->setCurrentPage(page); _instance->stackPages->setCurrentPage(page);
} }
/** Set focus to the given page. */ /** Set focus to the given page. */
@ -807,35 +818,35 @@ void SetForegroundWindowInternal(HWND hWnd)
switch (page) { switch (page) {
case Search: case Search:
_instance->ui->stackPages->setCurrentPage( _instance->transfersDialog ); _instance->stackPages->setCurrentPage( _instance->transfersDialog );
_instance->transfersDialog->activatePage(TransfersDialog::SearchTab) ; _instance->transfersDialog->activatePage(TransfersDialog::SearchTab) ;
break ; break ;
case Network: case Network:
_instance->ui->stackPages->setCurrentPage( _instance->friendsDialog ); _instance->stackPages->setCurrentPage( _instance->friendsDialog );
_instance->friendsDialog->activatePage(FriendsDialog::NetworkTab) ; _instance->friendsDialog->activatePage(FriendsDialog::NetworkTab) ;
break; break;
case Friends: case Friends:
_instance->ui->stackPages->setCurrentPage( _instance->friendsDialog ); _instance->stackPages->setCurrentPage( _instance->friendsDialog );
break; break;
case ChatLobby: case ChatLobby:
_instance->ui->stackPages->setCurrentPage( _instance->chatLobbyDialog ); _instance->stackPages->setCurrentPage( _instance->chatLobbyDialog );
break; break;
case Transfers: case Transfers:
_instance->ui->stackPages->setCurrentPage( _instance->transfersDialog ); _instance->stackPages->setCurrentPage( _instance->transfersDialog );
break; break;
case SharedDirectories: case SharedDirectories:
_instance->ui->stackPages->setCurrentPage( _instance->transfersDialog ); _instance->stackPages->setCurrentPage( _instance->transfersDialog );
_instance->transfersDialog->activatePage(TransfersDialog::LocalSharedFilesTab) ; _instance->transfersDialog->activatePage(TransfersDialog::LocalSharedFilesTab) ;
break; break;
case Messages: case Messages:
_instance->ui->stackPages->setCurrentPage( _instance->messagesDialog ); _instance->stackPages->setCurrentPage( _instance->messagesDialog );
break; break;
#if 0 #if 0
case Channels: case Channels:
_instance->ui->stackPages->setCurrentPage( _instance->channelFeed ); _instance->stackPages->setCurrentPage( _instance->channelFeed );
return true ; return true ;
case Forums: case Forums:
_instance->ui->stackPages->setCurrentPage( _instance->forumsDialog ); _instance->stackPages->setCurrentPage( _instance->forumsDialog );
return true ; return true ;
#endif #endif
#ifdef BLOGS #ifdef BLOGS
@ -857,7 +868,7 @@ void SetForegroundWindowInternal(HWND hWnd)
return Network; return Network;
} }
QWidget *page = _instance->ui->stackPages->currentWidget(); QWidget *page = _instance->stackPages->currentWidget();
// if (page == _instance->networkDialog) { // if (page == _instance->networkDialog) {
// return Network; // return Network;
@ -1112,11 +1123,11 @@ void MainWindow::showHelpDialog(const QString &topic)
void void
MainWindow::retranslateUi() MainWindow::retranslateUi()
{ {
ui->retranslateUi(this); retranslateUi();
foreach (MainPage *page, ui->stackPages->pages()) { foreach (MainPage *page, stackPages->pages()) {
page->retranslateUi(); page->retranslateUi();
} }
foreach (QAction *action, ui->toolBar->actions()) { foreach (QAction *action, toolBar->actions()) {
action->setText(tr(qPrintable(action->data().toString()), "MainWindow")); action->setText(tr(qPrintable(action->data().toString()), "MainWindow"));
} }
} }

View File

@ -26,6 +26,7 @@
#include <set> #include <set>
#include "gui/common/rwindow.h" #include "gui/common/rwindow.h"
#include "ui_MainWindow.h"
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
@ -72,7 +73,7 @@ class BlogsDialog;
class ApplicationWindow; class ApplicationWindow;
#endif #endif
class MainWindow : public RWindow class MainWindow : public RWindow, public Ui::MainWindow
{ {
Q_OBJECT Q_OBJECT
@ -257,9 +258,6 @@ private:
// idle function // idle function
void setIdle(bool Idle); void setIdle(bool Idle);
bool isIdle; bool isIdle;
/** Qt Designer generated object */
Ui::MainWindow *ui;
}; };
#endif #endif

View File

@ -95,7 +95,7 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WindowFlags flags)
//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));
#if 0
IdDialog *idDialog = NULL; IdDialog *idDialog = NULL;
ui.stackPages->add(idDialog = new IdDialog(ui.stackPages), ui.stackPages->add(idDialog = new IdDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_IDENTITY), tr("Identities"), grp)); createPageAction(QIcon(IMAGE_IDENTITY), tr("Identities"), grp));
@ -105,6 +105,7 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WindowFlags flags)
ui.stackPages->add(circlesDialog = new CirclesDialog(ui.stackPages), ui.stackPages->add(circlesDialog = new CirclesDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_CIRCLES ), tr("Circles"), grp)); createPageAction(QIcon(IMAGE_CIRCLES ), tr("Circles"), grp));
#endif #endif
#endif
#ifdef RS_USE_PHOTOSHARE #ifdef RS_USE_PHOTOSHARE
PhotoShare *photoShare = NULL; PhotoShare *photoShare = NULL;

View File

@ -15,16 +15,16 @@ CONFIG += gxs debug
gxs { gxs {
CONFIG += wikipoos
CONFIG += identities CONFIG += identities
CONFIG += circles CONFIG += circles
CONFIG += gxsforums CONFIG += gxsforums
CONFIG += gxschannels CONFIG += gxschannels
CONFIG += posted CONFIG += posted
CONFIG += unfinished #CONFIG += unfinished
CONFIG += gxsgui CONFIG += gxsgui
# thewire is incomplete - dont enable # thewire is incomplete - dont enable
#CONFIG += thewire #CONFIG += thewire
CONFIG += wikipoos
CONFIG += photoshare CONFIG += photoshare
DEFINES += RS_ENABLE_GXS DEFINES += RS_ENABLE_GXS