Use nested namespaces (C++17 feature)

This commit is contained in:
Mat Sutcliffe
2021-09-15 21:44:54 +01:00
parent 3f2e5b0b69
commit 57d32da826
1345 changed files with 146075 additions and 150376 deletions

View File

@@ -18,60 +18,57 @@
using namespace BlackMisc;
using namespace BlackCore;
namespace BlackGui
namespace BlackGui::Components
{
namespace Components
CCountrySelector::CCountrySelector(QWidget *parent) :
QFrame(parent),
ui(new Ui::CCountrySelector)
{
CCountrySelector::CCountrySelector(QWidget *parent) :
QFrame(parent),
ui(new Ui::CCountrySelector)
{
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
ui->setupUi(this);
ui->le_Iso->setValidator(new CUpperCaseValidator(ui->le_Iso));
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
ui->setupUi(this);
ui->le_Iso->setValidator(new CUpperCaseValidator(ui->le_Iso));
connect(sGui->getWebDataServices(), &CWebDataServices::swiftDbAllDataRead, this, &CCountrySelector::onCountriesLoaded);
connect(ui->cb_Country, &QComboBox::currentTextChanged, this, &CCountrySelector::onCountryNameChanged);
connect(ui->le_Iso, &QLineEdit::editingFinished, this, &CCountrySelector::onIsoChanged);
connect(sGui->getWebDataServices(), &CWebDataServices::swiftDbAllDataRead, this, &CCountrySelector::onCountriesLoaded);
connect(ui->cb_Country, &QComboBox::currentTextChanged, this, &CCountrySelector::onCountryNameChanged);
connect(ui->le_Iso, &QLineEdit::editingFinished, this, &CCountrySelector::onIsoChanged);
this->onCountriesLoaded();
}
this->onCountriesLoaded();
}
CCountrySelector::~CCountrySelector()
{ }
CCountrySelector::~CCountrySelector()
{ }
void CCountrySelector::setCountry(const CCountry &country)
{
if (country == m_current) { return; }
m_current = country;
if (country.getIsoCode() != ui->le_Iso->text()) { ui->le_Iso->setText(country.getIsoCode()); }
if (country.getName() != ui->cb_Country->currentText()) { ui->cb_Country->setCurrentText(country.getName()); }
emit this->countryChanged(m_current);
}
void CCountrySelector::setCountry(const CCountry &country)
{
if (country == m_current) { return; }
m_current = country;
if (country.getIsoCode() != ui->le_Iso->text()) { ui->le_Iso->setText(country.getIsoCode()); }
if (country.getName() != ui->cb_Country->currentText()) { ui->cb_Country->setCurrentText(country.getName()); }
emit this->countryChanged(m_current);
}
void CCountrySelector::onCountriesLoaded()
{
if (!sGui || !sGui->hasWebDataServices()) { return; }
const CCountryList countries = sGui->getWebDataServices()->getCountries();
void CCountrySelector::onCountriesLoaded()
{
if (!sGui || !sGui->hasWebDataServices()) { return; }
const CCountryList countries = sGui->getWebDataServices()->getCountries();
ui->le_Iso->setCompleter(new QCompleter(countries.toIsoList(true)));
ui->cb_Country->clear();
ui->cb_Country->addItems(countries.toNameList(true));
}
ui->le_Iso->setCompleter(new QCompleter(countries.toIsoList(true)));
ui->cb_Country->clear();
ui->cb_Country->addItems(countries.toNameList(true));
}
void CCountrySelector::onIsoChanged()
{
if (!sGui || !sGui->hasWebDataServices()) { return; }
const QString iso(ui->le_Iso->text().trimmed().toUpper());
if (m_current.getIsoCode() == iso) { return; }
this->setCountry(sGui->getWebDataServices()->getCountryForIsoCode(iso));
}
void CCountrySelector::onIsoChanged()
{
if (!sGui || !sGui->hasWebDataServices()) { return; }
const QString iso(ui->le_Iso->text().trimmed().toUpper());
if (m_current.getIsoCode() == iso) { return; }
this->setCountry(sGui->getWebDataServices()->getCountryForIsoCode(iso));
}
void CCountrySelector::onCountryNameChanged(const QString &name)
{
if (!sGui || !sGui->hasWebDataServices()) { return; }
if (m_current.getName() == name) { return; }
this->setCountry(sGui->getWebDataServices()->getCountryForName(name));
}
} // ns
void CCountrySelector::onCountryNameChanged(const QString &name)
{
if (!sGui || !sGui->hasWebDataServices()) { return; }
if (m_current.getName() == name) { return; }
this->setCountry(sGui->getWebDataServices()->getCountryForName(name));
}
} // ns