2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Moved countries from Data to Countries namespace.

This commit is contained in:
23rd
2021-08-26 17:46:24 +03:00
parent 1b3075ac2e
commit df02bbb0a3
14 changed files with 41 additions and 41 deletions

View File

@@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/scroll_area.h"
#include "ui/widgets/multi_select.h"
#include "ui/effects/ripple_animation.h"
#include "data/data_countries.h"
#include "countries/countries_instance.h"
#include "base/qt_adapters.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
@@ -64,7 +64,7 @@ private:
void updateSelectedRow();
void updateRow(int index);
void setPressed(int pressed);
const std::vector<not_null<const Data::CountryInfo*>> &current() const;
const std::vector<not_null<const Countries::CountryInfo*>> &current() const;
Type _type = Type::Phones;
int _rowHeight = 0;
@@ -76,8 +76,8 @@ private:
std::vector<std::unique_ptr<RippleAnimation>> _ripples;
std::vector<not_null<const Data::CountryInfo*>> _list;
std::vector<not_null<const Data::CountryInfo*>> _filtered;
std::vector<not_null<const Countries::CountryInfo*>> _list;
std::vector<not_null<const Countries::CountryInfo*>> _filtered;
base::flat_map<QChar, std::vector<int>> _byLetter;
std::vector<std::vector<QString>> _namesList;
@@ -174,7 +174,7 @@ CountrySelectBox::Inner::Inner(
, _rowHeight(st::countryRowHeight) {
setAttribute(Qt::WA_OpaquePaintEvent);
const auto &byISO2 = Data::CountriesByISO2();
const auto &byISO2 = Countries::CountriesByISO2();
if (byISO2.contains(iso)) {
LastValidISO = iso;
@@ -188,7 +188,7 @@ CountrySelectBox::Inner::Inner(
if (lastValid) {
_list.emplace_back(lastValid);
}
for (const auto &entry : Data::Countries()) {
for (const auto &entry : Countries::Countries()) {
if (&entry != lastValid) {
_list.emplace_back(&entry);
}
@@ -424,7 +424,7 @@ void CountrySelectBox::Inner::updateSelected(QPoint localPos) {
}
auto CountrySelectBox::Inner::current() const
-> const std::vector<not_null<const Data::CountryInfo*>> & {
-> const std::vector<not_null<const Countries::CountryInfo*>> & {
return _filter.isEmpty() ? _list : _filtered;
}

View File

@@ -10,9 +10,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/abstract_box.h"
#include "styles/style_widgets.h"
namespace Data {
namespace Countries {
struct CountryInfo;
} // namespace Data
} // namespace Countries
namespace Ui {

View File

@@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/multi_select.h"
#include "ui/effects/ripple_animation.h"
#include "ui/boxes/country_select_box.h"
#include "data/data_countries.h"
#include "countries/countries_instance.h"
#include "base/qt_adapters.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
@@ -114,7 +114,7 @@ void CountryInput::onChooseCode(const QString &code) {
Ui::hideLayer();
_chosenIso = QString();
if (code.length()) {
const auto &byCode = Data::CountriesByCode();
const auto &byCode = Countries::CountriesByCode();
const auto i = byCode.constFind(code);
if (i != byCode.cend()) {
const auto info = *i;
@@ -132,7 +132,7 @@ void CountryInput::onChooseCode(const QString &code) {
bool CountryInput::chooseCountry(const QString &iso) {
Ui::hideLayer();
const auto &byISO2 = Data::CountriesByISO2();
const auto &byISO2 = Countries::CountriesByISO2();
const auto i = byISO2.constFind(iso);
const auto info = (i != byISO2.cend()) ? (*i) : nullptr;

View File

@@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/special_fields.h"
#include "lang/lang_keys.h"
#include "data/data_countries.h" // Data::ValidPhoneCode
#include "countries/countries_instance.h" // Countries::ValidPhoneCode
#include "numbers.h"
#include <QtCore/QRegularExpression>
@@ -83,7 +83,7 @@ void CountryCodeInput::correctValue(
}
}
if (!addToNumber.isEmpty()) {
auto validCode = Data::ValidPhoneCode(newText.mid(1));
auto validCode = Countries::ValidPhoneCode(newText.mid(1));
addToNumber = newText.mid(1 + validCode.length()) + addToNumber;
newText = '+' + validCode;
}