init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
67
Telegram/SourceFiles/ui/countryinput.h
Normal file
67
Telegram/SourceFiles/ui/countryinput.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/rp_widget.h"
|
||||
|
||||
namespace style {
|
||||
struct InputField;
|
||||
} // namespace style
|
||||
|
||||
namespace Countries {
|
||||
struct Info;
|
||||
} // namespace Countries
|
||||
|
||||
namespace Ui {
|
||||
class Show;
|
||||
} // namespace Ui
|
||||
|
||||
class CountryInput : public Ui::RpWidget {
|
||||
public:
|
||||
CountryInput(
|
||||
QWidget *parent,
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
const style::InputField &st);
|
||||
|
||||
QAccessible::Role accessibilityRole() override {
|
||||
return QAccessible::Role::PushButton;
|
||||
}
|
||||
QString accessibilityName() override {
|
||||
return _text;
|
||||
}
|
||||
|
||||
[[nodiscard]] QString iso() const {
|
||||
return _chosenIso;
|
||||
}
|
||||
bool chooseCountry(const QString &country);
|
||||
|
||||
void onChooseCode(const QString &code);
|
||||
|
||||
rpl::producer<QString> codeChanged() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void mouseMoveEvent(QMouseEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent* e) override;
|
||||
void enterEventHook(QEnterEvent *e) override;
|
||||
void leaveEventHook(QEvent *e) override;
|
||||
|
||||
private:
|
||||
void chooseCountry(not_null<const Countries::Info*> info, int codeIndex);
|
||||
void setText(const QString &newText);
|
||||
|
||||
const std::shared_ptr<Ui::Show> _show;
|
||||
const style::InputField &_st;
|
||||
bool _active = false;
|
||||
QString _text;
|
||||
QString _chosenIso;
|
||||
|
||||
rpl::event_stream<QString> _codeChanged;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user