2007-11-14 22:18:48 -05:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
2007-11-18 18:35:53 -05:00
|
|
|
* Copyright (C) 2007, RetroShare Team
|
2007-11-14 22:18:48 -05:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2009-01-03 21:28:30 -05:00
|
|
|
****************************************************************/
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#ifndef _MESSENGERWINDOW_H
|
2009-01-03 21:28:30 -05:00
|
|
|
#define _MESSENGERWINDOW_H
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
|
|
|
#include "mainpage.h"
|
2007-11-16 20:35:52 -05:00
|
|
|
#include "ui_MessengerWindow.h"
|
2010-02-03 12:39:30 -05:00
|
|
|
|
2009-12-14 12:13:10 -05:00
|
|
|
#include <gui/settings/rsharesettings.h>
|
2009-01-07 16:12:31 -05:00
|
|
|
#include <gui/common/rwindow.h>
|
2010-02-03 12:39:30 -05:00
|
|
|
#include "chat/PopupChatDialog.h"
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
class LogoBar;
|
2008-07-10 14:52:56 -04:00
|
|
|
class PeersDialog;
|
2009-01-03 21:28:30 -05:00
|
|
|
|
2009-01-07 16:12:31 -05:00
|
|
|
class MessengerWindow : public RWindow
|
2009-01-03 21:28:30 -05:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-02-03 12:39:30 -05:00
|
|
|
PopupChatDialog *getPrivateChat(std::string id, std::string name, uint chatflags);
|
2007-11-16 20:35:52 -05:00
|
|
|
|
2009-01-03 21:28:30 -05:00
|
|
|
QPixmap picture;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2009-11-30 11:12:13 -05:00
|
|
|
static MessengerWindow* getInstance();
|
|
|
|
static void releaseInstance();
|
2010-02-03 12:39:30 -05:00
|
|
|
|
|
|
|
virtual void updateMessengerDisplay() ; // overloaded from RsAutoUpdatePage
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2009-01-03 21:28:30 -05:00
|
|
|
public slots:
|
2009-02-22 12:36:39 -05:00
|
|
|
void insertPeers();
|
2009-01-03 21:28:30 -05:00
|
|
|
/** Called when this dialog is to be displayed */
|
2007-11-14 22:18:48 -05:00
|
|
|
void show();
|
|
|
|
|
2010-02-03 12:39:30 -05:00
|
|
|
void updatePeersAvatar(const QString& peer_id);
|
2010-02-15 13:44:35 -05:00
|
|
|
void updateAvatar();
|
2010-02-03 12:39:30 -05:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
LogoBar & getLogoBar() const;
|
|
|
|
|
|
|
|
protected:
|
2009-01-03 21:28:30 -05:00
|
|
|
void closeEvent (QCloseEvent * event);
|
2009-11-30 11:12:13 -05:00
|
|
|
/** Default Constructor */
|
|
|
|
MessengerWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
|
|
|
/** Default Destructor */
|
2009-01-03 21:28:30 -05:00
|
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
/** Create the context popup menu and it's submenus */
|
2007-11-14 22:18:48 -05:00
|
|
|
void messengertreeWidgetCostumPopupMenu( QPoint point );
|
|
|
|
|
2010-02-03 12:39:30 -05:00
|
|
|
/** Add a new friend */
|
|
|
|
void addFriend();
|
|
|
|
/** Export friend */
|
|
|
|
void exportfriend();
|
2007-11-14 22:18:48 -05:00
|
|
|
/** Remove friend */
|
2010-02-03 12:39:30 -05:00
|
|
|
void removefriend();
|
2007-11-14 22:18:48 -05:00
|
|
|
/** start a chat with a friend **/
|
2010-02-03 12:39:30 -05:00
|
|
|
void chatfriend();
|
|
|
|
/** start Messages Composer **/
|
|
|
|
void sendMessage();
|
|
|
|
/** start to connect to a friend **/
|
|
|
|
void connectfriend();
|
|
|
|
/** show peers details for each friend **/
|
|
|
|
void configurefriend();
|
|
|
|
|
|
|
|
/** Open Shared Manager **/
|
2009-01-08 12:29:01 -05:00
|
|
|
void openShareManager();
|
2010-02-03 12:39:30 -05:00
|
|
|
|
|
|
|
/** get own last stored Avatar**/
|
|
|
|
void getAvatar();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
void changeAvatarClicked();
|
2010-01-25 17:08:23 -05:00
|
|
|
|
2010-02-03 12:39:30 -05:00
|
|
|
void loadmystatus();
|
|
|
|
void loadstatus();
|
|
|
|
|
|
|
|
void on_actionSort_Peers_Descending_Order_activated();
|
|
|
|
void on_actionSort_Peers_Ascending_Order_activated();
|
|
|
|
void on_actionRoot_is_decorated_activated();
|
|
|
|
void on_actionRoot_isnot_decorated_activated();
|
|
|
|
|
|
|
|
void displayMenu();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void friendsUpdated() ;
|
2009-01-03 21:28:30 -05:00
|
|
|
|
|
|
|
private:
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2009-11-30 11:12:13 -05:00
|
|
|
static MessengerWindow *mv;
|
2007-11-14 22:18:48 -05:00
|
|
|
/* Worker Functions */
|
|
|
|
/* (1) Update Display */
|
|
|
|
|
|
|
|
/* (2) Utility Fns */
|
2010-02-03 12:39:30 -05:00
|
|
|
QTreeWidgetItem *getCurrentPeer();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-02-03 12:39:30 -05:00
|
|
|
std::map<std::string, PopupChatDialog *> chatDialogs;
|
2009-01-07 16:12:31 -05:00
|
|
|
|
2010-02-03 12:39:30 -05:00
|
|
|
class QLabel *iconLabel, *textLabel;
|
|
|
|
class QWidget *widget;
|
|
|
|
class QWidgetAction *widgetAction;
|
|
|
|
class QSpacerItem *spacerItem;
|
2009-01-07 16:12:31 -05:00
|
|
|
|
2009-01-03 21:28:30 -05:00
|
|
|
/** Define the popup menus for the Context menu */
|
2007-11-14 22:18:48 -05:00
|
|
|
QMenu* contextMnu;
|
2009-01-03 21:28:30 -05:00
|
|
|
/** Defines the actions for the context menu */
|
2007-11-14 22:18:48 -05:00
|
|
|
QAction* chatAct;
|
|
|
|
QAction* sendMessageAct;
|
|
|
|
QAction* connectfriendAct;
|
|
|
|
QAction* configurefriendAct;
|
|
|
|
QAction* exportfriendAct;
|
2010-02-03 12:39:30 -05:00
|
|
|
QAction* removefriendAct;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
QTreeView *messengertreeWidget;
|
|
|
|
|
|
|
|
LogoBar * _rsLogoBarmessenger;
|
2009-09-30 18:10:49 -04:00
|
|
|
|
|
|
|
QFont itemFont;
|
2009-01-03 21:28:30 -05:00
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::MessengerWindow ui;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|