2007-11-14 22:18:48 -05:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006,2007 The RetroShare Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2009-08-19 18:19:35 -04:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
2007-11-14 22:18:48 -05:00
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#ifndef _MainWindow_H
|
|
|
|
#define _MainWindow_H
|
|
|
|
|
|
|
|
#include <QtGui>
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QSystemTrayIcon>
|
|
|
|
|
2009-12-05 08:42:24 -05:00
|
|
|
#ifdef UNFINISHED
|
|
|
|
#include "unfinished/ApplicationWindow.h"
|
|
|
|
#endif
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#include "NetworkDialog.h"
|
|
|
|
#include "PeersDialog.h"
|
|
|
|
#include "SearchDialog.h"
|
|
|
|
#include "TransfersDialog.h"
|
|
|
|
#include "MessagesDialog.h"
|
|
|
|
#include "SharedFilesDialog.h"
|
|
|
|
#include "MessengerWindow.h"
|
2009-02-11 17:50:12 -05:00
|
|
|
#include "PluginsPage.h"
|
2009-08-10 19:44:46 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#include "bwgraph/bwgraph.h"
|
2008-08-05 14:36:07 -04:00
|
|
|
#include "help/browser/helpbrowser.h"
|
2007-12-13 11:02:33 -05:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#include "ui_MainWindow.h"
|
2009-12-31 08:36:39 -05:00
|
|
|
#include "gui/common/rwindow.h"
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2008-06-16 16:28:16 -04:00
|
|
|
class PeerStatus;
|
2009-05-01 08:45:27 -04:00
|
|
|
class NATStatus;
|
2009-05-02 18:14:20 -04:00
|
|
|
class RatesStatus;
|
2008-06-16 16:28:16 -04:00
|
|
|
|
2008-08-15 16:07:54 -04:00
|
|
|
class MainWindow : public RWindow
|
2007-11-14 22:18:48 -05:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
/** Main dialog pages. */
|
|
|
|
enum Page {
|
2009-08-10 19:44:46 -04:00
|
|
|
Network = 0, /** Network page. */
|
|
|
|
Friends, /** Peers page. */
|
|
|
|
Search, /** Search page. */
|
|
|
|
Transfers, /** Transfers page. */
|
|
|
|
SharedDirectories, /** Shared Directories page. */
|
|
|
|
Messages, /** Messages page. */
|
|
|
|
Links, /** Links page. */
|
|
|
|
Channels, /** Channels page. */
|
2010-02-23 14:50:14 -05:00
|
|
|
Forums, /** Forums page. */
|
|
|
|
Blogs /** Blogs page. */
|
2009-02-02 07:07:07 -05:00
|
|
|
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Default Constructor */
|
|
|
|
MainWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
/** Destructor. */
|
|
|
|
~MainWindow();
|
|
|
|
|
2009-08-19 18:19:35 -04:00
|
|
|
/* A Bit of a Hack... but public variables for
|
|
|
|
* the dialogs, so we can add them to the
|
2007-11-14 22:18:48 -05:00
|
|
|
* Notify Class...
|
|
|
|
*/
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2009-02-02 07:07:07 -05:00
|
|
|
NetworkDialog *networkDialog;
|
2007-11-14 22:18:48 -05:00
|
|
|
PeersDialog *peersDialog;
|
|
|
|
SearchDialog *searchDialog;
|
|
|
|
TransfersDialog *transfersDialog;
|
|
|
|
ChatDialog *chatDialog;
|
|
|
|
MessagesDialog *messagesDialog;
|
|
|
|
SharedFilesDialog *sharedfilesDialog;
|
|
|
|
MessengerWindow *messengerWindow;
|
2009-12-05 08:42:24 -05:00
|
|
|
#ifdef UNFINISHED
|
2007-11-14 22:18:48 -05:00
|
|
|
ApplicationWindow *applicationWindow;
|
2009-12-05 08:42:24 -05:00
|
|
|
#endif
|
2009-02-11 17:50:12 -05:00
|
|
|
PluginsPage* pluginsPage ;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
/** Called when this dialog is to be displayed */
|
2009-01-07 16:12:31 -05:00
|
|
|
//void show();
|
2007-11-14 22:18:48 -05:00
|
|
|
/** Shows the config dialog with focus set to the given page. */
|
2009-01-07 16:12:31 -05:00
|
|
|
void showWindow(Page page);
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2009-12-30 21:23:02 -05:00
|
|
|
void updateHashingInfo(const QString&) ;
|
2010-02-25 08:12:18 -05:00
|
|
|
void displayErrorMessage(int,int,const QString&) ;
|
|
|
|
|
|
|
|
void updateToolBaricons();
|
2009-12-30 21:23:02 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent *);
|
|
|
|
|
|
|
|
/** Called when the user changes the UI translation. */
|
|
|
|
virtual void retranslateUi();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
void updateMenu();
|
2008-06-09 20:48:18 -04:00
|
|
|
void updateStatus();
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
void toggleVisibility(QSystemTrayIcon::ActivationReason e);
|
|
|
|
void toggleVisibilitycontextmenu();
|
|
|
|
|
|
|
|
|
|
|
|
/** Toolbar fns. */
|
|
|
|
void addFriend();
|
|
|
|
void showMessengerWindow();
|
2009-12-05 08:42:24 -05:00
|
|
|
#ifdef UNFINISHED
|
2007-11-14 22:18:48 -05:00
|
|
|
void showApplWindow();
|
2009-12-05 08:42:24 -05:00
|
|
|
#endif
|
|
|
|
|
2009-05-01 12:17:24 -04:00
|
|
|
void showabout();
|
|
|
|
void openShareManager();
|
2009-12-30 21:23:02 -05:00
|
|
|
void displaySystrayMsg(const QString&,const QString&) ;
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2009-05-01 12:17:24 -04:00
|
|
|
/** Displays the help browser and displays the most recently viewed help
|
2008-08-05 14:36:07 -04:00
|
|
|
* topic. */
|
|
|
|
void showHelpDialog();
|
|
|
|
/** Called when a child window requests the given help <b>topic</b>. */
|
|
|
|
void showHelpDialog(const QString &topic);
|
2008-03-31 09:00:00 -04:00
|
|
|
|
2009-01-07 16:12:31 -05:00
|
|
|
void showMess(MainWindow::Page page = MainWindow::Messages);
|
2009-07-23 13:11:51 -04:00
|
|
|
void showSettings();
|
2008-03-27 19:40:37 -04:00
|
|
|
void setStyle();
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
/** Called when user attempts to quit via quit button*/
|
|
|
|
void doQuit();
|
2010-01-08 08:00:00 -05:00
|
|
|
|
|
|
|
void on_actionQuick_Start_Wizard_activated();
|
|
|
|
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
private:
|
|
|
|
|
|
|
|
/** Create the actions on the tray menu or menubar */
|
|
|
|
void createActions();
|
2009-11-24 15:17:13 -05:00
|
|
|
|
|
|
|
void createTrayIcon();
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
/** Defines the actions for the tray menu */
|
2009-08-21 13:58:55 -04:00
|
|
|
QAction* _settingsAct;
|
2007-11-14 22:18:48 -05:00
|
|
|
QAction* _bandwidthAct;
|
|
|
|
QAction* _messengerwindowAct;
|
2009-01-07 16:12:31 -05:00
|
|
|
QAction* _messagesAct;
|
2007-11-18 18:35:53 -05:00
|
|
|
QAction* _smplayerAct;
|
2008-08-05 14:36:07 -04:00
|
|
|
QAction* _helpAct;
|
2009-12-05 09:49:15 -05:00
|
|
|
#ifdef UNFINISHED
|
2008-08-16 18:24:53 -04:00
|
|
|
QAction* _appAct;
|
2009-12-05 09:49:15 -05:00
|
|
|
#endif
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
/** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */
|
|
|
|
BandwidthGraph* _bandwidthGraph;
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2008-08-15 13:49:57 -04:00
|
|
|
/** A RetroShareSettings object used for saving/loading settings */
|
|
|
|
RshareSettings* _settings;
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2008-03-30 19:28:57 -04:00
|
|
|
/** Creates a new action for a Main page. */
|
2007-11-14 22:18:48 -05:00
|
|
|
QAction* createPageAction(QIcon img, QString text, QActionGroup *group);
|
|
|
|
/** Adds a new action to the toolbar. */
|
|
|
|
void addAction(QAction *action, const char *slot = 0);
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
void loadStyleSheet(const QString &sheetName);
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
QSystemTrayIcon *trayIcon;
|
2008-03-31 08:06:56 -04:00
|
|
|
QAction *toggleVisibilityAction, *toolAct;
|
2010-01-01 08:45:35 -05:00
|
|
|
QMenu *trayMenu;
|
2008-06-09 20:48:18 -04:00
|
|
|
|
2008-06-16 16:28:16 -04:00
|
|
|
PeerStatus *peerstatus;
|
2009-05-01 08:45:27 -04:00
|
|
|
NATStatus *natstatus;
|
2009-05-02 18:14:20 -04:00
|
|
|
RatesStatus *ratesstatus;
|
2009-02-02 07:07:07 -05:00
|
|
|
|
|
|
|
QLabel *_hashing_info_label ;
|
2010-02-25 08:12:18 -05:00
|
|
|
|
|
|
|
QIcon MessageIcon;
|
2009-08-19 18:19:35 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::MainWindow ui;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|