mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-25 06:40:58 -04:00
- added ability to plugins to add a tab in transfers dialog
- improved VOIP plugin to add RTT statistics tab to RS gui. - added comments in rsplugins.h - added big tooltip in transfers that would be stuck in checking... mode git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4979 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c907a5846c
commit
826e8f3728
8 changed files with 102 additions and 17 deletions
|
@ -47,6 +47,7 @@ class RsCacheService ;
|
||||||
class ftServer ;
|
class ftServer ;
|
||||||
class ConfigPage ;
|
class ConfigPage ;
|
||||||
class RsPQIService ;
|
class RsPQIService ;
|
||||||
|
class RsAutoUpdatePage ;
|
||||||
|
|
||||||
// Used for the status of plugins.
|
// Used for the status of plugins.
|
||||||
//
|
//
|
||||||
|
@ -77,23 +78,60 @@ public:
|
||||||
class RsPlugin
|
class RsPlugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
//
|
||||||
|
//================================ Services ==================================//
|
||||||
|
//
|
||||||
|
// Cache service. Use this for providing cache-based services, such as channels, forums.
|
||||||
|
// Example plugin: LinksCloud
|
||||||
|
//
|
||||||
virtual RsCacheService *rs_cache_service() const { return NULL ; }
|
virtual RsCacheService *rs_cache_service() const { return NULL ; }
|
||||||
|
|
||||||
|
// Peer-to-Peer service. Use this for providing a service based to friend to friend
|
||||||
|
// exchange of data, such as chat, messages, etc.
|
||||||
|
// Example plugin: VOIP
|
||||||
|
//
|
||||||
virtual RsPQIService *rs_pqi_service() const { return NULL ; }
|
virtual RsPQIService *rs_pqi_service() const { return NULL ; }
|
||||||
virtual uint16_t rs_service_id() const { return 0 ; }
|
virtual uint16_t rs_service_id() const { return 0 ; }
|
||||||
|
|
||||||
virtual MainPage *qt_page() const { return NULL ; }
|
// Filename used for saving the specific plugin configuration. Both RsCacheService and RsPQIService
|
||||||
virtual QWidget *qt_config_panel() const { return NULL ; }
|
// derive from p3Config, which means that the service provided by the plugin can load/save its own
|
||||||
virtual QIcon *qt_icon() const { return NULL ; }
|
// config by deriving loadList() and saveList() from p3Config.
|
||||||
virtual ConfigPage *qt_config_page() const { return NULL ; }
|
//
|
||||||
|
virtual std::string configurationFileName() const { return std::string() ; }
|
||||||
|
|
||||||
|
//
|
||||||
|
//=================================== GUI ====================================//
|
||||||
|
//
|
||||||
|
// Derive the following methods to provide GUI additions to RetroShare's GUI.
|
||||||
|
//
|
||||||
|
// Main page: like Transfers, Channels, Forums, etc.
|
||||||
|
//
|
||||||
|
virtual MainPage *qt_page() const { return NULL ; } // The page itself
|
||||||
|
virtual QIcon *qt_icon() const { return NULL ; } // the page icon. Todo: put icon as virtual in MainPage
|
||||||
|
|
||||||
|
virtual QWidget *qt_config_panel() const { return NULL ; } // Config panel, to appear config->plugins->[]->
|
||||||
|
virtual ConfigPage *qt_config_page() const { return NULL ; } // Config tab to add in config panel.
|
||||||
|
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 QTranslator *qt_translator(QApplication * /* app */, const QString& /* languageCode */ ) const { return NULL ; }
|
virtual QTranslator *qt_translator(QApplication * /* app */, const QString& /* languageCode */ ) const { return NULL ; }
|
||||||
|
|
||||||
virtual std::string configurationFileName() const { return std::string() ; }
|
//
|
||||||
|
//========================== Plugin Description ==============================//
|
||||||
|
//
|
||||||
|
// All these items appear in the config->plugins tab, as a description of the plugin.
|
||||||
|
//
|
||||||
virtual std::string getShortPluginDescription() const = 0 ;
|
virtual std::string getShortPluginDescription() const = 0 ;
|
||||||
virtual std::string getPluginName() const = 0 ;
|
virtual std::string getPluginName() const = 0 ;
|
||||||
virtual void getPluginVersion(int& major,int& minor,int& svn_rev) const = 0 ;
|
virtual void getPluginVersion(int& major,int& minor,int& svn_rev) const = 0 ;
|
||||||
virtual void setPlugInHandler(RsPluginHandler* pgHandler) = 0;
|
|
||||||
|
//
|
||||||
|
//========================== Plugin Interface ================================//
|
||||||
|
//
|
||||||
|
// Use these methods to access main objects from RetroShare.
|
||||||
|
//
|
||||||
virtual void setInterfaces(RsPlugInInterfaces& interfaces) = 0;
|
virtual void setInterfaces(RsPlugInInterfaces& interfaces) = 0;
|
||||||
|
virtual void setPlugInHandler(RsPluginHandler* pgHandler) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsPluginHandler
|
class RsPluginHandler
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
#include <retroshare/rsplugin.h>
|
#include <retroshare/rsplugin.h>
|
||||||
|
#include <retroshare-gui/RsAutoUpdatePage.h>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
#include "VOIPPlugin.h"
|
#include "VOIPPlugin.h"
|
||||||
#include "interface/rsvoip.h"
|
#include "interface/rsvoip.h"
|
||||||
|
|
||||||
|
#include "gui/VoipStatistics.h"
|
||||||
#include "gui/AudioInputConfig.h"
|
#include "gui/AudioInputConfig.h"
|
||||||
|
|
||||||
static void *inited = new VOIPPlugin() ;
|
static void *inited = new VOIPPlugin() ;
|
||||||
|
@ -42,6 +46,15 @@ ConfigPage *VOIPPlugin::qt_config_page() const
|
||||||
return new AudioInputConfig() ;
|
return new AudioInputConfig() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string VOIPPlugin::qt_transfers_tab_name() const
|
||||||
|
{
|
||||||
|
return QObject::tr("RTT Statistics").toStdString() ;
|
||||||
|
}
|
||||||
|
RsAutoUpdatePage *VOIPPlugin::qt_transfers_tab() const
|
||||||
|
{
|
||||||
|
return new VoipStatistics ;
|
||||||
|
}
|
||||||
|
|
||||||
RsPQIService *VOIPPlugin::rs_pqi_service() const
|
RsPQIService *VOIPPlugin::rs_pqi_service() const
|
||||||
{
|
{
|
||||||
if(mVoip == NULL)
|
if(mVoip == NULL)
|
||||||
|
|
|
@ -12,6 +12,8 @@ class VOIPPlugin: public RsPlugin
|
||||||
virtual RsPQIService *rs_pqi_service() const ;
|
virtual RsPQIService *rs_pqi_service() const ;
|
||||||
virtual uint16_t rs_service_id() const { return RS_SERVICE_TYPE_VOIP_PLUGIN ; }
|
virtual uint16_t rs_service_id() const { return RS_SERVICE_TYPE_VOIP_PLUGIN ; }
|
||||||
virtual ConfigPage *qt_config_page() const ;
|
virtual ConfigPage *qt_config_page() const ;
|
||||||
|
virtual RsAutoUpdatePage *qt_transfers_tab() const ;
|
||||||
|
virtual std::string qt_transfers_tab_name() const ;
|
||||||
|
|
||||||
virtual QTranslator *qt_translator(QApplication *app, const QString& languageCode) const;
|
virtual QTranslator *qt_translator(QApplication *app, const QString& languageCode) const;
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,8 @@ p3VoRS::p3VoRS(RsPluginHandler *handler)
|
||||||
|
|
||||||
int p3VoRS::tick()
|
int p3VoRS::tick()
|
||||||
{
|
{
|
||||||
|
std::cerr << "ticking p3VoRS" << std::endl;
|
||||||
|
|
||||||
processIncoming();
|
processIncoming();
|
||||||
sendPackets();
|
sendPackets();
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,32 @@ std::ostream& RsVoipPongItem::print(std::ostream &out, uint16_t indent)
|
||||||
printRsItemEnd(out, "RsVoipPongItem", indent);
|
printRsItemEnd(out, "RsVoipPongItem", indent);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
std::ostream& RsVoipProtocolItem::print(std::ostream &out, uint16_t indent)
|
||||||
|
{
|
||||||
|
printRsItemBase(out, "RsVoipProtocolItem", indent);
|
||||||
|
uint16_t int_Indent = indent + 2;
|
||||||
|
printIndent(out, int_Indent);
|
||||||
|
out << "flags: " << flags << std::endl;
|
||||||
|
|
||||||
|
printIndent(out, int_Indent);
|
||||||
|
out << "protocol: " << std::hex << protocol << std::dec << std::endl;
|
||||||
|
|
||||||
|
printRsItemEnd(out, "RsVoipProtocolItem", indent);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
std::ostream& RsVoipDataItem::print(std::ostream &out, uint16_t indent)
|
||||||
|
{
|
||||||
|
printRsItemBase(out, "RsVoipDataItem", indent);
|
||||||
|
uint16_t int_Indent = indent + 2;
|
||||||
|
printIndent(out, int_Indent);
|
||||||
|
out << "flags: " << flags << std::endl;
|
||||||
|
|
||||||
|
printIndent(out, int_Indent);
|
||||||
|
out << "data size: " << std::hex << data_size << std::dec << std::endl;
|
||||||
|
|
||||||
|
printRsItemEnd(out, "RsVoipDataItem", indent);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
uint32_t RsVoipDataItem::serial_size() const
|
uint32_t RsVoipDataItem::serial_size() const
|
||||||
|
|
|
@ -122,8 +122,7 @@ class RsVoipPongItem: public RsVoipItem
|
||||||
virtual bool serialise(void *data,uint32_t& size) ;
|
virtual bool serialise(void *data,uint32_t& size) ;
|
||||||
virtual uint32_t serial_size() const ;
|
virtual uint32_t serial_size() const ;
|
||||||
|
|
||||||
virtual ~RsVoipPongItem();
|
virtual ~RsVoipPongItem() {}
|
||||||
virtual void clear();
|
|
||||||
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
|
||||||
|
|
||||||
uint32_t mSeqNo;
|
uint32_t mSeqNo;
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include <retroshare/rsfiles.h>
|
#include <retroshare/rsfiles.h>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
#include <retroshare/rsdisc.h>
|
#include <retroshare/rsdisc.h>
|
||||||
|
#include <retroshare/rsplugin.h>
|
||||||
|
|
||||||
/****
|
/****
|
||||||
* #define SHOW_RTT_STATISTICS 1
|
* #define SHOW_RTT_STATISTICS 1
|
||||||
|
@ -304,10 +305,9 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||||
|
|
||||||
ui.tabWidget->addTab( new TurtleRouterDialog(), tr("Router Requests")) ;
|
ui.tabWidget->addTab( new TurtleRouterDialog(), tr("Router Requests")) ;
|
||||||
|
|
||||||
#ifdef SHOW_RTT_STATISTICS
|
for(int i=0;i<rsPlugins->nbPlugins();++i)
|
||||||
ui.tabWidget->addTab( new VoipStatistics(), tr("RTT Statistics")) ;
|
if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_transfers_tab() != NULL)
|
||||||
#endif
|
ui.tabWidget->addTab( rsPlugins->plugin(i)->qt_transfers_tab(),QString::fromStdString(rsPlugins->plugin(i)->qt_transfers_tab_name()) ) ;
|
||||||
|
|
||||||
|
|
||||||
// TurtleRouterDialog *trdl = new TurtleRouterDialog();
|
// TurtleRouterDialog *trdl = new TurtleRouterDialog();
|
||||||
// ui.tunnelInfoWidget->setWidget(trdl);
|
// ui.tunnelInfoWidget->setWidget(trdl);
|
||||||
|
@ -595,7 +595,7 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint /*point*/ )
|
||||||
}
|
}
|
||||||
|
|
||||||
int TransfersDialog::addItem(const QString&, const QString& name, const QString& coreID, qlonglong fileSize, const FileProgressInfo& pinfo, double dlspeed,
|
int TransfersDialog::addItem(const QString&, const QString& name, const QString& coreID, qlonglong fileSize, const FileProgressInfo& pinfo, double dlspeed,
|
||||||
const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining, qlonglong downloadtime)
|
const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining, qlonglong downloadtime,const QString& tooltip)
|
||||||
{
|
{
|
||||||
int rowCount = DLListModel->rowCount();
|
int rowCount = DLListModel->rowCount();
|
||||||
int row ;
|
int row ;
|
||||||
|
@ -626,6 +626,7 @@ int TransfersDialog::addItem(const QString&, const QString& name, const QString&
|
||||||
DLListModel->setData(DLListModel->index(row, ID), QVariant((QString)coreID));
|
DLListModel->setData(DLListModel->index(row, ID), QVariant((QString)coreID));
|
||||||
|
|
||||||
DLListModel->setData(DLListModel->index(row,NAME), FilesDefs::getIconFromFilename(name), Qt::DecorationRole);
|
DLListModel->setData(DLListModel->index(row,NAME), FilesDefs::getIconFromFilename(name), Qt::DecorationRole);
|
||||||
|
DLListModel->item(row,STATUS)->setToolTip(tooltip) ;
|
||||||
|
|
||||||
return row ;
|
return row ;
|
||||||
}
|
}
|
||||||
|
@ -897,7 +898,12 @@ void TransfersDialog::insertTransfers()
|
||||||
for(uint32_t i=0;i<fcinfo.active_chunks.size();++i)
|
for(uint32_t i=0;i<fcinfo.active_chunks.size();++i)
|
||||||
pinfo.chunks_in_progress.push_back(fcinfo.active_chunks[i].first) ;
|
pinfo.chunks_in_progress.push_back(fcinfo.active_chunks[i].first) ;
|
||||||
|
|
||||||
int addedRow = addItem("", fileName, fileHash, fileSize, pinfo, fileDlspeed, sources, status, priority, completed, remaining, downloadtime);
|
QString tooltip("") ;
|
||||||
|
|
||||||
|
if(info.downloadStatus == FT_STATE_CHECKING_HASH)
|
||||||
|
tooltip = tr("If the hash of the downloaded data does\nnot correspond to the hash announced\nby the file source. The data is likely \nto be corrupted.\n\nRetroShare will ask the source a detailed \nmap of the data; it will compare and invalidate\nbad blocks, and download them again\n\nTry to be patient!") ;
|
||||||
|
|
||||||
|
int addedRow = addItem("", fileName, fileHash, fileSize, pinfo, fileDlspeed, sources, status, priority, completed, remaining, downloadtime,tooltip);
|
||||||
used_hashes.insert(info.hash) ;
|
used_hashes.insert(info.hash) ;
|
||||||
|
|
||||||
std::map<std::string, std::string>::iterator vit;
|
std::map<std::string, std::string>::iterator vit;
|
||||||
|
|
|
@ -168,7 +168,7 @@ private:
|
||||||
public slots:
|
public slots:
|
||||||
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
||||||
//
|
//
|
||||||
int addItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining, qlonglong downloadtime);
|
int addItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources, const QString& status, const QString& priority, qlonglong completed, qlonglong remaining, qlonglong downloadtime,const QString& tooltip);
|
||||||
int addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo);
|
int addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo);
|
||||||
// void delItem(int row);
|
// void delItem(int row);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue