mirror of https://github.com/procxx/kepka.git
Apply clang-format
This commit is contained in:
parent
6fbecbca22
commit
f9c7e0bddb
|
@ -666,8 +666,8 @@ void EditChatAdminsBoxController::Start(not_null<ChatData *> chat) {
|
||||||
Ui::show(Box<PeerListBox>(std::move(controller), std::move(initBox)));
|
Ui::show(Box<PeerListBox>(std::move(controller), std::move(initBox)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBotToGroupBoxController::Start(not_null<UserData*> bot) {
|
void AddBotToGroupBoxController::Start(not_null<UserData *> bot) {
|
||||||
auto initBox = [](not_null<PeerListBox*> box) {
|
auto initBox = [](not_null<PeerListBox *> box) {
|
||||||
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
||||||
};
|
};
|
||||||
Ui::show(Box<PeerListBox>(std::make_unique<AddBotToGroupBoxController>(bot), std::move(initBox)));
|
Ui::show(Box<PeerListBox>(std::make_unique<AddBotToGroupBoxController>(bot), std::move(initBox)));
|
||||||
|
|
|
@ -369,7 +369,8 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) {
|
||||||
if (_pack.isEmpty()) return;
|
if (_pack.isEmpty()) return;
|
||||||
|
|
||||||
auto ms = getms();
|
auto ms = getms();
|
||||||
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) {
|
||||||
|
|
|
@ -953,9 +953,9 @@ void StickersBox::Inner::setPressed(int pressed) {
|
||||||
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 (!set->ripple) {
|
if (!set->ripple) {
|
||||||
set->ripple = std::make_unique<Ui::RippleAnimation>(st::contactsRipple, std::move(rippleMask), [this, index = _pressed] {
|
set->ripple = std::make_unique<Ui::RippleAnimation>(
|
||||||
update(0, _itemsTop + index * _rowHeight, width(), _rowHeight);
|
st::contactsRipple, std::move(rippleMask),
|
||||||
});
|
[this, index = _pressed] { update(0, _itemsTop + index * _rowHeight, width(), _rowHeight); });
|
||||||
}
|
}
|
||||||
set->ripple->add(mapFromGlobal(QCursor::pos()) - QPoint(0, _itemsTop + _pressed * _rowHeight));
|
set->ripple->add(mapFromGlobal(QCursor::pos()) - QPoint(0, _itemsTop + _pressed * _rowHeight));
|
||||||
}
|
}
|
||||||
|
|
|
@ -927,8 +927,12 @@ void FieldAutocompleteInner::onUpdateSelected(bool force) {
|
||||||
|
|
||||||
qint32 sel = -1, maxSel = 0;
|
qint32 sel = -1, maxSel = 0;
|
||||||
if (!_srows->isEmpty()) {
|
if (!_srows->isEmpty()) {
|
||||||
qint32 row = (mouse.y() >= st::stickerPanPadding) ? ((mouse.y() - st::stickerPanPadding) / st::stickerPanSize.height()) : -1;
|
qint32 row = (mouse.y() >= st::stickerPanPadding) ?
|
||||||
qint32 col = (mouse.x() >= st::stickerPanPadding) ? ((mouse.x() - st::stickerPanPadding) / st::stickerPanSize.width()) : -1;
|
((mouse.y() - st::stickerPanPadding) / st::stickerPanSize.height()) :
|
||||||
|
-1;
|
||||||
|
qint32 col = (mouse.x() >= st::stickerPanPadding) ?
|
||||||
|
((mouse.x() - st::stickerPanPadding) / st::stickerPanSize.width()) :
|
||||||
|
-1;
|
||||||
if (row >= 0 && col >= 0) {
|
if (row >= 0 && col >= 0) {
|
||||||
sel = row * _stickersPerRow + col;
|
sel = row * _stickersPerRow + col;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1690,14 +1690,17 @@ void StickersListWidget::installSet(quint64 setId) {
|
||||||
auto &sets = Global::StickerSets();
|
auto &sets = Global::StickerSets();
|
||||||
auto it = sets.constFind(setId);
|
auto it = sets.constFind(setId);
|
||||||
if (it != sets.cend()) {
|
if (it != sets.cend()) {
|
||||||
request(MTPmessages_InstallStickerSet(Stickers::inputSetId(*it), MTP_bool(false))).done([](const MTPmessages_StickerSetInstallResult &result) {
|
request(MTPmessages_InstallStickerSet(Stickers::inputSetId(*it), MTP_bool(false)))
|
||||||
if (result.type() == mtpc_messages_stickerSetInstallResultArchive) {
|
.done([](const MTPmessages_StickerSetInstallResult &result) {
|
||||||
Stickers::ApplyArchivedResult(result.c_messages_stickerSetInstallResultArchive());
|
if (result.type() == mtpc_messages_stickerSetInstallResultArchive) {
|
||||||
}
|
Stickers::ApplyArchivedResult(result.c_messages_stickerSetInstallResultArchive());
|
||||||
}).fail([this, setId](const RPCError &error) {
|
}
|
||||||
notInstalledLocally(setId);
|
})
|
||||||
Stickers::UndoInstallLocally(setId);
|
.fail([this, setId](const RPCError &error) {
|
||||||
}).send();
|
notInstalledLocally(setId);
|
||||||
|
Stickers::UndoInstallLocally(setId);
|
||||||
|
})
|
||||||
|
.send();
|
||||||
|
|
||||||
installedLocally(setId);
|
installedLocally(setId);
|
||||||
Stickers::InstallLocally(setId);
|
Stickers::InstallLocally(setId);
|
||||||
|
|
|
@ -687,7 +687,7 @@ bool Generator::writeIncludesInSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto includes = QStringList();
|
auto includes = QStringList();
|
||||||
std::function<bool(const Module&)> collector = [&collector, &includes](const Module &module) {
|
std::function<bool(const Module &)> collector = [&collector, &includes](const Module &module) {
|
||||||
module.enumIncludes(collector);
|
module.enumIncludes(collector);
|
||||||
auto base = moduleBaseName(module);
|
auto base = moduleBaseName(module);
|
||||||
if (!includes.contains(base)) {
|
if (!includes.contains(base)) {
|
||||||
|
|
|
@ -2035,7 +2035,10 @@ void DialogsInner::loadPeerPhotos() {
|
||||||
_filterResults.size();
|
_filterResults.size();
|
||||||
if (from < 0) from = 0;
|
if (from < 0) from = 0;
|
||||||
if (from < _peerSearchResults.size()) {
|
if (from < _peerSearchResults.size()) {
|
||||||
qint32 to = (yTo > filteredOffset() + st::searchedBarHeight ? ((yTo - filteredOffset() - st::searchedBarHeight) / qint32(st::dialogsRowHeight)) : 0) - _filterResults.size() + 1;
|
qint32 to = (yTo > filteredOffset() + st::searchedBarHeight ?
|
||||||
|
((yTo - filteredOffset() - st::searchedBarHeight) / qint32(st::dialogsRowHeight)) :
|
||||||
|
0) -
|
||||||
|
_filterResults.size() + 1;
|
||||||
if (to > _peerSearchResults.size()) to = _peerSearchResults.size();
|
if (to > _peerSearchResults.size()) to = _peerSearchResults.size();
|
||||||
|
|
||||||
for (; from < to; ++from) {
|
for (; from < to; ++from) {
|
||||||
|
|
|
@ -347,35 +347,32 @@ void RowPainter::paint(Painter &p, const Row *row, int fullWidth, bool active, b
|
||||||
(st::dialogsUnreadHeight - st::dialogsUnreadFont->height) / 2;
|
(st::dialogsUnreadHeight - st::dialogsUnreadFont->height) / 2;
|
||||||
auto unreadWidth = 0;
|
auto unreadWidth = 0;
|
||||||
|
|
||||||
UnreadBadgeStyle st;
|
UnreadBadgeStyle st;
|
||||||
st.active = active;
|
st.active = active;
|
||||||
st.muted = false;
|
st.muted = false;
|
||||||
st.padding = 0;
|
st.padding = 0;
|
||||||
st.textTop = 0;
|
st.textTop = 0;
|
||||||
paintUnreadCount(p, counter, unreadRight, unreadTop, st, &unreadWidth);
|
paintUnreadCount(p, counter, unreadRight, unreadTop, st, &unreadWidth);
|
||||||
availableWidth -= unreadWidth + st.padding + (hadOneBadge ? st::dialogsUnreadPadding : 0);
|
availableWidth -= unreadWidth + st.padding + (hadOneBadge ? st::dialogsUnreadPadding : 0);
|
||||||
}
|
}
|
||||||
auto &color = active ? st::dialogsTextFgServiceActive : (selected ? st::dialogsTextFgServiceOver : st::dialogsTextFgService);
|
auto &color = active ? st::dialogsTextFgServiceActive :
|
||||||
if (!history->paintSendAction(p, nameleft, texttop, availableWidth, fullWidth, color, ms)) {
|
(selected ? st::dialogsTextFgServiceOver : st::dialogsTextFgService);
|
||||||
item->drawInDialog(
|
if (!history->paintSendAction(p, nameleft, texttop, availableWidth, fullWidth, color, ms)) {
|
||||||
p,
|
item->drawInDialog(p, QRect(nameleft, texttop, availableWidth, st::dialogsTextFont->height), active,
|
||||||
QRect(nameleft, texttop, availableWidth, st::dialogsTextFont->height),
|
selected, HistoryItem::DrawInDialog::Normal, history->textCachedFor,
|
||||||
active,
|
history->lastItemTextCache);
|
||||||
selected,
|
}
|
||||||
HistoryItem::DrawInDialog::Normal,
|
},
|
||||||
history->textCachedFor,
|
[&p, active, history, unreadCount] {
|
||||||
history->lastItemTextCache);
|
if (unreadCount) {
|
||||||
}
|
auto counter = QString::number(unreadCount);
|
||||||
}, [&p, active, history, unreadCount] {
|
if (counter.size() > 4) {
|
||||||
if (unreadCount) {
|
counter = qsl("..") + counter.mid(counter.size() - 3);
|
||||||
auto counter = QString::number(unreadCount);
|
}
|
||||||
if (counter.size() > 4) {
|
auto mutedCounter = history->mute();
|
||||||
counter = qsl("..") + counter.mid(counter.size() - 3);
|
auto unreadRight = st::dialogsPadding.x() + st::dialogsPhotoSize;
|
||||||
}
|
auto unreadTop = st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight;
|
||||||
auto mutedCounter = history->mute();
|
auto unreadWidth = 0;
|
||||||
auto unreadRight = st::dialogsPadding.x() + st::dialogsPhotoSize;
|
|
||||||
auto unreadTop = st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight;
|
|
||||||
auto unreadWidth = 0;
|
|
||||||
|
|
||||||
UnreadBadgeStyle st;
|
UnreadBadgeStyle st;
|
||||||
st.active = active;
|
st.active = active;
|
||||||
|
|
|
@ -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());
|
||||||
|
|
|
@ -2154,7 +2154,9 @@ 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(), _themePreviewRect.y() + _themePreviewRect.height() - st::themePreviewMargin.bottom(), _themePreviewRect.width(), st::themePreviewMargin.bottom());
|
auto buttonsRect = QRect(_themePreviewRect.x(),
|
||||||
|
_themePreviewRect.y() + _themePreviewRect.height() - st::themePreviewMargin.bottom(),
|
||||||
|
_themePreviewRect.width(), st::themePreviewMargin.bottom());
|
||||||
if (buttonsRect.y() + buttonsRect.height() > height()) {
|
if (buttonsRect.y() + buttonsRect.height() > height()) {
|
||||||
buttonsRect.moveTop(height() - buttonsRect.height());
|
buttonsRect.moveTop(height() - buttonsRect.height());
|
||||||
fillOverlay(buttonsRect);
|
fillOverlay(buttonsRect);
|
||||||
|
|
|
@ -50,7 +50,8 @@ 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()), locker4(wereAckedMutex());
|
QReadLocker locker1(haveSentMutex()), locker2(toResendMutex()), locker3(haveReceivedMutex()),
|
||||||
|
locker4(wereAckedMutex());
|
||||||
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;
|
||||||
|
|
|
@ -1009,8 +1009,9 @@ void OverviewInner::onUpdateSelected() {
|
||||||
}
|
}
|
||||||
if (_dragAction == Selecting) {
|
if (_dragAction == Selecting) {
|
||||||
bool canSelectMany = (_peer != 0);
|
bool canSelectMany = (_peer != 0);
|
||||||
if (_mousedItem == _dragItem && lnk && !_selected.isEmpty() && _selected.cbegin().value() != FullSelection) {
|
if (_mousedItem == _dragItem && lnk && !_selected.isEmpty() &&
|
||||||
_selected[_dragItem] = { 0, 0 };
|
_selected.cbegin().value() != FullSelection) {
|
||||||
|
_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 =
|
||||||
|
|
|
@ -1771,7 +1771,9 @@ 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() && (_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen) && showImage && item && item->getMedia();
|
auto playAnimation = isAnimation() &&
|
||||||
|
(_actionOnLoad == ActionOnLoadPlayInline || _actionOnLoad == ActionOnLoadOpen) && showImage &&
|
||||||
|
item && item->getMedia();
|
||||||
if (isTheme()) {
|
if (isTheme()) {
|
||||||
if (!loc.isEmpty() && loc.accessEnable()) {
|
if (!loc.isEmpty() && loc.accessEnable()) {
|
||||||
Messenger::Instance().showDocument(this, item);
|
Messenger::Instance().showDocument(this, item);
|
||||||
|
|
|
@ -2065,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,8 +219,10 @@ 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) ? (TextParseLinks | TextParseMentions | TextParseHashtags | TextParseBotCommands) : 0;
|
auto prepareFlags = (option == PrepareTextOption::CheckLinks) ?
|
||||||
|
(TextParseLinks | TextParseMentions | TextParseHashtags | TextParseBotCommands) :
|
||||||
|
0;
|
||||||
PrepareForSending(result, prepareFlags);
|
PrepareForSending(result, prepareFlags);
|
||||||
return result.text;
|
return result.text;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue