2007-11-14 22:18:48 -05:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare 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.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _POPUPCHATDIALOG_H
|
|
|
|
#define _POPUPCHATDIALOG_H
|
|
|
|
|
|
|
|
#include "ui_PopupChatDialog.h"
|
|
|
|
|
2009-01-03 21:28:30 -05:00
|
|
|
class QAction;
|
|
|
|
class QTextEdit;
|
2007-11-14 22:18:48 -05:00
|
|
|
class QTextCharFormat;
|
2008-02-04 12:55:59 -05:00
|
|
|
class ChatInfo;
|
|
|
|
|
2010-10-02 18:42:30 -04:00
|
|
|
#include <retroshare/rsmsgs.h>
|
2010-09-04 10:23:30 -04:00
|
|
|
#include "ChatStyle.h"
|
2011-04-09 18:52:52 -04:00
|
|
|
#include "gui/style/RSStyle.h"
|
2010-09-04 10:23:30 -04:00
|
|
|
|
2010-11-15 15:49:24 -05:00
|
|
|
class PopupChatDialog : public QWidget
|
2007-11-14 22:18:48 -05:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2010-10-02 18:42:30 -04:00
|
|
|
public:
|
|
|
|
enum enumChatType { TYPE_NORMAL, TYPE_HISTORY, TYPE_OFFLINE };
|
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
public:
|
2010-11-15 15:49:24 -05:00
|
|
|
static PopupChatDialog *getExistingInstance(const std::string &id);
|
|
|
|
static PopupChatDialog *getPrivateChat(const std::string &id, uint chatflags);
|
2010-11-13 16:53:06 -05:00
|
|
|
static void cleanupChat();
|
2010-11-15 15:49:24 -05:00
|
|
|
static void chatFriend(const std::string &id);
|
2011-12-27 08:47:37 -05:00
|
|
|
static void closeChat(const std::string &id);
|
2010-11-13 16:53:06 -05:00
|
|
|
static void privateChatChanged(int list, int type);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-11-21 16:12:35 -05:00
|
|
|
void updateStatusString(const QString& peer_id, const QString& statusString);
|
2010-11-15 15:49:24 -05:00
|
|
|
std::string getPeerId() { return dialogId; }
|
|
|
|
QString getTitle() { return dialogName; }
|
|
|
|
bool hasNewMessages() { return newMessages; }
|
|
|
|
bool isTyping() { return typing; }
|
|
|
|
int getPeerStatus() { return peerStatus; }
|
|
|
|
void focusDialog();
|
|
|
|
void activate();
|
2011-04-09 18:52:52 -04:00
|
|
|
bool setStyle();
|
|
|
|
const RSStyle &getStyle();
|
2011-12-04 09:31:48 -05:00
|
|
|
virtual void updateStatus(const QString &peer_id, int status);
|
2010-09-02 06:15:13 -04:00
|
|
|
|
2008-03-22 22:21:17 -04:00
|
|
|
public slots:
|
2011-12-04 09:31:48 -05:00
|
|
|
void updateStatus_slot(const QString &peer_id, int status);
|
2009-05-11 10:21:11 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
protected:
|
2010-11-13 16:53:06 -05:00
|
|
|
/** Default constructor */
|
2010-11-15 15:49:24 -05:00
|
|
|
PopupChatDialog(const std::string &id, const QString &name, QWidget *parent = 0, Qt::WFlags flags = 0);
|
2010-11-13 16:53:06 -05:00
|
|
|
/** Default destructor */
|
|
|
|
~PopupChatDialog();
|
2010-06-17 13:39:32 -04:00
|
|
|
|
2010-11-15 15:49:24 -05:00
|
|
|
virtual void resizeEvent(QResizeEvent *event);
|
2009-05-11 10:27:45 -04:00
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
bool eventFilter(QObject *obj, QEvent *ev);
|
2010-09-01 13:56:15 -04:00
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
void insertChatMsgs();
|
2011-09-29 05:20:09 -04:00
|
|
|
void addChatMsg(bool incoming, const QString &name, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, enumChatType chatType);
|
2011-12-28 04:15:28 -05:00
|
|
|
virtual void addIncomingChatMsg(const ChatInfo& info) ; // derived in ChatLobbyDialog.
|
2010-09-01 13:56:15 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
private slots:
|
2010-11-21 16:12:35 -05:00
|
|
|
void pasteLink() ;
|
|
|
|
void contextMenu(QPoint) ;
|
|
|
|
|
2011-12-07 08:08:12 -05:00
|
|
|
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
2010-11-21 16:12:35 -05:00
|
|
|
|
|
|
|
void smileyWidget();
|
|
|
|
void addSmiley();
|
|
|
|
|
|
|
|
void resetStatusBar() ;
|
|
|
|
void updateStatusTyping() ;
|
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
void on_actionMessageHistory_triggered();
|
|
|
|
void addExtraFile();
|
|
|
|
void addExtraPicture();
|
|
|
|
void showAvatarFrame(bool show);
|
|
|
|
void on_closeInfoFrameButton_clicked();
|
2008-03-21 13:30:15 -04:00
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
void setColor();
|
|
|
|
void getFont();
|
|
|
|
void setFont();
|
2009-01-03 21:28:30 -05:00
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
void sendChat();
|
2010-09-02 06:15:13 -04:00
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
void updatePeersCustomStateString(const QString& peer_id, const QString& status_string) ;
|
2010-09-02 06:15:13 -04:00
|
|
|
|
2011-02-06 15:41:15 -05:00
|
|
|
void on_actionClear_Chat_History_triggered();
|
2011-02-08 16:59:17 -05:00
|
|
|
void on_actionDelete_Chat_History_triggered();
|
2009-01-03 21:28:30 -05:00
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
bool fileSave();
|
|
|
|
bool fileSaveAs();
|
|
|
|
void clearOfflineMessages();
|
2010-08-18 08:02:36 -04:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
private:
|
2010-11-13 16:53:06 -05:00
|
|
|
void setCurrentFileName(const QString &fileName);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
void colorChanged(const QColor &c);
|
|
|
|
void fontChanged(const QFont &font);
|
|
|
|
void processSettings(bool bLoad);
|
2009-05-11 10:27:45 -04:00
|
|
|
|
2011-09-29 05:52:01 -04:00
|
|
|
void onPrivateChatChanged(int list, int type);
|
2010-09-20 20:08:06 -04:00
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
QAction *actionTextBold;
|
|
|
|
QAction *actionTextUnderline;
|
|
|
|
QAction *actionTextItalic;
|
2010-09-02 06:15:13 -04:00
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
std::string dialogId;
|
|
|
|
QString dialogName;
|
|
|
|
unsigned int lastChatTime;
|
|
|
|
std::string lastChatName;
|
2010-09-02 06:15:13 -04:00
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
time_t last_status_send_time ;
|
|
|
|
QColor mCurrentColor;
|
|
|
|
QFont mCurrentFont;
|
2010-09-02 06:15:13 -04:00
|
|
|
|
2011-09-29 05:20:09 -04:00
|
|
|
std::list<ChatInfo> savedOfflineChat;
|
2010-11-13 16:53:06 -05:00
|
|
|
QString wholeChat;
|
|
|
|
QString fileName;
|
2010-09-01 13:56:15 -04:00
|
|
|
|
2010-11-15 15:49:24 -05:00
|
|
|
bool newMessages;
|
|
|
|
bool typing;
|
|
|
|
int peerStatus;
|
2011-04-09 18:52:52 -04:00
|
|
|
ChatStyle chatStyle;
|
2011-09-29 05:20:09 -04:00
|
|
|
bool manualDelete;
|
2010-09-01 13:56:15 -04:00
|
|
|
|
2011-04-09 18:52:52 -04:00
|
|
|
RSStyle style;
|
|
|
|
|
2011-11-27 16:04:10 -05:00
|
|
|
protected:
|
|
|
|
virtual bool sendPrivateChat(const std::wstring& msg) ; // can be derived to send chat to e.g. a chat lobby
|
|
|
|
|
2010-11-13 16:53:06 -05:00
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::PopupChatDialog ui;
|
2007-11-14 22:18:48 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|