mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 08:29:32 -05:00
added ability for plugins to return their own PopupChatDialog class
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4988 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
63cd9d65f2
commit
96fd780502
@ -48,6 +48,7 @@ class ftServer ;
|
|||||||
class ConfigPage ;
|
class ConfigPage ;
|
||||||
class RsPQIService ;
|
class RsPQIService ;
|
||||||
class RsAutoUpdatePage ;
|
class RsAutoUpdatePage ;
|
||||||
|
class PopupChatDialog ;
|
||||||
|
|
||||||
// Used for the status of plugins.
|
// Used for the status of plugins.
|
||||||
//
|
//
|
||||||
@ -114,6 +115,10 @@ class RsPlugin
|
|||||||
virtual RsAutoUpdatePage *qt_transfers_tab() const { return NULL ; } // Tab to add in transfers, after turtle statistics.
|
virtual RsAutoUpdatePage *qt_transfers_tab() const { return NULL ; } // Tab to add in transfers, after turtle statistics.
|
||||||
virtual std::string qt_transfers_tab_name()const { return "Tab" ; } // Tab name
|
virtual std::string qt_transfers_tab_name()const { return "Tab" ; } // Tab name
|
||||||
|
|
||||||
|
// Any derived class of PopupChatDialog to be used for chat.
|
||||||
|
//
|
||||||
|
virtual PopupChatDialog *qt_allocate_new_popup_chat_dialog() const { return NULL ; }
|
||||||
|
|
||||||
virtual QTranslator *qt_translator(QApplication * /* app */, const QString& /* languageCode */ ) const { return NULL ; }
|
virtual QTranslator *qt_translator(QApplication * /* app */, const QString& /* languageCode */ ) const { return NULL ; }
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <retroshare/rsiface.h>
|
#include <retroshare/rsiface.h>
|
||||||
#include <retroshare/rsnotify.h>
|
#include <retroshare/rsnotify.h>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
|
#include <retroshare/rsplugin.h>
|
||||||
|
|
||||||
static std::map<std::string, ChatDialog*> chatDialogs;
|
static std::map<std::string, ChatDialog*> chatDialogs;
|
||||||
|
|
||||||
@ -110,7 +111,14 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
|
|||||||
} else {
|
} else {
|
||||||
RsPeerDetails sslDetails;
|
RsPeerDetails sslDetails;
|
||||||
if (rsPeers->getPeerDetails(peerId, sslDetails)) {
|
if (rsPeers->getPeerDetails(peerId, sslDetails)) {
|
||||||
cd = new PopupChatDialog();
|
|
||||||
|
for(int i=0;i<rsPlugins->nbPlugins();++i)
|
||||||
|
if(rsPlugins->plugin(i) != NULL && (cd = rsPlugins->plugin(i)->qt_allocate_new_popup_chat_dialog()) != NULL)
|
||||||
|
break ;
|
||||||
|
|
||||||
|
if(cd == NULL)
|
||||||
|
cd = new PopupChatDialog();
|
||||||
|
|
||||||
chatDialogs[peerId] = cd;
|
chatDialogs[peerId] = cd;
|
||||||
cd->init(peerId, PeerDefs::nameWithLocation(sslDetails));
|
cd->init(peerId, PeerDefs::nameWithLocation(sslDetails));
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,11 @@ ChatWidget::~ChatWidget()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatWidget::addChatButton(QPushButton *button)
|
||||||
|
{
|
||||||
|
ui->chatButtonLayout->addWidget(button) ;
|
||||||
|
}
|
||||||
|
|
||||||
void ChatWidget::init(const std::string &peerId, const QString &title)
|
void ChatWidget::init(const std::string &peerId, const QString &title)
|
||||||
{
|
{
|
||||||
this->peerId = peerId;
|
this->peerId = peerId;
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
class QTextEdit;
|
class QTextEdit;
|
||||||
|
class QPushButton;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ChatWidget;
|
class ChatWidget;
|
||||||
@ -71,6 +72,8 @@ public:
|
|||||||
bool setStyle();
|
bool setStyle();
|
||||||
const RSStyle *getStyle() { return &style; }
|
const RSStyle *getStyle() { return &style; }
|
||||||
|
|
||||||
|
void addChatButton(QPushButton *button) ;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void clearChatHistory();
|
void clearChatHistory();
|
||||||
void deleteChatHistory();
|
void deleteChatHistory();
|
||||||
@ -85,6 +88,8 @@ protected:
|
|||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
virtual void resizeEvent(QResizeEvent *event);
|
virtual void resizeEvent(QResizeEvent *event);
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
virtual void updateStatus(const QString &peer_id, int status);
|
||||||
|
void resetStatusBar() ;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void pasteLink();
|
void pasteLink();
|
||||||
@ -95,8 +100,6 @@ private slots:
|
|||||||
void smileyWidget();
|
void smileyWidget();
|
||||||
void addSmiley();
|
void addSmiley();
|
||||||
|
|
||||||
void resetStatusBar() ;
|
|
||||||
|
|
||||||
void addExtraFile();
|
void addExtraFile();
|
||||||
void addExtraPicture();
|
void addExtraPicture();
|
||||||
void on_closeInfoFrameButton_clicked();
|
void on_closeInfoFrameButton_clicked();
|
||||||
@ -108,7 +111,6 @@ private slots:
|
|||||||
|
|
||||||
void sendChat();
|
void sendChat();
|
||||||
|
|
||||||
void updateStatus(const QString &peer_id, int status);
|
|
||||||
void updatePeersCustomStateString(const QString& peer_id, const QString& status_string) ;
|
void updatePeersCustomStateString(const QString& peer_id, const QString& status_string) ;
|
||||||
|
|
||||||
bool fileSave();
|
bool fileSave();
|
||||||
|
@ -133,6 +133,11 @@ void PopupChatDialog::addIncomingChatMsg(const ChatInfo& info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PopupChatDialog::addButton(QPushButton *button)
|
||||||
|
{
|
||||||
|
getChatWidget()->addChatButton(button) ;
|
||||||
|
}
|
||||||
|
|
||||||
void PopupChatDialog::onChatChanged(int list, int type)
|
void PopupChatDialog::onChatChanged(int list, int type)
|
||||||
{
|
{
|
||||||
if (list == NOTIFY_LIST_PRIVATE_OUTGOING_CHAT) {
|
if (list == NOTIFY_LIST_PRIVATE_OUTGOING_CHAT) {
|
||||||
|
@ -52,6 +52,9 @@ protected:
|
|||||||
|
|
||||||
void processSettings(bool load);
|
void processSettings(bool load);
|
||||||
|
|
||||||
|
// used by plugins
|
||||||
|
void addButton(QPushButton *button) ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void addIncomingChatMsg(const ChatInfo& info);
|
virtual void addIncomingChatMsg(const ChatInfo& info);
|
||||||
virtual void onChatChanged(int list, int type);
|
virtual void onChatChanged(int list, int type);
|
||||||
|
Loading…
Reference in New Issue
Block a user