mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -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 RsPQIService ;
|
||||
class RsAutoUpdatePage ;
|
||||
class PopupChatDialog ;
|
||||
|
||||
// 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 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 ; }
|
||||
|
||||
//
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsplugin.h>
|
||||
|
||||
static std::map<std::string, ChatDialog*> chatDialogs;
|
||||
|
||||
@ -110,7 +111,14 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
|
||||
} else {
|
||||
RsPeerDetails sslDetails;
|
||||
if (rsPeers->getPeerDetails(peerId, sslDetails)) {
|
||||
|
||||
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;
|
||||
cd->init(peerId, PeerDefs::nameWithLocation(sslDetails));
|
||||
}
|
||||
|
@ -123,6 +123,11 @@ ChatWidget::~ChatWidget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ChatWidget::addChatButton(QPushButton *button)
|
||||
{
|
||||
ui->chatButtonLayout->addWidget(button) ;
|
||||
}
|
||||
|
||||
void ChatWidget::init(const std::string &peerId, const QString &title)
|
||||
{
|
||||
this->peerId = peerId;
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
class QAction;
|
||||
class QTextEdit;
|
||||
class QPushButton;
|
||||
|
||||
namespace Ui {
|
||||
class ChatWidget;
|
||||
@ -71,6 +72,8 @@ public:
|
||||
bool setStyle();
|
||||
const RSStyle *getStyle() { return &style; }
|
||||
|
||||
void addChatButton(QPushButton *button) ;
|
||||
|
||||
private slots:
|
||||
void clearChatHistory();
|
||||
void deleteChatHistory();
|
||||
@ -85,6 +88,8 @@ protected:
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
void updateTitle();
|
||||
virtual void updateStatus(const QString &peer_id, int status);
|
||||
void resetStatusBar() ;
|
||||
|
||||
private slots:
|
||||
void pasteLink();
|
||||
@ -95,8 +100,6 @@ private slots:
|
||||
void smileyWidget();
|
||||
void addSmiley();
|
||||
|
||||
void resetStatusBar() ;
|
||||
|
||||
void addExtraFile();
|
||||
void addExtraPicture();
|
||||
void on_closeInfoFrameButton_clicked();
|
||||
@ -108,7 +111,6 @@ private slots:
|
||||
|
||||
void sendChat();
|
||||
|
||||
void updateStatus(const QString &peer_id, int status);
|
||||
void updatePeersCustomStateString(const QString& peer_id, const QString& status_string) ;
|
||||
|
||||
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)
|
||||
{
|
||||
if (list == NOTIFY_LIST_PRIVATE_OUTGOING_CHAT) {
|
||||
|
@ -52,6 +52,9 @@ protected:
|
||||
|
||||
void processSettings(bool load);
|
||||
|
||||
// used by plugins
|
||||
void addButton(QPushButton *button) ;
|
||||
|
||||
protected:
|
||||
virtual void addIncomingChatMsg(const ChatInfo& info);
|
||||
virtual void onChatChanged(int list, int type);
|
||||
|
Loading…
Reference in New Issue
Block a user