mirror of https://github.com/procxx/kepka.git
Reduce entropy a bit
This commit is contained in:
parent
93d2fd3035
commit
e5ca84bd80
|
|
@ -369,9 +369,7 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) {
|
||||||
if (_pack.isEmpty()) return;
|
if (_pack.isEmpty()) return;
|
||||||
|
|
||||||
auto ms = getms();
|
auto ms = getms();
|
||||||
qint32 rows = _pack.size() / kStickersPanelPerRow + ((_pack.size() % kStickersPanelPerRow) ? 1 : 0);
|
qint32 from = std::floor(e->rect().top() / st::stickersSize.height()), to = std::floor(e->rect().bottom() / st::stickersSize.height()) + 1;
|
||||||
qint32 from = std::floor(e->rect().top() / st::stickersSize.height()),
|
|
||||||
to = std::floor(e->rect().bottom() / st::stickersSize.height()) + 1;
|
|
||||||
|
|
||||||
for (qint32 i = from; i < to; ++i) {
|
for (qint32 i = from; i < to; ++i) {
|
||||||
for (qint32 j = 0; j < kStickersPanelPerRow; ++j) {
|
for (qint32 j = 0; j < kStickersPanelPerRow; ++j) {
|
||||||
|
|
|
||||||
|
|
@ -952,12 +952,12 @@ void StickersBox::Inner::setPressed(int pressed) {
|
||||||
update(0, _itemsTop + _pressed * _rowHeight, width(), _rowHeight);
|
update(0, _itemsTop + _pressed * _rowHeight, width(), _rowHeight);
|
||||||
auto &set = _rows[_pressed];
|
auto &set = _rows[_pressed];
|
||||||
auto rippleMask = Ui::RippleAnimation::rectMask(QSize(width(), _rowHeight));
|
auto rippleMask = Ui::RippleAnimation::rectMask(QSize(width(), _rowHeight));
|
||||||
if (!_rows[_pressed]->ripple) {
|
if (!set->ripple) {
|
||||||
_rows[_pressed]->ripple = std::make_unique<Ui::RippleAnimation>(
|
set->ripple = std::make_unique<Ui::RippleAnimation>(st::contactsRipple, std::move(rippleMask), [this, index = _pressed] {
|
||||||
st::contactsRipple, std::move(rippleMask),
|
update(0, _itemsTop + index * _rowHeight, width(), _rowHeight);
|
||||||
[this, index = _pressed] { update(0, _itemsTop + index * _rowHeight, width(), _rowHeight); });
|
});
|
||||||
}
|
}
|
||||||
_rows[_pressed]->ripple->add(mapFromGlobal(QCursor::pos()) - QPoint(0, _itemsTop + _pressed * _rowHeight));
|
set->ripple->add(mapFromGlobal(QCursor::pos()) - QPoint(0, _itemsTop + _pressed * _rowHeight));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,6 @@ void ChatSearchFromController::rowClicked(not_null<PeerListRow *> row) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatSearchFromController::rebuildRows() {
|
void ChatSearchFromController::rebuildRows() {
|
||||||
auto ms = getms();
|
|
||||||
auto wasEmpty = !delegate()->peerListFullRowsCount();
|
|
||||||
|
|
||||||
auto now = unixtime();
|
auto now = unixtime();
|
||||||
QMultiMap<qint32, UserData *> ordered;
|
QMultiMap<qint32, UserData *> ordered;
|
||||||
if (_chat->noParticipantInfo()) {
|
if (_chat->noParticipantInfo()) {
|
||||||
|
|
|
||||||
|
|
@ -379,7 +379,7 @@ void Widget::paintEvent(QPaintEvent *e) {
|
||||||
|
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
auto clip = e->rect();
|
auto clip = e->rect();
|
||||||
auto ms = getms();
|
//auto ms = getms();
|
||||||
//_historyDownShown.step(ms);
|
//_historyDownShown.step(ms);
|
||||||
|
|
||||||
auto fill = QRect(0, 0, width(), App::main()->height());
|
auto fill = QRect(0, 0, width(), App::main()->height());
|
||||||
|
|
|
||||||
|
|
@ -920,7 +920,6 @@ void MainWidget::showSendPathsLayer() {
|
||||||
|
|
||||||
void MainWidget::deleteLayer(int selectedCount) {
|
void MainWidget::deleteLayer(int selectedCount) {
|
||||||
if (selectedCount) {
|
if (selectedCount) {
|
||||||
auto forDelete = true;
|
|
||||||
auto selected = _overview ? _overview->getSelectedItems() : _history->getSelectedItems();
|
auto selected = _overview ? _overview->getSelectedItems() : _history->getSelectedItems();
|
||||||
if (!selected.isEmpty()) {
|
if (!selected.isEmpty()) {
|
||||||
Ui::show(Box<DeleteMessagesBox>(selected));
|
Ui::show(Box<DeleteMessagesBox>(selected));
|
||||||
|
|
@ -1307,7 +1306,7 @@ void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &resu
|
||||||
if (h) Local::addSavedPeer(peer, h->lastMsgDate);
|
if (h) Local::addSavedPeer(peer, h->lastMsgDate);
|
||||||
} else if (peer->isChannel()) {
|
} else if (peer->isChannel()) {
|
||||||
if (peer->asChannel()->inviter > 0 && peer->asChannel()->amIn()) {
|
if (peer->asChannel()->inviter > 0 && peer->asChannel()->amIn()) {
|
||||||
if (auto from = App::userLoaded(peer->asChannel()->inviter)) {
|
if (App::userLoaded(peer->asChannel()->inviter)) {
|
||||||
auto h = App::history(peer->id);
|
auto h = App::history(peer->id);
|
||||||
h->clear(true);
|
h->clear(true);
|
||||||
h->addNewerSlice(QVector<MTPMessage>());
|
h->addNewerSlice(QVector<MTPMessage>());
|
||||||
|
|
@ -1358,9 +1357,6 @@ void MainWidget::onCacheBackground() {
|
||||||
result.setDevicePixelRatio(cRetinaFactor());
|
result.setDevicePixelRatio(cRetinaFactor());
|
||||||
{
|
{
|
||||||
QPainter p(&result);
|
QPainter p(&result);
|
||||||
auto left = 0;
|
|
||||||
auto top = 0;
|
|
||||||
auto right = _willCacheFor.width();
|
|
||||||
auto bottom = _willCacheFor.height();
|
auto bottom = _willCacheFor.height();
|
||||||
auto w = bg.width() / cRetinaFactor();
|
auto w = bg.width() / cRetinaFactor();
|
||||||
auto h = bg.height() / cRetinaFactor();
|
auto h = bg.height() / cRetinaFactor();
|
||||||
|
|
|
||||||
|
|
@ -769,7 +769,6 @@ Manager::ResultHandleState Manager::handleResult(ReaderPrivate *reader, ProcessR
|
||||||
auto it = constUnsafeFindReaderPointer(reader);
|
auto it = constUnsafeFindReaderPointer(reader);
|
||||||
if (it != _readerPointers.cend()) {
|
if (it != _readerPointers.cend()) {
|
||||||
qint32 index = 0;
|
qint32 index = 0;
|
||||||
Reader *r = it.key();
|
|
||||||
Reader::Frame *frame = it.key()->frameToWrite(&index);
|
Reader::Frame *frame = it.key()->frameToWrite(&index);
|
||||||
if (frame) {
|
if (frame) {
|
||||||
frame->clear();
|
frame->clear();
|
||||||
|
|
|
||||||
|
|
@ -279,13 +279,10 @@ void CoverWidget::handleSongUpdate(const TrackState &state) {
|
||||||
|
|
||||||
void CoverWidget::updateTimeText(const TrackState &state) {
|
void CoverWidget::updateTimeText(const TrackState &state) {
|
||||||
QString time;
|
QString time;
|
||||||
qint64 position = 0, length = 0, display = 0;
|
qint64 display = 0;
|
||||||
auto frequency = state.frequency;
|
auto frequency = state.frequency;
|
||||||
if (!IsStoppedOrStopping(state.state)) {
|
if (!IsStoppedOrStopping(state.state)) {
|
||||||
display = position = state.position;
|
display = state.position;
|
||||||
length = state.length;
|
|
||||||
} else {
|
|
||||||
length = state.length ? state.length : (state.id.audio()->song()->duration * frequency);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_lastDurationMs = (state.length * 1000LL) / frequency;
|
_lastDurationMs = (state.length * 1000LL) / frequency;
|
||||||
|
|
|
||||||
|
|
@ -431,11 +431,10 @@ void Widget::handleSongUpdate(const TrackState &state) {
|
||||||
|
|
||||||
void Widget::updateTimeText(const TrackState &state) {
|
void Widget::updateTimeText(const TrackState &state) {
|
||||||
QString time;
|
QString time;
|
||||||
qint64 position = 0, length = 0, display = 0;
|
qint64 display = 0;
|
||||||
auto frequency = state.frequency;
|
auto frequency = state.frequency;
|
||||||
if (!IsStoppedOrStopping(state.state)) {
|
if (!IsStoppedOrStopping(state.state)) {
|
||||||
display = position = state.position;
|
display = state.position;
|
||||||
length = state.length;
|
|
||||||
} else if (state.length) {
|
} else if (state.length) {
|
||||||
display = state.length;
|
display = state.length;
|
||||||
} else if (state.id.audio()->song()) {
|
} else if (state.id.audio()->song()) {
|
||||||
|
|
|
||||||
|
|
@ -2141,7 +2141,7 @@ void MediaView::paintThemePreview(Painter &p, QRect clip) {
|
||||||
if (titleRect.x() < 0) {
|
if (titleRect.x() < 0) {
|
||||||
titleRect = QRect(0, _themePreviewRect.y(), width(), st::themePreviewMargin.top());
|
titleRect = QRect(0, _themePreviewRect.y(), width(), st::themePreviewMargin.top());
|
||||||
}
|
}
|
||||||
if (auto fillTitleRect = (titleRect.y() < 0)) {
|
if (titleRect.y() < 0) {
|
||||||
titleRect.moveTop(0);
|
titleRect.moveTop(0);
|
||||||
fillOverlay(titleRect);
|
fillOverlay(titleRect);
|
||||||
}
|
}
|
||||||
|
|
@ -2154,10 +2154,8 @@ void MediaView::paintThemePreview(Painter &p, QRect clip) {
|
||||||
p.drawTextLeft(titleRect.x(), titleRect.y(), width(), lang(lng_theme_preview_title));
|
p.drawTextLeft(titleRect.x(), titleRect.y(), width(), lang(lng_theme_preview_title));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto buttonsRect = QRect(_themePreviewRect.x(),
|
auto buttonsRect = QRect(_themePreviewRect.x(), _themePreviewRect.y() + _themePreviewRect.height() - st::themePreviewMargin.bottom(), _themePreviewRect.width(), st::themePreviewMargin.bottom());
|
||||||
_themePreviewRect.y() + _themePreviewRect.height() - st::themePreviewMargin.bottom(),
|
if (buttonsRect.y() + buttonsRect.height() > height()) {
|
||||||
_themePreviewRect.width(), st::themePreviewMargin.bottom());
|
|
||||||
if (auto fillButtonsRect = (buttonsRect.y() + buttonsRect.height() > height())) {
|
|
||||||
buttonsRect.moveTop(height() - buttonsRect.height());
|
buttonsRect.moveTop(height() - buttonsRect.height());
|
||||||
fillOverlay(buttonsRect);
|
fillOverlay(buttonsRect);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,7 @@ void SessionData::setKey(const AuthKeyPtr &key) {
|
||||||
void SessionData::clear(Instance *instance) {
|
void SessionData::clear(Instance *instance) {
|
||||||
RPCCallbackClears clearCallbacks;
|
RPCCallbackClears clearCallbacks;
|
||||||
{
|
{
|
||||||
QReadLocker locker1(haveSentMutex()), locker2(toResendMutex()), locker3(haveReceivedMutex()),
|
QReadLocker locker1(haveSentMutex()), locker2(toResendMutex()), locker3(haveReceivedMutex()), locker4(wereAckedMutex());
|
||||||
locker4(wereAckedMutex());
|
|
||||||
auto receivedResponsesEnd = _receivedResponses.cend();
|
|
||||||
clearCallbacks.reserve(_haveSent.size() + _wereAcked.size());
|
clearCallbacks.reserve(_haveSent.size() + _wereAcked.size());
|
||||||
for (auto i = _haveSent.cbegin(), e = _haveSent.cend(); i != e; ++i) {
|
for (auto i = _haveSent.cbegin(), e = _haveSent.cend(); i != e; ++i) {
|
||||||
auto requestId = i.value()->requestId;
|
auto requestId = i.value()->requestId;
|
||||||
|
|
|
||||||
|
|
@ -784,11 +784,6 @@ bool OverviewInner::preloadLocal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextSelection OverviewInner::itemSelectedValue(qint32 index) const {
|
TextSelection OverviewInner::itemSelectedValue(qint32 index) const {
|
||||||
qint32 selfrom = -1, selto = -1;
|
|
||||||
if (_dragSelFromIndex >= 0 && _dragSelToIndex >= 0) {
|
|
||||||
selfrom = _dragSelToIndex;
|
|
||||||
selto = _dragSelFromIndex;
|
|
||||||
}
|
|
||||||
if (_items.at(index)->toMediaItem()) { // draw item
|
if (_items.at(index)->toMediaItem()) { // draw item
|
||||||
if (index >= _dragSelToIndex && index <= _dragSelFromIndex && _dragSelToIndex >= 0) {
|
if (index >= _dragSelToIndex && index <= _dragSelFromIndex && _dragSelToIndex >= 0) {
|
||||||
return (_dragSelecting && _items.at(index)->msgId() > 0) ? FullSelection : TextSelection{0, 0};
|
return (_dragSelecting && _items.at(index)->msgId() > 0) ? FullSelection : TextSelection{0, 0};
|
||||||
|
|
@ -834,7 +829,6 @@ void OverviewInner::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectedItems::const_iterator selEnd = _selected.cend();
|
SelectedItems::const_iterator selEnd = _selected.cend();
|
||||||
bool hasSel = !_selected.isEmpty();
|
|
||||||
|
|
||||||
if (_type == OverviewPhotos || _type == OverviewVideos) {
|
if (_type == OverviewPhotos || _type == OverviewVideos) {
|
||||||
qint32 count = _items.size(), rowsCount = count / _photosInRow + ((count % _photosInRow) ? 1 : 0);
|
qint32 count = _items.size(), rowsCount = count / _photosInRow + ((count % _photosInRow) ? 1 : 0);
|
||||||
|
|
@ -859,7 +853,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p.translate(_rowsLeft, _marginTop);
|
p.translate(_rowsLeft, _marginTop);
|
||||||
qint32 y = 0, w = _rowWidth;
|
qint32 y = 0;
|
||||||
for (qint32 j = 0, l = _items.size(); j < l; ++j) {
|
for (qint32 j = 0, l = _items.size(); j < l; ++j) {
|
||||||
qint32 i = _reversed ? (l - j - 1) : j, nexti = _reversed ? (i - 1) : (i + 1);
|
qint32 i = _reversed ? (l - j - 1) : j, nexti = _reversed ? (i - 1) : (i + 1);
|
||||||
qint32 nextItemTop =
|
qint32 nextItemTop =
|
||||||
|
|
@ -897,7 +891,6 @@ void OverviewInner::onUpdateSelected() {
|
||||||
ClickHandlerHost *lnkhost = nullptr;
|
ClickHandlerHost *lnkhost = nullptr;
|
||||||
HistoryItem *item = 0;
|
HistoryItem *item = 0;
|
||||||
qint32 index = -1;
|
qint32 index = -1;
|
||||||
qint32 newsel = 0;
|
|
||||||
HistoryCursorState cursorState = HistoryDefaultCursorState;
|
HistoryCursorState cursorState = HistoryDefaultCursorState;
|
||||||
if (_type == OverviewPhotos || _type == OverviewVideos) {
|
if (_type == OverviewPhotos || _type == OverviewVideos) {
|
||||||
double w = (double(_width - st::overviewPhotoSkip) / _photosInRow);
|
double w = (double(_width - st::overviewPhotoSkip) / _photosInRow);
|
||||||
|
|
@ -1016,11 +1009,8 @@ void OverviewInner::onUpdateSelected() {
|
||||||
}
|
}
|
||||||
if (_dragAction == Selecting) {
|
if (_dragAction == Selecting) {
|
||||||
bool canSelectMany = (_peer != 0);
|
bool canSelectMany = (_peer != 0);
|
||||||
if (_mousedItem == _dragItem && lnk && !_selected.isEmpty() &&
|
if (_mousedItem == _dragItem && lnk && !_selected.isEmpty() && _selected.cbegin().value() != FullSelection) {
|
||||||
_selected.cbegin().value() != FullSelection) {
|
_selected[_dragItem] = { 0, 0 };
|
||||||
bool afterSymbol = false, uponSymbol = false;
|
|
||||||
quint16 second = 0;
|
|
||||||
_selected[_dragItem] = {0, 0};
|
|
||||||
updateDragSelection(0, -1, 0, -1, false);
|
updateDragSelection(0, -1, 0, -1, false);
|
||||||
} else if (canSelectMany) {
|
} else if (canSelectMany) {
|
||||||
bool selectingDown =
|
bool selectingDown =
|
||||||
|
|
|
||||||
|
|
@ -251,13 +251,10 @@ void MainWindow::psCreateTrayIcon() {
|
||||||
void MainWindow::psFirstShow() {
|
void MainWindow::psFirstShow() {
|
||||||
psCreateTrayIcon();
|
psCreateTrayIcon();
|
||||||
|
|
||||||
|
|
||||||
psUpdateMargins();
|
psUpdateMargins();
|
||||||
|
|
||||||
bool showShadows = true;
|
|
||||||
|
|
||||||
show();
|
show();
|
||||||
//_private.enableShadow(winId());
|
|
||||||
if (cWindowPos().maximized) {
|
if (cWindowPos().maximized) {
|
||||||
DEBUG_LOG(("Window Pos: First show, setting maximized."));
|
DEBUG_LOG(("Window Pos: First show, setting maximized."));
|
||||||
setWindowState(Qt::WindowMaximized);
|
setWindowState(Qt::WindowMaximized);
|
||||||
|
|
@ -270,7 +267,6 @@ void MainWindow::psFirstShow() {
|
||||||
} else {
|
} else {
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
showShadows = false;
|
|
||||||
} else {
|
} else {
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,6 @@ int CoverWidget::resizeGetHeight(int newWidth) {
|
||||||
|
|
||||||
void CoverWidget::refreshButtonsGeometry(int newWidth) {
|
void CoverWidget::refreshButtonsGeometry(int newWidth) {
|
||||||
int buttonLeft = _userpicButton->x() + _userpicButton->width() + st::settingsButtonLeft;
|
int buttonLeft = _userpicButton->x() + _userpicButton->width() + st::settingsButtonLeft;
|
||||||
int buttonsRight = newWidth - st::settingsButtonSkip;
|
|
||||||
_setPhoto->moveToLeft(buttonLeft, _userpicButton->y() + st::settingsButtonTop, newWidth);
|
_setPhoto->moveToLeft(buttonLeft, _userpicButton->y() + st::settingsButtonTop, newWidth);
|
||||||
buttonLeft += _setPhoto->width() + st::settingsButtonSkip;
|
buttonLeft += _setPhoto->width() + st::settingsButtonSkip;
|
||||||
_editName->moveToLeft(buttonLeft, _setPhoto->y(), newWidth);
|
_editName->moveToLeft(buttonLeft, _setPhoto->y(), newWidth);
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@ void FileLoadTask::process() {
|
||||||
filemime = _information->filemime;
|
filemime = _information->filemime;
|
||||||
if (auto image = base::get_if<FileLoadTask::Image>(&_information->media)) {
|
if (auto image = base::get_if<FileLoadTask::Image>(&_information->media)) {
|
||||||
fullimage = base::take(image->data);
|
fullimage = base::take(image->data);
|
||||||
if (auto opaque = (filemime != stickerMime)) {
|
if (filemime != stickerMime) {
|
||||||
fullimage = Images::prepareOpaque(std::move(fullimage));
|
fullimage = Images::prepareOpaque(std::move(fullimage));
|
||||||
}
|
}
|
||||||
isAnimation = image->animated;
|
isAnimation = image->animated;
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ void EmptyUserpic::Impl::fillString(const QString &name) {
|
||||||
auto ch = name.constData(), end = ch + name.size();
|
auto ch = name.constData(), end = ch + name.size();
|
||||||
while (ch != end) {
|
while (ch != end) {
|
||||||
auto emojiLength = 0;
|
auto emojiLength = 0;
|
||||||
if (auto emoji = Ui::Emoji::Find(ch, end, &emojiLength)) {
|
if (Ui::Emoji::Find(ch, end, &emojiLength)) {
|
||||||
ch += emojiLength;
|
ch += emojiLength;
|
||||||
} else if (ch->isHighSurrogate()) {
|
} else if (ch->isHighSurrogate()) {
|
||||||
++ch;
|
++ch;
|
||||||
|
|
@ -1771,10 +1771,8 @@ void DocumentData::performActionOnLoad() {
|
||||||
auto showImage = !isVideo() && (size < App::kImageSizeLimit);
|
auto showImage = !isVideo() && (size < App::kImageSizeLimit);
|
||||||
auto playVoice = voice() && (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen);
|
auto playVoice = voice() && (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen);
|
||||||
auto playMusic = tryPlaySong() && (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen);
|
auto playMusic = tryPlaySong() && (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen);
|
||||||
auto playAnimation = isAnimation() &&
|
auto playAnimation = isAnimation() && (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen) && showImage && item && item->getMedia();
|
||||||
(_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen) && showImage &&
|
if (isTheme()) {
|
||||||
item && item->getMedia();
|
|
||||||
if (auto applyTheme = isTheme()) {
|
|
||||||
if (!loc.isEmpty() && loc.accessEnable()) {
|
if (!loc.isEmpty() && loc.accessEnable()) {
|
||||||
Messenger::Instance().showDocument(this, item);
|
Messenger::Instance().showDocument(this, item);
|
||||||
loc.accessDisable();
|
loc.accessDisable();
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,6 @@ CountryInput::CountryInput(QWidget *parent, const style::InputField &st)
|
||||||
initCountries();
|
initCountries();
|
||||||
resize(_st.width, _st.heightMin);
|
resize(_st.width, _st.heightMin);
|
||||||
|
|
||||||
auto availableWidth = width() - _st.textMargins.left() - _st.textMargins.right() - _st.placeholderMargins.left() -
|
|
||||||
_st.placeholderMargins.right() - 1;
|
|
||||||
auto placeholderFont = _st.placeholderFont->f;
|
auto placeholderFont = _st.placeholderFont->f;
|
||||||
placeholderFont.setStyleStrategy(QFont::PreferMatch);
|
placeholderFont.setStyleStrategy(QFont::PreferMatch);
|
||||||
auto metrics = QFontMetrics(placeholderFont);
|
auto metrics = QFontMetrics(placeholderFont);
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ QImage prepareBlur(QImage img) {
|
||||||
|
|
||||||
uchar *pix = img.bits();
|
uchar *pix = img.bits();
|
||||||
if (pix) {
|
if (pix) {
|
||||||
int w = img.width(), h = img.height(), wold = w, hold = h;
|
int w = img.width(), h = img.height();
|
||||||
const int radius = 3;
|
const int radius = 3;
|
||||||
const int r1 = radius + 1;
|
const int r1 = radius + 1;
|
||||||
const int div = radius * 2 + 1;
|
const int div = radius * 2 + 1;
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ void colorizeImage(const QImage &src, QColor c, QImage *outResult, QRect srcRect
|
||||||
|
|
||||||
auto pattern = anim::shifted(c);
|
auto pattern = anim::shifted(c);
|
||||||
|
|
||||||
auto resultBytesPerPixel = (src.depth() >> 3);
|
|
||||||
constexpr auto resultIntsPerPixel = 1;
|
constexpr auto resultIntsPerPixel = 1;
|
||||||
auto resultIntsPerLine = (outResult->bytesPerLine() >> 2);
|
auto resultIntsPerLine = (outResult->bytesPerLine() >> 2);
|
||||||
auto resultIntsAdded = resultIntsPerLine - width * resultIntsPerPixel;
|
auto resultIntsAdded = resultIntsPerLine - width * resultIntsPerPixel;
|
||||||
|
|
|
||||||
|
|
@ -513,7 +513,6 @@ public:
|
||||||
qint32 i = 0, l = preparsed.size();
|
qint32 i = 0, l = preparsed.size();
|
||||||
source.entities.clear();
|
source.entities.clear();
|
||||||
source.entities.reserve(l);
|
source.entities.reserve(l);
|
||||||
const QChar s = source.text.size();
|
|
||||||
for (; i < l; ++i) {
|
for (; i < l; ++i) {
|
||||||
auto type = preparsed.at(i).type();
|
auto type = preparsed.at(i).type();
|
||||||
if (((type == EntityInTextMention || type == EntityInTextMentionName) && !parseMentions) ||
|
if (((type == EntityInTextMention || type == EntityInTextMentionName) && !parseMentions) ||
|
||||||
|
|
|
||||||
|
|
@ -1253,7 +1253,7 @@ QString EscapeForRichParsing(const QString &text) {
|
||||||
|
|
||||||
QString SingleLine(const QString &text) {
|
QString SingleLine(const QString &text) {
|
||||||
auto result = text;
|
auto result = text;
|
||||||
auto s = text.unicode(), ch = s, e = text.unicode() + text.size();
|
auto s = text.unicode(), e = text.unicode() + text.size();
|
||||||
|
|
||||||
// Trim.
|
// Trim.
|
||||||
while (s < e && chIsTrimmed(*s)) {
|
while (s < e && chIsTrimmed(*s)) {
|
||||||
|
|
@ -1315,7 +1315,6 @@ QStringList PrepareSearchWords(const QString &query, const QRegularExpression *S
|
||||||
auto result = QStringList();
|
auto result = QStringList();
|
||||||
if (!clean.isEmpty()) {
|
if (!clean.isEmpty()) {
|
||||||
auto list = clean.split(SplitterOverride ? *SplitterOverride : RegExpWordSplit(), QString::SkipEmptyParts);
|
auto list = clean.split(SplitterOverride ? *SplitterOverride : RegExpWordSplit(), QString::SkipEmptyParts);
|
||||||
auto size = list.size();
|
|
||||||
result.reserve(list.size());
|
result.reserve(list.size());
|
||||||
for_const (auto &word, list) {
|
for_const (auto &word, list) {
|
||||||
auto trimmed = word.trimmed();
|
auto trimmed = word.trimmed();
|
||||||
|
|
@ -1401,7 +1400,7 @@ bool CutPart(TextWithEntities &sending, TextWithEntities &left, qint32 limit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int elen = 0;
|
int elen = 0;
|
||||||
if (auto e = Ui::Emoji::Find(ch, end, &elen)) {
|
if (Ui::Emoji::Find(ch, end, &elen)) {
|
||||||
for (int i = 0; i < elen; ++i, ++ch, ++s) {
|
for (int i = 0; i < elen; ++i, ++ch, ++s) {
|
||||||
if (ch->isHighSurrogate() && i + 1 < elen && (ch + 1)->isLowSurrogate()) {
|
if (ch->isHighSurrogate() && i + 1 < elen && (ch + 1)->isLowSurrogate()) {
|
||||||
++ch;
|
++ch;
|
||||||
|
|
@ -2066,7 +2065,7 @@ QString ApplyEntities(const TextWithEntities &text) {
|
||||||
|
|
||||||
QString result;
|
QString result;
|
||||||
qint32 size = text.text.size();
|
qint32 size = text.text.size();
|
||||||
const QChar *b = text.text.constData(), *already = b, *e = b + size;
|
const QChar *b = text.text.constData(), *already = b;//, *e = b + size;
|
||||||
auto entity = text.entities.cbegin(), end = text.entities.cend();
|
auto entity = text.entities.cbegin(), end = text.entities.cend();
|
||||||
auto skipTillRelevantAndGetTag = [&entity, &end, size, &tags] {
|
auto skipTillRelevantAndGetTag = [&entity, &end, size, &tags] {
|
||||||
while (entity != end) {
|
while (entity != end) {
|
||||||
|
|
|
||||||
|
|
@ -219,10 +219,8 @@ enum class PrepareTextOption {
|
||||||
CheckLinks,
|
CheckLinks,
|
||||||
};
|
};
|
||||||
inline QString PrepareForSending(const QString &text, PrepareTextOption option = PrepareTextOption::IgnoreLinks) {
|
inline QString PrepareForSending(const QString &text, PrepareTextOption option = PrepareTextOption::IgnoreLinks) {
|
||||||
auto result = TextWithEntities{text};
|
auto result = TextWithEntities { text }; // , {}}
|
||||||
auto prepareFlags = (option == PrepareTextOption::CheckLinks) ?
|
auto prepareFlags = (option == PrepareTextOption::CheckLinks) ? (TextParseLinks | TextParseMentions | TextParseHashtags | TextParseBotCommands) : 0;
|
||||||
(TextParseLinks | TextParseMentions | TextParseHashtags | TextParseBotCommands) :
|
|
||||||
0;
|
|
||||||
PrepareForSending(result, prepareFlags);
|
PrepareForSending(result, prepareFlags);
|
||||||
return result.text;
|
return result.text;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1567,7 +1567,6 @@ void FlatInput::touchEvent(QTouchEvent *e) {
|
||||||
case QEvent::TouchEnd:
|
case QEvent::TouchEnd:
|
||||||
if (!_touchPress) return;
|
if (!_touchPress) return;
|
||||||
if (!_touchMove && window()) {
|
if (!_touchMove && window()) {
|
||||||
Qt::MouseButton btn(_touchRightButton ? Qt::RightButton : Qt::LeftButton);
|
|
||||||
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
|
QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart));
|
||||||
|
|
||||||
if (_touchRightButton) {
|
if (_touchRightButton) {
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,6 @@ void ImportantTooltip::updateGeometry() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportantTooltip::resizeEvent(QResizeEvent *e) {
|
void ImportantTooltip::resizeEvent(QResizeEvent *e) {
|
||||||
auto inner = countInner();
|
|
||||||
auto contentTop = _st.padding.top();
|
auto contentTop = _st.padding.top();
|
||||||
if (_useTransparency && (_side & RectPart::Bottom)) {
|
if (_useTransparency && (_side & RectPart::Bottom)) {
|
||||||
contentTop += _st.arrow;
|
contentTop += _st.arrow;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue