2012-02-18 10:56:37 -05:00
|
|
|
#include <retroshare/rsplugin.h>
|
2012-02-21 16:53:25 -05:00
|
|
|
#include <retroshare-gui/RsAutoUpdatePage.h>
|
2012-02-18 10:56:37 -05:00
|
|
|
#include <QTranslator>
|
|
|
|
#include <QApplication>
|
2012-02-21 16:53:25 -05:00
|
|
|
#include <QString>
|
2012-02-18 10:56:37 -05:00
|
|
|
|
|
|
|
#include "VOIPPlugin.h"
|
2012-02-19 10:07:47 -05:00
|
|
|
#include "interface/rsvoip.h"
|
2012-02-21 16:53:25 -05:00
|
|
|
|
|
|
|
#include "gui/VoipStatistics.h"
|
2012-02-19 10:07:47 -05:00
|
|
|
#include "gui/AudioInputConfig.h"
|
2012-02-25 07:18:40 -05:00
|
|
|
#include "gui/AudioPopupChatDialog.h"
|
2012-02-25 13:15:36 -05:00
|
|
|
#include "gui/PluginGUIHandler.h"
|
|
|
|
#include "gui/PluginNotifier.h"
|
2012-02-18 10:56:37 -05:00
|
|
|
|
2012-02-18 15:30:10 -05:00
|
|
|
static void *inited = new VOIPPlugin() ;
|
2012-02-18 10:56:37 -05:00
|
|
|
|
|
|
|
extern "C" {
|
2012-02-25 13:15:36 -05:00
|
|
|
|
|
|
|
// This is *the* function required by RS plugin system to give RS access to the plugin.
|
|
|
|
// Be careful to:
|
|
|
|
// - always respect the C linkage convention
|
|
|
|
// - always return an object of type RsPlugin*
|
|
|
|
//
|
2012-02-18 10:56:37 -05:00
|
|
|
void *RETROSHARE_PLUGIN_provide()
|
|
|
|
{
|
|
|
|
static VOIPPlugin *p = new VOIPPlugin() ;
|
|
|
|
|
|
|
|
return (void*)p ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VOIPPlugin::getPluginVersion(int& major,int& minor,int& svn_rev) const
|
|
|
|
{
|
|
|
|
major = 5 ;
|
|
|
|
minor = 1 ;
|
|
|
|
svn_rev = 4350 ;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOIPPlugin::VOIPPlugin()
|
|
|
|
{
|
|
|
|
mVoip = NULL ;
|
|
|
|
mPlugInHandler = NULL;
|
|
|
|
mPeers = NULL;
|
2012-02-18 15:30:10 -05:00
|
|
|
config_page = NULL ;
|
2012-02-25 13:15:36 -05:00
|
|
|
|
|
|
|
mPluginGUIHandler = new PluginGUIHandler ;
|
|
|
|
mPluginNotifier = new PluginNotifier ;
|
|
|
|
|
|
|
|
QObject::connect(mPluginNotifier,SIGNAL(voipInvitationReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedInvitation(const QString&)),Qt::QueuedConnection) ;
|
|
|
|
QObject::connect(mPluginNotifier,SIGNAL(voipDataReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedVoipData(const QString&)),Qt::QueuedConnection) ;
|
2012-02-26 10:49:07 -05:00
|
|
|
QObject::connect(mPluginNotifier,SIGNAL(voipAcceptReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedVoipAccept(const QString&)),Qt::QueuedConnection) ;
|
|
|
|
QObject::connect(mPluginNotifier,SIGNAL(voipHangUpReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedVoipHangUp(const QString&)),Qt::QueuedConnection) ;
|
2012-02-18 10:56:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void VOIPPlugin::setInterfaces(RsPlugInInterfaces &interfaces)
|
|
|
|
{
|
|
|
|
mPeers = interfaces.mPeers;
|
|
|
|
}
|
|
|
|
|
|
|
|
ConfigPage *VOIPPlugin::qt_config_page() const
|
|
|
|
{
|
2012-02-19 10:07:47 -05:00
|
|
|
return new AudioInputConfig() ;
|
2012-02-18 10:56:37 -05:00
|
|
|
}
|
|
|
|
|
2012-02-25 07:18:40 -05:00
|
|
|
PopupChatDialog *VOIPPlugin::qt_allocate_new_popup_chat_dialog() const
|
|
|
|
{
|
2012-02-25 16:03:06 -05:00
|
|
|
AudioPopupChatDialog *ap = new AudioPopupChatDialog() ;
|
|
|
|
|
|
|
|
return ap ;
|
2012-02-25 07:18:40 -05:00
|
|
|
}
|
|
|
|
|
2012-02-21 16:53:25 -05:00
|
|
|
std::string VOIPPlugin::qt_transfers_tab_name() const
|
|
|
|
{
|
2012-02-28 13:25:57 -05:00
|
|
|
return QObject::tr("RTT Statistics").toUtf8().constData() ;
|
2012-02-21 16:53:25 -05:00
|
|
|
}
|
|
|
|
RsAutoUpdatePage *VOIPPlugin::qt_transfers_tab() const
|
|
|
|
{
|
|
|
|
return new VoipStatistics ;
|
|
|
|
}
|
|
|
|
|
2012-02-18 10:56:37 -05:00
|
|
|
RsPQIService *VOIPPlugin::rs_pqi_service() const
|
|
|
|
{
|
|
|
|
if(mVoip == NULL)
|
|
|
|
{
|
2012-02-25 13:15:36 -05:00
|
|
|
mVoip = new p3VoRS(mPlugInHandler,mPluginNotifier) ; // , 3600 * 24 * 30 * 6); // 6 Months
|
2012-02-19 10:07:47 -05:00
|
|
|
rsVoip = mVoip ;
|
2012-02-18 10:56:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return mVoip ;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VOIPPlugin::setPlugInHandler(RsPluginHandler *pgHandler)
|
|
|
|
{
|
|
|
|
mPlugInHandler = pgHandler;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string VOIPPlugin::getShortPluginDescription() const
|
|
|
|
{
|
|
|
|
return QApplication::translate("VOIP", "This plugin provides voice communication between friends in RetroShare.").toUtf8().constData();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string VOIPPlugin::getPluginName() const
|
|
|
|
{
|
|
|
|
return QApplication::translate("VOIPPlugin", "VOIP").toUtf8().constData();
|
|
|
|
}
|
|
|
|
|
|
|
|
QTranslator* VOIPPlugin::qt_translator(QApplication *app, const QString& languageCode) const
|
|
|
|
{
|
|
|
|
if (languageCode == "en") {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-07-15 17:37:35 -04:00
|
|
|
QTranslator* translator = new QTranslator();
|
2012-02-18 10:56:37 -05:00
|
|
|
if (translator->load(":/lang/VOIP_" + languageCode + ".qm")) {
|
|
|
|
return translator;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete(translator);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|