2018-12-25 21:10:15 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
* gui/unfinished/ApplicationWindow.cpp *
|
|
|
|
* *
|
|
|
|
* Copyright (C) 2006 Crypton <retroshare.project@gmail.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2009-12-05 13:42:24 +00:00
|
|
|
|
2012-10-22 13:51:40 +00:00
|
|
|
#include <QCloseEvent>
|
2009-12-05 13:42:24 +00:00
|
|
|
|
|
|
|
#include <rshare.h>
|
|
|
|
#include "ApplicationWindow.h"
|
|
|
|
|
2010-08-06 09:40:23 +00:00
|
|
|
#include <retroshare/rsiface.h>
|
2009-12-05 13:42:24 +00:00
|
|
|
|
2012-11-01 00:19:02 +00:00
|
|
|
#include "gui/Identity/IdDialog.h"
|
2013-04-15 09:23:24 +00:00
|
|
|
#ifdef RS_USE_CIRCLES
|
2012-12-15 23:11:11 +00:00
|
|
|
#include "gui/Circles/CirclesDialog.h"
|
2013-04-15 09:23:24 +00:00
|
|
|
#endif
|
|
|
|
#ifdef RS_USE_PHOTOSHARE
|
2012-09-17 22:08:23 +00:00
|
|
|
#include "gui/PhotoShare/PhotoShare.h"
|
2013-04-15 09:23:24 +00:00
|
|
|
#endif
|
2012-11-01 00:19:02 +00:00
|
|
|
#include "gui/WikiPoos/WikiDialog.h"
|
2012-10-05 18:12:52 +00:00
|
|
|
#include "gui/Posted/PostedDialog.h"
|
2013-07-15 14:22:33 +00:00
|
|
|
#include "gui/gxsforums/GxsForumsDialog.h"
|
2012-09-15 00:17:23 +00:00
|
|
|
|
|
|
|
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
|
|
|
|
#if USE_VEG_SERVICE
|
2012-02-13 18:43:15 +00:00
|
|
|
#include "gui/TheWire/WireDialog.h"
|
2012-09-15 00:17:23 +00:00
|
|
|
#endif
|
2012-02-13 18:43:15 +00:00
|
|
|
|
|
|
|
//#include "GamesDialog.h"
|
|
|
|
//#include "CalDialog.h"
|
|
|
|
//#include "PhotoDialog.h"
|
|
|
|
//#include "StatisticDialog.h"
|
2009-12-05 13:42:24 +00:00
|
|
|
|
|
|
|
/* Images for toolbar icons */
|
|
|
|
#define IMAGE_RETROSHARE ":/images/RetroShare16.png"
|
|
|
|
#define IMAGE_ABOUT ":/images/informations_24x24.png"
|
|
|
|
#define IMAGE_STATISTIC ":/images/ksysguard32.png"
|
|
|
|
#define IMAGE_GAMES ":/images/kgames.png"
|
|
|
|
#define IMAGE_PHOTO ":/images/lphoto.png"
|
|
|
|
#define IMAGE_BWGRAPH ":/images/ksysguard.png"
|
|
|
|
#define IMAGE_CLOSE ":/images/close_normal.png"
|
|
|
|
#define IMAGE_CALENDAR ":/images/calendar.png"
|
|
|
|
#define IMAGE_LIBRARY ":/images/library.png"
|
|
|
|
#define IMAGE_PLUGINS ":/images/extension_32.png"
|
2012-11-12 20:47:55 +00:00
|
|
|
#define IMAGE_GXSFORUMS ":/images/konversation.png"
|
2013-04-15 09:23:24 +00:00
|
|
|
#define IMAGE_WIKI ":/images/wikibook_32.png"
|
|
|
|
#define IMAGE_POSTED ":/images/posted_32.png"
|
|
|
|
#define IMAGE_GXSCHANNELS ":/images/channels.png"
|
2014-02-19 16:20:19 +00:00
|
|
|
#define IMAGE_IDENTITY ":/images/identity/identities_32.png"
|
2013-09-02 23:01:24 +00:00
|
|
|
#define IMAGE_CIRCLES ":/images/user/agt_forum24.png"
|
2013-09-02 19:20:47 +00:00
|
|
|
|
2009-12-05 13:42:24 +00:00
|
|
|
|
|
|
|
/** Constructor */
|
2013-10-18 21:10:33 +00:00
|
|
|
ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WindowFlags flags)
|
2009-12-05 13:42:24 +00:00
|
|
|
: QMainWindow(parent, flags)
|
|
|
|
{
|
|
|
|
/* Invoke the Qt Designer generated QObject setup routine */
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
|
|
|
setWindowTitle(tr("RetroShare"));
|
|
|
|
|
2012-02-13 18:43:15 +00:00
|
|
|
//Settings->loadWidgetInformation(this);
|
2009-12-05 13:42:24 +00:00
|
|
|
|
|
|
|
/* Create the config pages and actions */
|
|
|
|
QActionGroup *grp = new QActionGroup(this);
|
2014-05-01 13:08:22 +00:00
|
|
|
QAction *action;
|
2009-12-05 13:42:24 +00:00
|
|
|
|
2012-02-13 18:43:15 +00:00
|
|
|
//StatisticDialog *statisticDialog = NULL;
|
|
|
|
//ui.stackPages->add(statisticDialog = new StatisticDialog(ui.stackPages),
|
|
|
|
// createPageAction(QIcon(IMAGE_STATISTIC), tr("Statistics"), grp));
|
|
|
|
|
|
|
|
//GamesDialog *gamesDialog = NULL;
|
|
|
|
//ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages),
|
|
|
|
// createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp));
|
|
|
|
|
|
|
|
//CalDialog *calDialog = NULL;
|
|
|
|
//ui.stackPages->add(calDialog = new CalDialog(ui.stackPages),
|
|
|
|
// createPageAction(QIcon(IMAGE_CALENDAR), tr("Shared Calendars"), grp));
|
2014-04-27 14:23:27 +00:00
|
|
|
#if 0
|
2012-02-13 18:43:15 +00:00
|
|
|
IdDialog *idDialog = NULL;
|
|
|
|
ui.stackPages->add(idDialog = new IdDialog(ui.stackPages),
|
2014-05-01 13:08:22 +00:00
|
|
|
action = createPageAction(QIcon(IMAGE_IDENTITY), tr("Identities"), grp));
|
2009-12-05 13:42:24 +00:00
|
|
|
|
2013-04-15 09:23:24 +00:00
|
|
|
#ifdef RS_USE_CIRCLES
|
|
|
|
CirclesDialog *circlesDialog = NULL;
|
|
|
|
ui.stackPages->add(circlesDialog = new CirclesDialog(ui.stackPages),
|
2014-05-01 13:08:22 +00:00
|
|
|
action = createPageAction(QIcon(IMAGE_CIRCLES ), tr("Circles"), grp));
|
|
|
|
mNotify.push_back(QPair<MainPage*, QAction*>(circlesDialog, action));
|
2013-04-15 09:23:24 +00:00
|
|
|
#endif
|
2014-04-27 14:23:27 +00:00
|
|
|
#endif
|
2012-12-15 23:11:11 +00:00
|
|
|
|
2013-04-15 09:23:24 +00:00
|
|
|
#ifdef RS_USE_PHOTOSHARE
|
|
|
|
PhotoShare *photoShare = NULL;
|
|
|
|
ui.stackPages->add(photoShare = new PhotoShare(ui.stackPages),
|
2014-05-01 13:08:22 +00:00
|
|
|
action = createPageAction(QIcon(IMAGE_PHOTO), tr("Photos"), grp));
|
|
|
|
mNotify.push_back(QPair<MainPage*, QAction*>(photoShare, action));
|
2013-04-15 09:23:24 +00:00
|
|
|
#endif
|
2009-12-05 13:42:24 +00:00
|
|
|
|
2014-05-10 02:38:47 +00:00
|
|
|
/*PostedDialog *postedDialog = NULL;
|
2014-04-02 11:28:06 +00:00
|
|
|
ui.stackPages->add(postedDialog = new PostedDialog(ui.stackPages),
|
2014-05-01 13:08:22 +00:00
|
|
|
action = createPageAction(QIcon(IMAGE_POSTED), tr("Posted Links"), grp));
|
2014-04-02 11:28:06 +00:00
|
|
|
postedDialog->setup();
|
2014-05-01 13:08:22 +00:00
|
|
|
mNotify.push_back(QPair<MainPage*, QAction*>(postedDialog, action));
|
2014-04-02 11:28:06 +00:00
|
|
|
|
|
|
|
WikiDialog *wikiDialog = NULL;
|
|
|
|
ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages),
|
2014-05-01 13:08:22 +00:00
|
|
|
action = createPageAction(QIcon(IMAGE_WIKI), tr("Wiki Pages"), grp));
|
2014-05-10 02:38:47 +00:00
|
|
|
mNotify.push_back(QPair<MainPage*, QAction*>(wikiDialog, action));*/
|
2014-04-26 16:32:33 +00:00
|
|
|
#if 0
|
2012-11-12 20:47:55 +00:00
|
|
|
GxsForumsDialog *gxsforumsDialog = NULL;
|
|
|
|
ui.stackPages->add(gxsforumsDialog = new GxsForumsDialog(ui.stackPages),
|
2014-05-01 13:08:22 +00:00
|
|
|
action = createPageAction(QIcon(IMAGE_GXSFORUMS), tr("GxsForums"), grp));
|
|
|
|
mNotify.push_back(QPair<MainPage*, QAction*>(gxsforumsDialog, action));
|
2014-04-02 11:28:06 +00:00
|
|
|
|
|
|
|
ChannelDialog *gxschannelDialog = NULL;
|
|
|
|
ui.stackPages->add(gxschannelDialog = new ChannelDialog(ui.stackPages),
|
2014-05-01 13:08:22 +00:00
|
|
|
action = createPageAction(QIcon(IMAGE_GXSCHANNELS), tr("GxsChannels"), grp));
|
2014-04-02 11:28:06 +00:00
|
|
|
gxschannelDialog->setup();
|
2014-04-26 16:32:33 +00:00
|
|
|
#endif
|
2013-03-11 20:53:15 +00:00
|
|
|
|
2012-11-01 00:19:02 +00:00
|
|
|
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
|
|
|
|
#if USE_VEG_SERVICE
|
2012-02-13 18:43:15 +00:00
|
|
|
WireDialog *wireDialog = NULL;
|
|
|
|
ui.stackPages->add(wireDialog = new WireDialog(ui.stackPages),
|
2014-05-01 13:08:22 +00:00
|
|
|
action = createPageAction(QIcon(IMAGE_BWGRAPH), tr("The Wire"), grp));
|
|
|
|
mNotify.push_back(QPair<MainPage*, QAction*>(wireDialog, action));
|
2012-09-15 00:17:23 +00:00
|
|
|
#endif
|
2012-07-01 23:05:03 +00:00
|
|
|
|
2009-12-05 13:42:24 +00:00
|
|
|
/* Create the toolbar */
|
|
|
|
ui.toolBar->addActions(grp->actions());
|
|
|
|
ui.toolBar->addSeparator();
|
|
|
|
connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *)));
|
|
|
|
|
2012-10-22 13:51:40 +00:00
|
|
|
ui.stackPages->setCurrentIndex(0);
|
2009-12-05 13:42:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Creates a new action associated with a config page. */
|
|
|
|
QAction* ApplicationWindow::createPageAction(QIcon img, QString text, QActionGroup *group)
|
|
|
|
{
|
2012-10-22 13:51:40 +00:00
|
|
|
QFont font;
|
2009-12-05 13:42:24 +00:00
|
|
|
QAction *action = new QAction(img, text, group);
|
2012-10-22 13:51:40 +00:00
|
|
|
font = action->font();
|
|
|
|
font.setPointSize(9);
|
2009-12-05 13:42:24 +00:00
|
|
|
action->setCheckable(true);
|
2012-10-22 13:51:40 +00:00
|
|
|
action->setFont(font);
|
2009-12-05 13:42:24 +00:00
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Adds the given action to the toolbar and hooks its triggered() signal to
|
|
|
|
* the specified slot (if given). */
|
|
|
|
void ApplicationWindow::addAction(QAction *action, const char *slot)
|
|
|
|
{
|
2012-10-22 13:51:40 +00:00
|
|
|
QFont font = action->font();
|
|
|
|
font.setPointSize(9);
|
|
|
|
action->setFont(font);
|
2009-12-05 13:42:24 +00:00
|
|
|
ui.toolBar->addAction(action);
|
|
|
|
connect(action, SIGNAL(triggered()), this, slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Destructor. */
|
|
|
|
ApplicationWindow::~ApplicationWindow()
|
|
|
|
{
|
|
|
|
// is this allocated anywhere ??
|
|
|
|
// delete exampleDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ApplicationWindow::closeEvent(QCloseEvent *e)
|
|
|
|
{
|
2012-02-13 18:43:15 +00:00
|
|
|
//Settings->saveWidgetInformation(this);
|
2009-12-05 13:42:24 +00:00
|
|
|
|
|
|
|
hide();
|
|
|
|
e->ignore();
|
|
|
|
}
|