add missing namespaces

This commit is contained in:
chelovechishko 2018-07-06 23:55:12 +09:00
parent 39c88ea247
commit b3dddeafdf
7 changed files with 133 additions and 118 deletions

View File

@ -1584,12 +1584,16 @@ bool p3PeerMgrIMPL::setDynDNS(const RsPeerId &id, const std::string &dyndns)
return changed;
}
namespace pqi {
struct ZeroedInt
{
ZeroedInt() { n=0 ;}
int n ;
};
}
bool p3PeerMgrIMPL::addCandidateForOwnExternalAddress(const RsPeerId &from, const sockaddr_storage &addr)
{
// The algorithm is the following:
@ -1673,7 +1677,7 @@ bool p3PeerMgrIMPL::addCandidateForOwnExternalAddress(const RsPeerId &from, cons
bool p3PeerMgrIMPL::locked_computeCurrentBestOwnExtAddressCandidate(sockaddr_storage& addr, uint32_t& count)
{
std::map<sockaddr_storage,ZeroedInt> addr_counts ;
std::map<sockaddr_storage, pqi::ZeroedInt> addr_counts ;
for(std::map<RsPeerId,sockaddr_storage>::iterator it(mReportedOwnAddresses.begin());it!=mReportedOwnAddresses.end();++it)
++addr_counts[it->second].n ;
@ -1684,7 +1688,7 @@ bool p3PeerMgrIMPL::locked_computeCurrentBestOwnExtAddressCandidate(sockaddr_sto
count = 0 ;
for(std::map<sockaddr_storage,ZeroedInt>::const_iterator it(addr_counts.begin());it!=addr_counts.end();++it)
for(std::map<sockaddr_storage, pqi::ZeroedInt>::const_iterator it(addr_counts.begin());it!=addr_counts.end();++it)
{
if(uint32_t(it->second.n) > count)
{

View File

@ -113,6 +113,8 @@ void p3BanList::setAutoRangeLimit(int n)
IndicateConfigChanged();
}
namespace services {
class ZeroedInt
{
public:
@ -120,6 +122,8 @@ class ZeroedInt
uint32_t n ;
};
}
BanListPeer::BanListPeer()
{
memset(&addr, 0, sizeof(addr));
@ -220,14 +224,14 @@ void p3BanList::autoFigureOutBanRanges()
std::cerr << "Automatically figuring out IP ranges from banned IPs." << std::endl;
#endif
std::map<sockaddr_storage,ZeroedInt> range_map ;
std::map<sockaddr_storage, services::ZeroedInt> range_map ;
for(std::map<sockaddr_storage,BanListPeer>::iterator it(mBanSet.begin());it!=mBanSet.end();++it)
++range_map[makeBitsRange(it->first,1)].n ;
time_t now = time(NULL) ;
for(std::map<sockaddr_storage,ZeroedInt>::const_iterator it=range_map.begin();it!=range_map.end();++it)
for(std::map<sockaddr_storage, services::ZeroedInt>::const_iterator it=range_map.begin();it!=range_map.end();++it)
{
#ifdef DEBUG_BANLIST
std::cerr << "Ban range: " << sockaddr_storage_iptostring(it->first) << " : " << it->second.n << std::endl;

View File

@ -433,7 +433,7 @@ void MainWindow::initStackedPage()
#ifndef RS_RELEASE_VERSION
#ifdef PLUGINMGR
addPage(pluginsPage = new PluginsPage(ui->stackPages), grp, NULL);
addPage(pluginsPage = new gui::PluginsPage(ui->stackPages), grp, NULL);
#endif
#endif

View File

@ -39,6 +39,8 @@ class QScriptEngine;
class PluginManager;
namespace gui {
//! A demo widget for showing plugin engine in action :)
@ -82,5 +84,7 @@ protected:
PluginManager* pluginManager;
};
} // namespace gui
#endif

View File

@ -33,7 +33,7 @@
#include "../MainWindow.h"
PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags)
settings::PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags)
: ConfigPage(parent, flags)
{
ui.setupUi(this);
@ -159,7 +159,7 @@ PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags)
QObject::connect(ui.enableAll,SIGNAL(toggled(bool)),this,SLOT(toggleEnableAll(bool))) ;
}
QString PluginsPage::helpText() const
QString settings::PluginsPage::helpText() const
{
return tr("<h1><img width=\"24\" src=\":/icons/help_64.png\">&nbsp;&nbsp;Plugins</h1> \
<p>Plugins are loaded from the directories listed in the bottom list.</p> \
@ -171,11 +171,11 @@ QString PluginsPage::helpText() const
<p>If you want to develop your own plugins, contact the developpers team \
they will be happy to help you out!</p>") ;
}
void PluginsPage::toggleEnableAll(bool b)
void settings::PluginsPage::toggleEnableAll(bool b)
{
rsPlugins->allowAllPlugins(b) ;
}
void PluginsPage::aboutPlugin(int i)
void settings::PluginsPage::aboutPlugin(int i)
{
std::cerr << "Launching about window for plugin " << i << std::endl;
@ -183,7 +183,7 @@ void PluginsPage::aboutPlugin(int i)
if(rsPlugins->plugin(i) != NULL && (dialog = rsPlugins->plugin(i)->qt_about_page()) != NULL)
dialog->exec() ;
}
void PluginsPage::configurePlugin(int i)
void settings::PluginsPage::configurePlugin(int i)
{
std::cerr << "Launching configuration window for plugin " << i << std::endl;
@ -191,14 +191,14 @@ void PluginsPage::configurePlugin(int i)
rsPlugins->plugin(i)->qt_config_panel()->show() ;
}
void PluginsPage::enablePlugin(const QString& hash)
void settings::PluginsPage::enablePlugin(const QString& hash)
{
std::cerr << "Switching status of plugin " << hash.toStdString() << " to enable" << std::endl;
rsPlugins->enablePlugin(RsFileHash(hash.toStdString()) );
}
void PluginsPage::disablePlugin(const QString& hash)
void settings::PluginsPage::disablePlugin(const QString& hash)
{
std::cerr << "Switching status of plugin " << hash.toStdString() << " to disable " << std::endl;
@ -206,11 +206,11 @@ void PluginsPage::disablePlugin(const QString& hash)
}
PluginsPage::~PluginsPage()
settings::PluginsPage::~PluginsPage()
{
}
/** Loads the settings for this page */
void PluginsPage::load()
void settings::PluginsPage::load()
{
}

View File

@ -24,6 +24,8 @@
#include <retroshare-gui/configpage.h>
#include "ui_PluginsPage.h"
namespace settings {
class PluginsPage : public ConfigPage
{
Q_OBJECT
@ -52,3 +54,4 @@ class PluginsPage : public ConfigPage
Ui::PluginsPage ui;
};
} // namespace settings

View File

@ -158,7 +158,7 @@ SettingsPage::initStackedWidget()
addPage(new ForumPage()); // FORUMS
addPage(new PostedPage()); // POSTED RENAME TO LINKS
addPage(new NotifyPage()); // NOTIFY
addPage(new PluginsPage() ); // PLUGINS
addPage(new settings::PluginsPage() ); // PLUGINS
addPage(new AppearancePage()); // APPEARENCE
addPage(new SoundPage() ); // SOUND
addPage(new ServicePermissionsPage() ); // PERMISSIONS