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

Removed Ui::show from CountryInput.

This commit is contained in:
23rd
2022-06-09 04:50:00 +03:00
parent f0e1498a41
commit 4add87e7a9
4 changed files with 25 additions and 6 deletions

View File

@@ -13,12 +13,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/ripple_animation.h"
#include "ui/boxes/country_select_box.h"
#include "countries/countries_instance.h"
#include "window/window_session_controller.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_intro.h"
CountryInput::CountryInput(QWidget *parent, const style::InputField &st)
CountryInput::CountryInput(
QWidget *parent,
std::shared_ptr<Window::Show> show,
const style::InputField &st)
: RpWidget(parent)
, _show(show)
, _st(st)
, _text(tr::lng_country_code(tr::now)) {
resize(_st.width, _st.heightMin);
@@ -112,7 +117,9 @@ void CountryInput::mouseMoveEvent(QMouseEvent *e) {
void CountryInput::mousePressEvent(QMouseEvent *e) {
mouseMoveEvent(e);
if (_active) {
const auto box = Ui::show(Box<Ui::CountrySelectBox>());
auto object = Box<Ui::CountrySelectBox>();
const auto box = Ui::MakeWeak(object.data());
_show->showBox(std::move(object), Ui::LayerOption::CloseOther);
box->entryChosen(
) | rpl::start_with_next([=](
const Ui::CountrySelectBox::Entry &entry) {
@@ -153,7 +160,7 @@ void CountryInput::leaveEventHook(QEvent *e) {
}
void CountryInput::onChooseCode(const QString &code) {
Ui::hideLayer();
_show->hideLayer();
_chosenIso = QString();
if (code.length()) {
const auto &byCode = Countries::Instance().byCode();