2007-11-14 22:18:48 -05:00
|
|
|
/****************************************************************
|
|
|
|
* RShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006, crypton
|
|
|
|
*
|
|
|
|
* 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-22 20:58:56 -05:00
|
|
|
****************************************************************/
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#ifndef _PEERSDIALOG_H
|
2009-01-22 20:58:56 -05:00
|
|
|
#define _PEERSDIALOG_H
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#include <QFileDialog>
|
|
|
|
|
2008-07-10 06:34:49 -04:00
|
|
|
#include "chat/PopupChatDialog.h"
|
2010-05-11 20:17:10 -04:00
|
|
|
#include "chat/HandleRichText.h"
|
2009-11-17 07:45:06 -05:00
|
|
|
#include "RsAutoUpdatePage.h"
|
2009-01-22 20:58:56 -05:00
|
|
|
|
|
|
|
#include "mainpage.h"
|
|
|
|
#include "ui_PeersDialog.h"
|
|
|
|
|
2009-03-12 10:14:55 -04:00
|
|
|
#include "im_history/IMHistoryKeeper.h"
|
|
|
|
|
2008-07-10 06:34:49 -04:00
|
|
|
class QFont;
|
|
|
|
class QAction;
|
|
|
|
class QTextEdit;
|
|
|
|
class QTextCharFormat;
|
2007-11-14 22:18:48 -05:00
|
|
|
class ChatDialog;
|
|
|
|
|
2009-11-17 07:45:06 -05:00
|
|
|
class PeersDialog : public RsAutoUpdatePage
|
2009-01-22 20:58:56 -05:00
|
|
|
{
|
2009-10-04 18:27:42 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
2010-01-31 17:29:30 -05:00
|
|
|
public:
|
2009-10-04 18:27:42 -04:00
|
|
|
/** Default Constructor */
|
|
|
|
PeersDialog(QWidget *parent = 0);
|
|
|
|
/** Default Destructor */
|
2010-05-11 16:02:52 -04:00
|
|
|
~PeersDialog ();
|
2009-10-04 18:27:42 -04:00
|
|
|
|
|
|
|
PopupChatDialog *getPrivateChat(std::string id, std::string name, uint chatflags);
|
|
|
|
void clearOldChats();
|
|
|
|
|
|
|
|
void loadEmoticonsgroupchat();
|
|
|
|
// void setChatDialog(ChatDialog *cd);
|
|
|
|
|
2009-11-17 07:45:06 -05:00
|
|
|
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage
|
2010-05-06 10:39:50 -04:00
|
|
|
// replaced by shortcut
|
|
|
|
// virtual void keyPressEvent(QKeyEvent *) ;
|
2009-10-04 18:27:42 -04:00
|
|
|
|
2010-01-31 17:29:30 -05:00
|
|
|
public slots:
|
2009-10-04 18:27:42 -04:00
|
|
|
|
2010-01-17 12:58:28 -05:00
|
|
|
void insertPeers();
|
2009-10-04 18:27:42 -04:00
|
|
|
void toggleSendItem( QTreeWidgetItem *item, int col );
|
|
|
|
|
|
|
|
void insertChat();
|
|
|
|
void setChatInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
|
|
|
|
void resetStatusBar() ;
|
|
|
|
|
2010-01-31 17:29:30 -05:00
|
|
|
void fileHashingFinished(AttachFileItem* file);
|
2009-10-04 18:27:42 -04:00
|
|
|
|
|
|
|
void smileyWidgetgroupchat();
|
|
|
|
void addSmileys();
|
|
|
|
|
|
|
|
void on_actionClearChat_triggered();
|
|
|
|
void displayInfoChatMenu(const QPoint& pos);
|
|
|
|
|
|
|
|
// called by notifyQt when another peer is typing (in group chant and private chat)
|
|
|
|
void updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
|
|
|
|
|
|
|
|
void updatePeersCustomStateString(const QString& peer_id) ;
|
|
|
|
void updatePeersAvatar(const QString& peer_id);
|
|
|
|
void updateAvatar(); // called by notifyQt to update the avatar when it gets changed by another component
|
2010-01-31 17:29:30 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void dragEnterEvent(QDragEnterEvent *event);
|
|
|
|
virtual void dropEvent(QDropEvent *event);
|
2009-10-04 18:27:42 -04:00
|
|
|
|
2010-01-31 17:29:30 -05:00
|
|
|
private slots:
|
2010-03-17 11:34:36 -04:00
|
|
|
void pasteLink() ;
|
|
|
|
void contextMenu(QPoint) ;
|
2009-10-04 18:27:42 -04:00
|
|
|
|
2010-01-31 17:29:30 -05:00
|
|
|
/** Create the context popup menu and it's submenus */
|
|
|
|
void peertreeWidgetCostumPopupMenu( QPoint point );
|
2009-10-04 18:27:42 -04:00
|
|
|
|
|
|
|
void updateStatusString(const QString& statusString) ; // called when a peer is typing in group chat
|
|
|
|
void updateStatusTyping() ; // called each time a key is hit
|
|
|
|
|
|
|
|
//void updatePeerStatusString(const QString& peer_id,const QString& chat_status) ;
|
|
|
|
|
|
|
|
/** Export friend in Friends Dialog */
|
|
|
|
void exportfriend();
|
|
|
|
/** Remove friend */
|
|
|
|
void removefriend();
|
|
|
|
/** start a chat with a friend **/
|
2010-04-15 08:02:23 -04:00
|
|
|
void chatfriend(QTreeWidgetItem* );
|
|
|
|
void chatfriendproxy();
|
2009-10-04 18:27:42 -04:00
|
|
|
void msgfriend();
|
|
|
|
|
|
|
|
void configurefriend();
|
|
|
|
void viewprofile();
|
|
|
|
|
|
|
|
/** RsServer Friend Calls */
|
|
|
|
void connectfriend();
|
|
|
|
|
|
|
|
void setColor();
|
|
|
|
void insertSendList();
|
|
|
|
void checkChat();
|
|
|
|
void sendMsg();
|
2009-10-08 15:08:44 -04:00
|
|
|
|
|
|
|
void statusmessage();
|
2009-10-04 18:27:42 -04:00
|
|
|
|
|
|
|
void setFont();
|
|
|
|
void getFont();
|
|
|
|
void underline();
|
|
|
|
|
|
|
|
void changeAvatarClicked();
|
|
|
|
void getAvatar();
|
|
|
|
|
|
|
|
void on_actionAdd_Friend_activated();
|
2010-01-16 20:36:50 -05:00
|
|
|
void on_actionCreate_New_Forum_activated();
|
|
|
|
void on_actionCreate_New_Channel_activated();
|
2009-10-04 18:27:42 -04:00
|
|
|
|
|
|
|
void loadmypersonalstatus();
|
2010-01-31 17:29:30 -05:00
|
|
|
|
|
|
|
void addExtraFile();
|
|
|
|
void anchorClicked (const QUrl &);
|
|
|
|
void addAttachment(std::string);
|
2010-04-27 18:08:38 -04:00
|
|
|
|
|
|
|
bool fileSave();
|
|
|
|
bool fileSaveAs();
|
2010-01-31 17:29:30 -05:00
|
|
|
|
2010-04-27 18:08:38 -04:00
|
|
|
void setCurrentFileName(const QString &fileName);
|
2009-09-02 18:42:31 -04:00
|
|
|
|
2009-05-15 08:07:37 -04:00
|
|
|
signals:
|
2009-10-04 18:27:42 -04:00
|
|
|
void friendsUpdated() ;
|
|
|
|
void notifyGroupChat(const QString&,const QString&) ;
|
2010-04-15 08:02:23 -04:00
|
|
|
void startChat(QTreeWidgetItem* );
|
2009-10-04 18:27:42 -04:00
|
|
|
|
2010-01-31 17:29:30 -05:00
|
|
|
private:
|
2009-10-04 18:27:42 -04:00
|
|
|
class QLabel *iconLabel, *textLabel;
|
|
|
|
class QWidget *widget;
|
|
|
|
class QWidgetAction *widgetAction;
|
2010-04-27 18:08:38 -04:00
|
|
|
class QSpacerItem *spacerItem;
|
2010-05-05 07:47:29 -04:00
|
|
|
|
|
|
|
///play the sound when recv a message
|
|
|
|
void playsound();
|
2010-05-11 20:17:10 -04:00
|
|
|
|
|
|
|
QString fileName;
|
|
|
|
|
|
|
|
/** store default information for embedding HTML */
|
|
|
|
RsChat::EmbedInHtmlAhref defEmbedAhref;
|
|
|
|
RsChat::EmbedInHtmlImg defEmbedImg;
|
2009-10-04 18:27:42 -04:00
|
|
|
|
|
|
|
/* Worker Functions */
|
|
|
|
/* (1) Update Display */
|
|
|
|
|
|
|
|
/* (2) Utility Fns */
|
|
|
|
QTreeWidgetItem *getCurrentPeer();
|
|
|
|
|
|
|
|
/** Defines the actions for the context menu */
|
|
|
|
QAction* chatAct;
|
2010-03-17 11:34:36 -04:00
|
|
|
QAction* pasteLinkAct;
|
2009-10-04 18:27:42 -04:00
|
|
|
QAction* msgAct;
|
|
|
|
QAction* connectfriendAct;
|
|
|
|
QAction* profileviewAct;
|
|
|
|
QAction* configurefriendAct;
|
|
|
|
QAction* exportfriendAct;
|
|
|
|
QAction* removefriendAct;
|
|
|
|
|
2010-04-27 18:08:38 -04:00
|
|
|
//QTreeWidget *peertreeWidget;
|
2009-10-04 18:27:42 -04:00
|
|
|
|
|
|
|
IMHistoryKeeper historyKeeper;
|
|
|
|
|
|
|
|
QColor _currentColor;
|
|
|
|
bool _underline;
|
|
|
|
time_t last_status_send_time ;
|
2010-05-11 20:17:10 -04:00
|
|
|
|
2009-10-04 19:03:25 -04:00
|
|
|
QHash<QString, QString> smileys;
|
2010-05-12 15:03:30 -04:00
|
|
|
QWidget *smWidget;
|
2009-10-04 18:27:42 -04:00
|
|
|
|
|
|
|
std::map<std::string, PopupChatDialog *> chatDialogs;
|
|
|
|
|
|
|
|
QFont mCurrentFont; /* how the text will come out */
|
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::PeersDialog ui;
|
2009-01-22 20:58:56 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-05-11 20:17:10 -04:00
|
|
|
#endif
|