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
|
|
|
|
|
2007-11-16 20:35:52 -05:00
|
|
|
#include "ui_MessengerWindow.h"
|
2010-02-03 12:39:30 -05:00
|
|
|
|
2009-01-07 16:12:31 -05:00
|
|
|
#include <gui/common/rwindow.h>
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
class LogoBar;
|
2008-07-10 14:52:56 -04:00
|
|
|
class PeersDialog;
|
2010-06-17 13:39:32 -04:00
|
|
|
class PopupChatDialog;
|
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
|
|
|
{
|
2010-06-17 13:39:32 -04:00
|
|
|
Q_OBJECT
|
2007-11-16 20:35:52 -05:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
public:
|
|
|
|
QPixmap picture;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
static MessengerWindow* getInstance();
|
|
|
|
static void releaseInstance();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2009-01-03 21:28:30 -05:00
|
|
|
public slots:
|
2010-06-17 13:39:32 -04:00
|
|
|
/** Called when this dialog is to be displayed */
|
|
|
|
void show();
|
|
|
|
void updateMessengerDisplay() ;
|
|
|
|
void updatePeersAvatar(const QString& peer_id);
|
|
|
|
void updateAvatar();
|
|
|
|
void loadmystatusmessage();
|
|
|
|
void loadOwnStatus();
|
|
|
|
void checkAndSetIdle(int idleTime);
|
2010-04-27 08:21:39 -04:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
LogoBar & getLogoBar() const;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
|
|
|
protected:
|
2010-06-17 13:39:32 -04:00
|
|
|
/** Default Constructor */
|
|
|
|
MessengerWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
|
|
|
/** Default Destructor */
|
|
|
|
~MessengerWindow();
|
2009-01-03 21:28:30 -05:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
void closeEvent (QCloseEvent * event);
|
2009-01-03 21:28:30 -05:00
|
|
|
|
|
|
|
private slots:
|
2010-06-17 13:39:32 -04:00
|
|
|
/** Create the context popup menu and it's submenus */
|
|
|
|
void messengertreeWidgetCostumPopupMenu( QPoint point );
|
2009-01-03 21:28:30 -05:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
/** Add a new friend */
|
|
|
|
void addFriend();
|
|
|
|
/** Export friend */
|
|
|
|
void exportfriend();
|
|
|
|
/** Remove friend */
|
|
|
|
void removefriend();
|
|
|
|
/** start a chat with a friend **/
|
|
|
|
void chatfriend(QTreeWidgetItem *pPeer);
|
|
|
|
void chatfriendproxy();
|
|
|
|
/** start Messages Composer **/
|
|
|
|
void sendMessage();
|
|
|
|
/** start to connect to a friend **/
|
|
|
|
void connectfriend();
|
|
|
|
/** show peers details for each friend **/
|
|
|
|
void configurefriend();
|
|
|
|
|
|
|
|
/** Open Shared Manager **/
|
|
|
|
void openShareManager();
|
|
|
|
|
|
|
|
/** get own last stored Avatar**/
|
|
|
|
void getAvatar();
|
|
|
|
|
|
|
|
void changeAvatarClicked();
|
|
|
|
|
|
|
|
void savestatusmessage();
|
|
|
|
|
|
|
|
void on_actionSort_Peers_Descending_Order_activated();
|
|
|
|
void on_actionSort_Peers_Ascending_Order_activated();
|
|
|
|
void on_actionRoot_is_decorated_activated();
|
|
|
|
|
|
|
|
void displayMenu();
|
|
|
|
|
|
|
|
void filterRegExpChanged();
|
|
|
|
void clearFilter();
|
2010-02-03 12:39:30 -05:00
|
|
|
|
|
|
|
signals:
|
2010-06-17 13:39:32 -04:00
|
|
|
void friendsUpdated() ;
|
2009-01-03 21:28:30 -05:00
|
|
|
|
|
|
|
private:
|
2010-06-17 13:39:32 -04:00
|
|
|
static MessengerWindow *mv;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
void processSettings(bool bLoad);
|
2010-04-27 08:21:39 -04:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
/* Worker Functions */
|
|
|
|
/* (1) Update Display */
|
2009-01-07 16:12:31 -05:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
/* (2) Utility Fns */
|
|
|
|
QTreeWidgetItem *getCurrentPeer();
|
|
|
|
void savestatus();
|
|
|
|
void insertPeers();
|
|
|
|
// idle function
|
|
|
|
void setIdle(bool Idle);
|
|
|
|
bool isIdle;
|
|
|
|
const unsigned long maxTimeBeforeIdle;
|
2009-01-07 16:12:31 -05:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
void FilterItems();
|
|
|
|
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
class QLabel *iconLabel, *textLabel;
|
|
|
|
class QWidget *widget;
|
|
|
|
class QWidgetAction *widgetAction;
|
|
|
|
class QSpacerItem *spacerItem;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-06-17 13:39:32 -04:00
|
|
|
/** Defines the actions for the context menu */
|
|
|
|
QAction* chatAct;
|
|
|
|
QAction* sendMessageAct;
|
|
|
|
QAction* connectfriendAct;
|
|
|
|
QAction* configurefriendAct;
|
|
|
|
QAction* exportfriendAct;
|
|
|
|
QAction* removefriendAct;
|
|
|
|
|
|
|
|
QTreeView *messengertreeWidget;
|
|
|
|
|
|
|
|
LogoBar * _rsLogoBarmessenger;
|
|
|
|
|
|
|
|
QFont itemFont;
|
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::MessengerWindow ui;
|
2009-01-03 21:28:30 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|