Alpha version 0.10.22: critical bug fixes.

This commit is contained in:
John Preston
2016-12-31 17:34:41 +04:00
parent bc0c355d2d
commit 218f991547
42 changed files with 634 additions and 212 deletions
@@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/popup_menu.h"
#include "mainwindow.h"
#include "ui/countryinput.h"
#include "window/window_theme.h"
#include "lang.h"
#include "numbers.h"
@@ -145,9 +146,12 @@ FlatTextarea::FlatTextarea(QWidget *parent, const style::FlatTextarea &st, const
setPlaceholder(pholder);
QPalette p(palette());
p.setColor(QPalette::Text, _st.textColor->c);
setPalette(p);
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
updatePalette();
}
});
updatePalette();
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -179,6 +183,12 @@ FlatTextarea::FlatTextarea(QWidget *parent, const style::FlatTextarea &st, const
}
}
void FlatTextarea::updatePalette() {
auto p = palette();
p.setColor(QPalette::Text, _st.textColor->c);
setPalette(p);
}
TextWithTags FlatTextarea::getTextWithTagsPart(int start, int end) {
TextWithTags result;
result.text = getTextPart(start, end, &result.tags);
@@ -1457,9 +1467,12 @@ FlatInput::FlatInput(QWidget *parent, const style::FlatInput &st, const QString
setFont(_st.font->f);
setAlignment(_st.align);
QPalette p(palette());
p.setColor(QPalette::Text, _st.textColor->c);
setPalette(p);
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
updatePalette();
}
});
updatePalette();
connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(onTextChange(const QString &)));
connect(this, SIGNAL(textEdited(const QString &)), this, SLOT(onTextEdited()));
@@ -1474,6 +1487,12 @@ FlatInput::FlatInput(QWidget *parent, const style::FlatInput &st, const QString
connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer()));
}
void FlatInput::updatePalette() {
auto p = palette();
p.setColor(QPalette::Text, _st.textColor->c);
setPalette(p);
}
void FlatInput::customUpDown(bool custom) {
_customUpDown = custom;
}
@@ -1699,9 +1718,12 @@ InputArea::InputArea(QWidget *parent, const style::InputField &st, const QString
createPlaceholderPath();
QPalette p(palette());
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
updatePalette();
}
});
updatePalette();
_inner->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
_inner->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -1736,6 +1758,12 @@ InputArea::InputArea(QWidget *parent, const style::InputField &st, const QString
finishAnimations();
}
void InputArea::updatePalette() {
auto p = palette();
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
}
void InputArea::onTouchTimer() {
_touchRightButton = true;
}
@@ -2443,9 +2471,12 @@ InputField::InputField(QWidget *parent, const style::InputField &st, const QStri
createPlaceholderPath();
QPalette p(palette());
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
updatePalette();
}
});
updatePalette();
_inner->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
_inner->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -2478,6 +2509,12 @@ InputField::InputField(QWidget *parent, const style::InputField &st, const QStri
finishAnimations();
}
void InputField::updatePalette() {
auto p = palette();
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
}
void InputField::onTouchTimer() {
_touchRightButton = true;
}
@@ -3184,9 +3221,12 @@ MaskedInputField::MaskedInputField(QWidget *parent, const style::InputField &st,
setFont(_st.font);
setAlignment(_st.textAlign);
QPalette p(palette());
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
updatePalette();
}
});
updatePalette();
createPlaceholderPath();
@@ -3213,6 +3253,12 @@ MaskedInputField::MaskedInputField(QWidget *parent, const style::InputField &st,
finishAnimations();
}
void MaskedInputField::updatePalette() {
auto p = palette();
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
}
void MaskedInputField::setCorrectedText(QString &now, int &nowCursor, const QString &newText, int newPos) {
if (newPos < 0 || newPos > newText.size()) {
newPos = newText.size();