mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
Merge pull request #1296 from chelovechishko/namespaces
fix ODR violations caused by same names for different things
This commit is contained in:
commit
4b6fd5d944
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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\"> 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()
|
||||
{
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user