Phone numbers starting with '0' are not formatted with '+'.

Sticker with reply layout fixed. Report box title corrected.
Elided text display sometimes didn't restore last block, fixed.
Removed non-existent class diagram file from MSVC project.
This commit is contained in:
John Preston 2016-06-08 19:40:33 +03:00
parent 445cd680c7
commit 8b2c351933
6 changed files with 19 additions and 15 deletions

View File

@ -123,6 +123,8 @@ namespace App {
QString formatPhone(QString phone) {
if (phone.isEmpty()) return QString();
if (phone.at(0) == '0') return phone;
QString number = phone;
for (const QChar *ch = phone.constData(), *e = ch + phone.size(); ch != e; ++ch) {
if (ch->unicode() < '0' || ch->unicode() > '9') {

View File

@ -50,7 +50,7 @@ void ReportBox::paintEvent(QPaintEvent *e) {
Painter p(this);
if (paint(p)) return;
paintTitle(p, lang(_channel->isMegagroup() ? lng_report_title : lng_report_group_title));
paintTitle(p, lang(_channel->isMegagroup() ? lng_report_group_title : lng_report_title));
}
void ReportBox::resizeEvent(QResizeEvent *e) {

View File

@ -4728,20 +4728,21 @@ void HistorySticker::initDimensions() {
if (_pixh < 1) _pixh = 1;
_maxw = qMax(_pixw, int16(st::minPhotoSize));
_minh = qMax(_pixh, int16(st::minPhotoSize));
if (_parent->getMedia() == this) {
_maxw += additionalWidth();
}
_height = _minh;
}
int HistorySticker::resizeGetHeight(int width) { // return new height
_width = qMin(width, _maxw);
int maxWidth = _maxw;
if (_parent->getMedia() == this) {
maxWidth += additionalWidth();
}
_width = qMin(width, maxWidth);
if (_parent->getMedia() == this) {
auto via = _parent->Get<HistoryMessageVia>();
auto reply = _parent->Get<HistoryMessageReply>();
if (via || reply) {
int usew = _maxw - additionalWidth(via, reply);
int availw = _width - usew - st::msgReplyPadding.left() - st::msgReplyPadding.left() - st::msgReplyPadding.left();
int availw = _width - _maxw - st::msgReplyPadding.left() - st::msgReplyPadding.left() - st::msgReplyPadding.left();
if (via) {
via->resize(availw);
}
@ -4766,7 +4767,6 @@ void HistorySticker::draw(Painter &p, const QRect &r, TextSelection selection, u
auto via = childmedia ? nullptr : _parent->Get<HistoryMessageVia>();
auto reply = childmedia ? nullptr : _parent->Get<HistoryMessageReply>();
if (via || reply) {
usew -= additionalWidth(via, reply);
if (isPost) {
} else if (out) {
usex = _width - usew;
@ -4836,7 +4836,6 @@ HistoryTextState HistorySticker::getState(int x, int y, HistoryStateRequest requ
auto via = childmedia ? nullptr : _parent->Get<HistoryMessageVia>();
auto reply = childmedia ? nullptr : _parent->Get<HistoryMessageReply>();
if (via || reply) {
usew -= additionalWidth(via, reply);
if (isPost) {
} else if (out) {
usex = _width - usew;

View File

@ -860,6 +860,10 @@ public:
TextPainter(QPainter *p, const Text *t) : _p(p), _t(t) {
}
~TextPainter() {
restoreAfterElided();
}
void initNextParagraph(Text::TextBlocks::const_iterator i) {
_parStartBlock = i;
Text::TextBlocks::const_iterator e = _t->_blocks.cend();
@ -1292,7 +1296,6 @@ public:
int firstItem = engine.findItem(line.from), lastItem = engine.findItem(line.from + line.length - 1);
int nItems = (firstItem >= 0 && lastItem >= firstItem) ? (lastItem - firstItem + 1) : 0;
if (!nItems) {
if (elidedLine) restoreAfterElided();
return true;
}
@ -1546,12 +1549,14 @@ public:
x += itemWidth;
}
if (elidedLine) restoreAfterElided();
return true;
}
void elideSaveBlock(int32 blockIndex, ITextBlock *&_endBlock, int32 elideStart, int32 elideWidth) {
if (_elideSavedBlock) {
restoreAfterElided();
}
_elideSavedIndex = blockIndex;
_elideSavedBlock = _t->_blocks[blockIndex];
const_cast<Text*>(_t)->_blocks[blockIndex] = new TextBlock(_t->_font, _t->_text, QFIXED_MAX, elideStart, 0, _elideSavedBlock->flags(), _elideSavedBlock->color(), _elideSavedBlock->lnkIndex());
@ -1681,7 +1686,7 @@ public:
if (_elideSavedBlock) {
delete _t->_blocks[_elideSavedIndex];
const_cast<Text*>(_t)->_blocks[_elideSavedIndex] = _elideSavedBlock;
_elideSavedBlock = 0;
_elideSavedBlock = nullptr;
}
}

View File

@ -2686,7 +2686,6 @@
<Image Include="Resources\art\icon256.ico" />
</ItemGroup>
<ItemGroup>
<None Include="ClassDiagram.cd" />
<None Include="Resources\langs\download.sh" />
<CustomBuild Include="Resources\langs\lang.strings">
<Outputs>.\GeneratedFiles\lang_auto.h</Outputs>

View File

@ -1839,7 +1839,6 @@
<None Include="Resources\langs\upload.sh">
<Filter>Resources\langs</Filter>
</None>
<None Include="ClassDiagram.cd" />
</ItemGroup>
<ItemGroup>
<Image Include="Resources\art\icon256.ico">