2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Move stickers state variables to AuthSessionData.

Also allow to click on the selected set when choosing megagroup
sticker set and allow to paste a t.me link to the set there.
This commit is contained in:
John Preston
2017-11-05 21:07:27 +04:00
parent 9a56b2d20f
commit 554eb3a342
31 changed files with 673 additions and 479 deletions

View File

@@ -3632,8 +3632,8 @@ void MaskedInputField::keyPressEvent(QKeyEvent *e) {
QLineEdit::keyPressEvent(e);
}
QString newText(text());
int32 newCursor(cursorPosition());
auto newText = text();
auto newCursor = cursorPosition();
if (wasText == newText && wasCursor == newCursor) { // call correct manually
correctValue(wasText, wasCursor, newText, newCursor);
_oldtext = newText;
@@ -3700,7 +3700,11 @@ void CountryCodeInput::codeSelected(const QString &code) {
emit changed();
}
void CountryCodeInput::correctValue(const QString &was, int32 wasCursor, QString &now, int32 &nowCursor) {
void CountryCodeInput::correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) {
QString newText, addToNumber;
int oldPos(nowCursor), newPos(-1), oldLen(now.length()), start = 0, digits = 5;
newText.reserve(oldLen + 1);
@@ -3767,7 +3771,11 @@ void PhonePartInput::keyPressEvent(QKeyEvent *e) {
}
}
void PhonePartInput::correctValue(const QString &was, int32 wasCursor, QString &now, int32 &nowCursor) {
void PhonePartInput::correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) {
QString newText;
int oldPos(nowCursor), newPos(-1), oldLen(now.length()), digitCount = 0;
for (int i = 0; i < oldLen; ++i) {
@@ -3875,7 +3883,11 @@ PortInput::PortInput(QWidget *parent, const style::InputField &st, base::lambda<
}
}
void PortInput::correctValue(const QString &was, int32 wasCursor, QString &now, int32 &nowCursor) {
void PortInput::correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) {
QString newText;
newText.reserve(now.size());
auto newPos = nowCursor;
@@ -3916,7 +3928,11 @@ void UsernameInput::paintAdditionalPlaceholder(Painter &p, TimeMs ms) {
}
}
void UsernameInput::correctValue(const QString &was, int32 wasCursor, QString &now, int32 &nowCursor) {
void UsernameInput::correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) {
auto newPos = nowCursor;
auto from = 0, len = now.size();
for (; from < len; ++from) {
@@ -3982,7 +3998,11 @@ void PhoneInput::paintAdditionalPlaceholder(Painter &p, TimeMs ms) {
}
}
void PhoneInput::correctValue(const QString &was, int32 wasCursor, QString &now, int32 &nowCursor) {
void PhoneInput::correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) {
auto digits = now;
digits.replace(QRegularExpression(qsl("[^\\d]")), QString());
_pattern = phoneNumberParse(digits);

View File

@@ -142,7 +142,10 @@ protected:
void dropEvent(QDropEvent *e) override;
void contextMenuEvent(QContextMenuEvent *e) override;
virtual void correctValue(const QString &was, QString &now, TagList &nowTags) {
virtual void correctValue(
const QString &was,
QString &now,
TagList &nowTags) {
}
void insertEmoji(EmojiPtr emoji, QTextCursor c);
@@ -755,7 +758,11 @@ protected:
void contextMenuEvent(QContextMenuEvent *e) override;
void inputMethodEvent(QInputMethodEvent *e) override;
virtual void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) {
virtual void correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) {
}
void setCorrectedText(QString &now, int &nowCursor, const QString &newText, int newPos);
@@ -832,7 +839,11 @@ signals:
void addedToNumber(const QString &added);
protected:
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
void correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) override;
private:
bool _nosignal;
@@ -855,7 +866,11 @@ signals:
protected:
void keyPressEvent(QKeyEvent *e) override;
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
void correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) override;
void paintAdditionalPlaceholder(Painter &p, TimeMs ms) override;
private:
@@ -875,7 +890,11 @@ public:
PortInput(QWidget *parent, const style::InputField &st, base::lambda<QString()> placeholderFactory, const QString &val);
protected:
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
void correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) override;
};
@@ -886,7 +905,11 @@ public:
void setLinkPlaceholder(const QString &placeholder);
protected:
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
void correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) override;
void paintAdditionalPlaceholder(Painter &p, TimeMs ms) override;
private:
@@ -903,7 +926,11 @@ public:
protected:
void focusInEvent(QFocusEvent *e) override;
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
void correctValue(
const QString &was,
int wasCursor,
QString &now,
int &nowCursor) override;
void paintAdditionalPlaceholder(Painter &p, TimeMs ms) override;
private: