mirror of https://github.com/procxx/kepka.git
Fix unused variables, lambda captures.
This commit is contained in:
parent
f526586bfb
commit
f1b4a86cfe
|
@ -94,7 +94,7 @@ void ApiWrap::requestAppChangelogs() {
|
|||
|
||||
void ApiWrap::addLocalChangelogs(int oldAppVersion) {
|
||||
auto addedSome = false;
|
||||
auto addLocalChangelog = [this, &addedSome](const QString &text) {
|
||||
auto addLocalChangelog = [&addedSome](const QString &text) {
|
||||
auto textWithEntities = TextWithEntities{text};
|
||||
TextUtilities::ParseEntities(textWithEntities, TextParseLinks);
|
||||
App::wnd()->serviceNotification(textWithEntities, MTP_messageMediaEmpty(), unixtime());
|
||||
|
@ -542,7 +542,7 @@ void ApiWrap::requestPeers(const QList<PeerData *> &peers) {
|
|||
channels.push_back((*i)->asChannel()->inputChannel);
|
||||
}
|
||||
}
|
||||
auto handleChats = [this](const MTPmessages_Chats &result) {
|
||||
auto handleChats = [](const MTPmessages_Chats &result) {
|
||||
if (auto chats = Api::getChatsFromMessagesChats(result)) {
|
||||
App::feedChats(*chats);
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ void ApiWrap::requestPeers(const QList<PeerData *> &peers) {
|
|||
}
|
||||
if (!users.isEmpty()) {
|
||||
request(MTPusers_GetUsers(MTP_vector<MTPInputUser>(users)))
|
||||
.done([this](const MTPVector<MTPUser> &result) { App::feedUsers(result); })
|
||||
.done([](const MTPVector<MTPUser> &result) { App::feedUsers(result); })
|
||||
.send();
|
||||
}
|
||||
}
|
||||
|
@ -1192,7 +1192,7 @@ void ApiWrap::handlePrivacyChange(mtpTypeId keyTypeId, const MTPVector<MTPPrivac
|
|||
}
|
||||
|
||||
auto now = unixtime();
|
||||
App::enumerateUsers([&userRules, contactsRule, everyoneRule, now](UserData *user) {
|
||||
App::enumerateUsers([now](UserData *user) {
|
||||
if (user->isSelf() || user->loadedStatus != PeerData::FullLoaded) {
|
||||
return;
|
||||
}
|
||||
|
@ -1460,7 +1460,7 @@ void ApiWrap::resolveWebPages() {
|
|||
}
|
||||
|
||||
void ApiWrap::requestParticipantsCountDelayed(ChannelData *channel) {
|
||||
_participantsCountRequestTimer.call(kReloadChannelMembersTimeout, [this, channel] { channel->updateFullForced(); });
|
||||
_participantsCountRequestTimer.call(kReloadChannelMembersTimeout, [channel] { channel->updateFullForced(); });
|
||||
}
|
||||
|
||||
void ApiWrap::gotWebPages(ChannelData *channel, const MTPmessages_Messages &msgs, mtpRequestId req) {
|
||||
|
@ -1587,7 +1587,7 @@ void ApiWrap::requestStickers(TimeId now) {
|
|||
};
|
||||
_stickersUpdateRequest = request(MTPmessages_GetAllStickers(MTP_int(Local::countStickersHash(true))))
|
||||
.done(onDone)
|
||||
.fail([this, onDone](const RPCError &error) {
|
||||
.fail([onDone](const RPCError &error) {
|
||||
LOG(("App Fail: Failed to get stickers!"));
|
||||
onDone(MTP_messages_allStickersNotModified());
|
||||
})
|
||||
|
@ -1619,7 +1619,7 @@ void ApiWrap::requestRecentStickers(TimeId now) {
|
|||
_recentStickersUpdateRequest =
|
||||
request(MTPmessages_GetRecentStickers(MTP_flags(0), MTP_int(Local::countRecentStickersHash())))
|
||||
.done(onDone)
|
||||
.fail([this, onDone](const RPCError &error) {
|
||||
.fail([onDone](const RPCError &error) {
|
||||
LOG(("App Fail: Failed to get recent stickers!"));
|
||||
onDone(MTP_messages_recentStickersNotModified());
|
||||
})
|
||||
|
@ -1650,7 +1650,7 @@ void ApiWrap::requestFavedStickers(TimeId now) {
|
|||
};
|
||||
_favedStickersUpdateRequest = request(MTPmessages_GetFavedStickers(MTP_int(Local::countFavedStickersHash())))
|
||||
.done(onDone)
|
||||
.fail([this, onDone](const RPCError &error) {
|
||||
.fail([onDone](const RPCError &error) {
|
||||
LOG(("App Fail: Failed to get faved stickers!"));
|
||||
onDone(MTP_messages_favedStickersNotModified());
|
||||
})
|
||||
|
@ -1682,7 +1682,7 @@ void ApiWrap::requestFeaturedStickers(TimeId now) {
|
|||
_featuredStickersUpdateRequest =
|
||||
request(MTPmessages_GetFeaturedStickers(MTP_int(Local::countFeaturedStickersHash())))
|
||||
.done(onDone)
|
||||
.fail([this, onDone](const RPCError &error) {
|
||||
.fail([onDone](const RPCError &error) {
|
||||
LOG(("App Fail: Failed to get featured stickers!"));
|
||||
onDone(MTP_messages_featuredStickersNotModified());
|
||||
})
|
||||
|
@ -1712,7 +1712,7 @@ void ApiWrap::requestSavedGifs(TimeId now) {
|
|||
};
|
||||
_savedGifsUpdateRequest = request(MTPmessages_GetSavedGifs(MTP_int(Local::countSavedGifsHash())))
|
||||
.done(onDone)
|
||||
.fail([this, onDone](const RPCError &error) {
|
||||
.fail([onDone](const RPCError &error) {
|
||||
LOG(("App Fail: Failed to get saved gifs!"));
|
||||
onDone(MTP_messages_savedGifsNotModified());
|
||||
})
|
||||
|
|
|
@ -177,7 +177,7 @@ AuthSession::AuthSession(UserId userId)
|
|||
, _uploader(std::make_unique<Storage::Uploader>())
|
||||
, _notifications(std::make_unique<Window::Notifications::System>(this)) {
|
||||
Expects(_userId != 0);
|
||||
_saveDataTimer.setCallback([this] { Local::writeUserSettings(); });
|
||||
_saveDataTimer.setCallback([] { Local::writeUserSettings(); });
|
||||
subscribe(Messenger::Instance().passcodedChanged(), [this] {
|
||||
_shouldLockAt = 0;
|
||||
notifications().updateAll();
|
||||
|
|
|
@ -643,7 +643,7 @@ ConfirmInviteBox::ConfirmInviteBox(QWidget *, const QString &title, bool isChann
|
|||
}
|
||||
|
||||
void ConfirmInviteBox::prepare() {
|
||||
addButton(langFactory(lng_group_invite_join), [this] {
|
||||
addButton(langFactory(lng_group_invite_join), [] {
|
||||
if (auto main = App::main()) {
|
||||
main->onInviteImport();
|
||||
}
|
||||
|
|
|
@ -921,7 +921,6 @@ void PeerListBox::Inner::paintRow(Painter &p, TimeMs ms, RowIndex index) {
|
|||
row->lazyInitialize();
|
||||
|
||||
auto peer = row->peer();
|
||||
auto user = peer->asUser();
|
||||
auto active = (_pressed.index.value >= 0) ? _pressed : _selected;
|
||||
auto selected = (active.index == index);
|
||||
auto actionSelected = (selected && active.action);
|
||||
|
|
|
@ -1431,12 +1431,12 @@ void InnerWidget::updateSelected() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (_mouseAction == MouseAction::Selecting) {
|
||||
// _widget->checkSelectingScroll(mousePos);
|
||||
//} else {
|
||||
// _widget->noSelectingScroll();
|
||||
//} // TODO
|
||||
/*
|
||||
if (_mouseAction == MouseAction::Selecting) {
|
||||
_widget->checkSelectingScroll(mousePos);
|
||||
} else {
|
||||
_widget->noSelectingScroll();
|
||||
} */ // TODO
|
||||
|
||||
if (_mouseAction == MouseAction::None && (lnkChanged || cursor != _cursor)) {
|
||||
setCursor(_cursor = cursor);
|
||||
|
@ -1445,93 +1445,92 @@ void InnerWidget::updateSelected() {
|
|||
|
||||
void InnerWidget::performDrag() {
|
||||
if (_mouseAction != MouseAction::Dragging) return;
|
||||
/*
|
||||
auto uponSelected = false;
|
||||
if (_mouseActionItem) {
|
||||
if (!_selected.isEmpty() && _selected.cbegin().value() == FullSelection) {
|
||||
uponSelected = _selected.contains(_mouseActionItem);
|
||||
} else {
|
||||
HistoryStateRequest request;
|
||||
request.flags |= Text::StateRequest::Flag::LookupSymbol;
|
||||
auto dragState = _mouseActionItem->getState(_dragStartPosition.x(), _dragStartPosition.y(), request);
|
||||
uponSelected = (dragState.cursor == HistoryInTextCursorState);
|
||||
if (uponSelected) {
|
||||
if (_selected.isEmpty() || _selected.cbegin().value() == FullSelection ||
|
||||
_selected.cbegin().key() != _mouseActionItem) {
|
||||
uponSelected = false;
|
||||
} else {
|
||||
quint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
if (dragState.symbol < selFrom || dragState.symbol >= selTo) {
|
||||
uponSelected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
auto pressedHandler = ClickHandler::getPressed();
|
||||
|
||||
auto uponSelected = false;
|
||||
// if (_mouseActionItem) {
|
||||
// if (!_selected.isEmpty() && _selected.cbegin().value() == FullSelection) {
|
||||
// uponSelected = _selected.contains(_mouseActionItem);
|
||||
// } else {
|
||||
// HistoryStateRequest request;
|
||||
// request.flags |= Text::StateRequest::Flag::LookupSymbol;
|
||||
// auto dragState = _mouseActionItem->getState(_dragStartPosition.x(), _dragStartPosition.y(), request);
|
||||
// uponSelected = (dragState.cursor == HistoryInTextCursorState);
|
||||
// if (uponSelected) {
|
||||
// if (_selected.isEmpty() ||
|
||||
// _selected.cbegin().value() == FullSelection ||
|
||||
// _selected.cbegin().key() != _mouseActionItem
|
||||
// ) {
|
||||
// uponSelected = false;
|
||||
// } else {
|
||||
// quint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
// if (dragState.symbol < selFrom || dragState.symbol >= selTo) {
|
||||
// uponSelected = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// auto pressedHandler = ClickHandler::getPressed();
|
||||
if (dynamic_cast<VoiceSeekClickHandler *>(pressedHandler.data())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if (dynamic_cast<VoiceSeekClickHandler*>(pressedHandler.data())) {
|
||||
// return;
|
||||
//}
|
||||
TextWithEntities sel;
|
||||
QList<QUrl> urls;
|
||||
if (uponSelected) {
|
||||
sel = getSelectedText();
|
||||
} else if (pressedHandler) {
|
||||
sel = {pressedHandler->dragText(), EntitiesInText()};
|
||||
// if (!sel.isEmpty() && sel.at(0) != '/' && sel.at(0) != '@' && sel.at(0) != '#') {
|
||||
// urls.push_back(QUrl::fromEncoded(sel.toUtf8())); // Google Chrome crashes in Mac OS X O_o
|
||||
//}
|
||||
}
|
||||
if (auto mimeData = mimeDataFromTextWithEntities(sel)) {
|
||||
updateDragSelection(0, 0, false);
|
||||
_widget->noSelectingScroll();
|
||||
|
||||
// TextWithEntities sel;
|
||||
// QList<QUrl> urls;
|
||||
// if (uponSelected) {
|
||||
// sel = getSelectedText();
|
||||
//} else if (pressedHandler) {
|
||||
// sel = { pressedHandler->dragText(), EntitiesInText() };
|
||||
// //if (!sel.isEmpty() && sel.at(0) != '/' && sel.at(0) != '@' && sel.at(0) != '#') {
|
||||
// // urls.push_back(QUrl::fromEncoded(sel.toUtf8())); // Google Chrome crashes in Mac OS X O_o
|
||||
// //}
|
||||
//}
|
||||
// if (auto mimeData = mimeDataFromTextWithEntities(sel)) {
|
||||
// updateDragSelection(0, 0, false);
|
||||
// _widget->noSelectingScroll();
|
||||
if (!urls.isEmpty()) mimeData->setUrls(urls);
|
||||
if (uponSelected && !Adaptive::OneColumn()) {
|
||||
auto selectedState = getSelectionState();
|
||||
if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
|
||||
mimeData->setData(qsl("application/x-td-forward-selected"), "1");
|
||||
}
|
||||
}
|
||||
_controller->window()->launchDrag(std::move(mimeData));
|
||||
return;
|
||||
} else {
|
||||
auto forwardMimeType = QString();
|
||||
auto pressedMedia = static_cast<HistoryMedia *>(nullptr);
|
||||
if (auto pressedItem = App::pressedItem()) {
|
||||
pressedMedia = pressedItem->getMedia();
|
||||
if (_mouseCursorState == HistoryInDateCursorState || (pressedMedia && pressedMedia->dragItem())) {
|
||||
forwardMimeType = qsl("application/x-td-forward-pressed");
|
||||
}
|
||||
}
|
||||
if (auto pressedLnkItem = App::pressedLinkItem()) {
|
||||
if ((pressedMedia = pressedLnkItem->getMedia())) {
|
||||
if (forwardMimeType.isEmpty() && pressedMedia->dragItemByHandler(pressedHandler)) {
|
||||
forwardMimeType = qsl("application/x-td-forward-pressed-link");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!forwardMimeType.isEmpty()) {
|
||||
auto mimeData = std::make_unique<QMimeData>();
|
||||
mimeData->setData(forwardMimeType, "1");
|
||||
if (auto document = (pressedMedia ? pressedMedia->getDocument() : nullptr)) {
|
||||
auto filepath = document->filepath(DocumentData::FilePathResolveChecked);
|
||||
if (!filepath.isEmpty()) {
|
||||
QList<QUrl> urls;
|
||||
urls.push_back(QUrl::fromLocalFile(filepath));
|
||||
mimeData->setUrls(urls);
|
||||
}
|
||||
}
|
||||
|
||||
// if (!urls.isEmpty()) mimeData->setUrls(urls);
|
||||
// if (uponSelected && !Adaptive::OneColumn()) {
|
||||
// auto selectedState = getSelectionState();
|
||||
// if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
|
||||
// mimeData->setData(qsl("application/x-td-forward-selected"), "1");
|
||||
// }
|
||||
// }
|
||||
// _controller->window()->launchDrag(std::move(mimeData));
|
||||
// return;
|
||||
//} else {
|
||||
// auto forwardMimeType = QString();
|
||||
// auto pressedMedia = static_cast<HistoryMedia*>(nullptr);
|
||||
// if (auto pressedItem = App::pressedItem()) {
|
||||
// pressedMedia = pressedItem->getMedia();
|
||||
// if (_mouseCursorState == HistoryInDateCursorState || (pressedMedia && pressedMedia->dragItem())) {
|
||||
// forwardMimeType = qsl("application/x-td-forward-pressed");
|
||||
// }
|
||||
// }
|
||||
// if (auto pressedLnkItem = App::pressedLinkItem()) {
|
||||
// if ((pressedMedia = pressedLnkItem->getMedia())) {
|
||||
// if (forwardMimeType.isEmpty() && pressedMedia->dragItemByHandler(pressedHandler)) {
|
||||
// forwardMimeType = qsl("application/x-td-forward-pressed-link");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (!forwardMimeType.isEmpty()) {
|
||||
// auto mimeData = std::make_unique<QMimeData>();
|
||||
// mimeData->setData(forwardMimeType, "1");
|
||||
// if (auto document = (pressedMedia ? pressedMedia->getDocument() : nullptr)) {
|
||||
// auto filepath = document->filepath(DocumentData::FilePathResolveChecked);
|
||||
// if (!filepath.isEmpty()) {
|
||||
// QList<QUrl> urls;
|
||||
// urls.push_back(QUrl::fromLocalFile(filepath));
|
||||
// mimeData->setUrls(urls);
|
||||
// }
|
||||
// }
|
||||
|
||||
// // This call enters event loop and can destroy any QObject.
|
||||
// _controller->window()->launchDrag(std::move(mimeData));
|
||||
// return;
|
||||
// }
|
||||
//} // TODO
|
||||
// This call enters event loop and can destroy any QObject.
|
||||
_controller->window()->launchDrag(std::move(mimeData));
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
// TODO
|
||||
}
|
||||
|
||||
int InnerWidget::itemTop(not_null<const HistoryItem *> item) const {
|
||||
|
|
|
@ -1488,7 +1488,7 @@ void HistoryInner::savePhotoToFile(PhotoData *photo) {
|
|||
|
||||
auto filter = qsl("JPEG Image (*.jpg);;") + FileDialog::AllFilesFilter();
|
||||
FileDialog::GetWritePath(lang(lng_save_photo), filter, filedialogDefaultName(qsl("photo"), qsl(".jpg")),
|
||||
base::lambda_guarded(this, [this, photo](const QString &result) {
|
||||
base::lambda_guarded(this, [photo](const QString &result) {
|
||||
if (!result.isEmpty()) {
|
||||
photo->full->pix().toImage().save(result, "JPG");
|
||||
}
|
||||
|
|
|
@ -1013,8 +1013,7 @@ void HistoryVideo::eraseFromOverview() {
|
|||
}
|
||||
|
||||
void HistoryVideo::updateStatusText() const {
|
||||
bool showPause = false;
|
||||
qint32 statusSize = 0, realDuration = 0;
|
||||
qint32 statusSize = 0;
|
||||
if (_data->status == FileDownloadFailed || _data->status == FileUploadFailed) {
|
||||
statusSize = FileStatusSizeFailed;
|
||||
} else if (_data->status == FileUploading) {
|
||||
|
@ -1543,12 +1542,12 @@ HistoryTextState HistoryDocument::getState(QPoint point, HistoryStateRequest req
|
|||
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return result;
|
||||
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
bool out = _parent->out(), isPost = _parent->isPost();
|
||||
bool loaded = _data->loaded();
|
||||
|
||||
bool showPause = updateStatusText();
|
||||
|
||||
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0, bottom = 0;
|
||||
qint32 nameleft = 0, nametop = 0, nameright = 0, linktop = 0, bottom = 0;
|
||||
auto topMinus = isBubbleTop() ? 0 : st::msgFileTopMinus;
|
||||
if (auto thumbed = Get<HistoryDocumentThumbed>()) {
|
||||
nameleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right();
|
||||
|
@ -2603,8 +2602,7 @@ void HistoryGif::setStatusSize(qint32 newSize) const {
|
|||
}
|
||||
|
||||
void HistoryGif::updateStatusText() const {
|
||||
bool showPause = false;
|
||||
qint32 statusSize = 0, realDuration = 0;
|
||||
qint32 statusSize = 0;
|
||||
if (_data->status == FileDownloadFailed || _data->status == FileUploadFailed) {
|
||||
statusSize = FileStatusSizeFailed;
|
||||
} else if (_data->status == FileUploading) {
|
||||
|
@ -3140,7 +3138,7 @@ void HistoryContact::initDimensions() {
|
|||
|
||||
void HistoryContact::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 width = _width;
|
||||
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
bool selected = (selection == FullSelection);
|
||||
|
@ -3202,9 +3200,9 @@ void HistoryContact::draw(Painter &p, const QRect &r, TextSelection selection, T
|
|||
|
||||
HistoryTextState HistoryContact::getState(QPoint point, HistoryStateRequest request) const {
|
||||
HistoryTextState result;
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
bool out = _parent->out(), isPost = _parent->isPost();
|
||||
|
||||
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0;
|
||||
qint32 nameleft = 0, linktop = 0;
|
||||
auto topMinus = isBubbleTop() ? 0 : st::msgFileTopMinus;
|
||||
if (_userId) {
|
||||
nameleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right();
|
||||
|
@ -3311,7 +3309,7 @@ void HistoryCall::initDimensions() {
|
|||
|
||||
void HistoryCall::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
|
||||
auto skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
auto width = _width;
|
||||
|
||||
auto out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
auto selected = (selection == FullSelection);
|
||||
|
@ -3328,7 +3326,6 @@ void HistoryCall::draw(Painter &p, const QRect &r, TextSelection selection, Time
|
|||
nameright = st::msgFilePadding.left();
|
||||
statustop = st::historyCallStatusTop - topMinus;
|
||||
|
||||
auto namewidth = width - nameleft - nameright;
|
||||
|
||||
p.setFont(st::semiboldFont);
|
||||
p.setPen(outbg ? (selected ? st::historyFileNameOutFgSelected : st::historyFileNameOutFg) :
|
||||
|
@ -3674,7 +3671,7 @@ int HistoryWebPage::resizeGetHeight(int width) {
|
|||
|
||||
void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 width = _width;
|
||||
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
bool selected = (selection == FullSelection);
|
||||
|
@ -3821,7 +3818,7 @@ HistoryTextState HistoryWebPage::getState(QPoint point, HistoryStateRequest requ
|
|||
HistoryTextState result;
|
||||
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return result;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 width = _width;
|
||||
|
||||
QMargins bubble(_attach ? _attach->bubbleMargins() : QMargins());
|
||||
auto padding = inBubblePadding();
|
||||
|
@ -4678,7 +4675,7 @@ HistoryTextState HistoryInvoice::getState(QPoint point, HistoryStateRequest requ
|
|||
HistoryTextState result;
|
||||
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return result;
|
||||
qint32 width = _width, height = _height;
|
||||
qint32 width = _width;
|
||||
|
||||
QMargins bubble(_attach ? _attach->bubbleMargins() : QMargins());
|
||||
auto padding = inBubblePadding();
|
||||
|
|
|
@ -931,9 +931,10 @@ QPixmap MediaPreviewWidget::currentImage() const {
|
|||
if (_document->loaded()) {
|
||||
if (!_gif && !_gif.isBad()) {
|
||||
auto that = const_cast<MediaPreviewWidget *>(this);
|
||||
that->_gif = Media::Clip::MakeReader(
|
||||
_document, FullMsgId(),
|
||||
[this, that](Media::Clip::Notification notification) { that->clipCallback(notification); });
|
||||
that->_gif =
|
||||
Media::Clip::MakeReader(_document, FullMsgId(), [that](Media::Clip::Notification notification) {
|
||||
that->clipCallback(notification);
|
||||
});
|
||||
if (_gif) _gif->setAutoplay();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ void MainWidget::updateFloatPlayerColumnCorner(QPoint center) {
|
|||
auto right = rect.x() + rect.width() - (size.width() / 2);
|
||||
auto top = rect.y() + (size.height() / 2);
|
||||
auto bottom = rect.y() + rect.height() - (size.height() / 2);
|
||||
auto checkCorner = [this, playerColumn, &min, &column, &corner](int distance, RectPart checked) {
|
||||
auto checkCorner = [playerColumn, &min, &column, &corner](int distance, RectPart checked) {
|
||||
if (min > distance) {
|
||||
min = distance;
|
||||
column = playerColumn;
|
||||
|
@ -952,28 +952,28 @@ void MainWidget::cancelUploadLayer() {
|
|||
|
||||
void MainWidget::deletePhotoLayer(PhotoData *photo) {
|
||||
if (!photo) return;
|
||||
Ui::show(
|
||||
Box<ConfirmBox>(lang(lng_delete_photo_sure), lang(lng_box_delete), base::lambda_guarded(this, [this, photo] {
|
||||
Ui::hideLayer();
|
||||
Ui::show(Box<ConfirmBox>(lang(lng_delete_photo_sure), lang(lng_box_delete), base::lambda_guarded(this, [photo] {
|
||||
Ui::hideLayer();
|
||||
|
||||
auto me = App::self();
|
||||
if (!me) return;
|
||||
auto me = App::self();
|
||||
if (!me) return;
|
||||
|
||||
if (me->photoId == photo->id) {
|
||||
Messenger::Instance().peerClearPhoto(me->id);
|
||||
} else if (photo->peer && !photo->peer->isUser() && photo->peer->photoId == photo->id) {
|
||||
Messenger::Instance().peerClearPhoto(photo->peer->id);
|
||||
} else {
|
||||
for (int i = 0, l = me->photos.size(); i != l; ++i) {
|
||||
if (me->photos.at(i) == photo) {
|
||||
me->photos.removeAt(i);
|
||||
MTP::send(MTPphotos_DeletePhotos(MTP_vector<MTPInputPhoto>(
|
||||
1, MTP_inputPhoto(MTP_long(photo->id), MTP_long(photo->access)))));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
})));
|
||||
if (me->photoId == photo->id) {
|
||||
Messenger::Instance().peerClearPhoto(me->id);
|
||||
} else if (photo->peer && !photo->peer->isUser() &&
|
||||
photo->peer->photoId == photo->id) {
|
||||
Messenger::Instance().peerClearPhoto(photo->peer->id);
|
||||
} else {
|
||||
for (int i = 0, l = me->photos.size(); i != l; ++i) {
|
||||
if (me->photos.at(i) == photo) {
|
||||
me->photos.removeAt(i);
|
||||
MTP::send(MTPphotos_DeletePhotos(MTP_vector<MTPInputPhoto>(
|
||||
1, MTP_inputPhoto(MTP_long(photo->id), MTP_long(photo->access)))));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
})));
|
||||
}
|
||||
|
||||
void MainWidget::shareContactLayer(UserData *contact) {
|
||||
|
@ -1357,7 +1357,6 @@ void MainWidget::onCacheBackground() {
|
|||
result.setDevicePixelRatio(cRetinaFactor());
|
||||
{
|
||||
QPainter p(&result);
|
||||
auto bottom = _willCacheFor.height();
|
||||
auto w = bg.width() / cRetinaFactor();
|
||||
auto h = bg.height() / cRetinaFactor();
|
||||
auto sx = 0;
|
||||
|
@ -1652,7 +1651,6 @@ void MainWidget::itemEdited(HistoryItem *item) {
|
|||
bool MainWidget::overviewFailed(PeerData *peer, const RPCError &error, mtpRequestId req) {
|
||||
if (MTP::isDefaultHandledError(error)) return false;
|
||||
|
||||
MediaOverviewType type = OverviewCount;
|
||||
for (qint32 i = 0; i < OverviewCount; ++i) {
|
||||
OverviewsPreload::iterator j = _overviewPreload[i].find(peer);
|
||||
if (j != _overviewPreload[i].end() && j.value() == req) {
|
||||
|
@ -1985,14 +1983,14 @@ void MainWidget::documentLoadFailed(FileLoader *loader, bool started) {
|
|||
auto document = App::document(documentId);
|
||||
if (started) {
|
||||
auto failedFileName = loader->fileName();
|
||||
Ui::show(Box<ConfirmBox>(lang(lng_download_finish_failed),
|
||||
base::lambda_guarded(this, [this, document, failedFileName] {
|
||||
Ui::hideLayer();
|
||||
if (document) document->save(failedFileName);
|
||||
})));
|
||||
Ui::show(
|
||||
Box<ConfirmBox>(lang(lng_download_finish_failed), base::lambda_guarded(this, [document, failedFileName] {
|
||||
Ui::hideLayer();
|
||||
if (document) document->save(failedFileName);
|
||||
})));
|
||||
} else {
|
||||
Ui::show(Box<ConfirmBox>(lang(lng_download_path_failed), lang(lng_download_path_settings),
|
||||
base::lambda_guarded(this, [this] {
|
||||
base::lambda_guarded(this, [] {
|
||||
Global::SetDownloadPath(QString());
|
||||
Global::SetDownloadPathBookmark(QByteArray());
|
||||
Ui::show(Box<DownloadPathBox>());
|
||||
|
|
|
@ -171,7 +171,7 @@ void MediaView::refreshLang() {
|
|||
}
|
||||
|
||||
void MediaView::moveToScreen() {
|
||||
auto widgetScreen = [this](auto &&widget) -> QScreen * {
|
||||
auto widgetScreen = [](auto &&widget) -> QScreen * {
|
||||
if (auto handle = widget ? widget->windowHandle() : nullptr) {
|
||||
return handle->screen();
|
||||
}
|
||||
|
@ -2127,7 +2127,7 @@ void MediaView::paintThemePreview(Painter &p, QRect clip) {
|
|||
}
|
||||
}
|
||||
|
||||
auto fillOverlay = [this, &p, clip](QRect fill) {
|
||||
auto fillOverlay = [&p, clip](QRect fill) {
|
||||
auto clipped = fill.intersected(clip);
|
||||
if (!clipped.isEmpty()) {
|
||||
p.setOpacity(st::themePreviewOverlayOpacity);
|
||||
|
|
|
@ -2151,7 +2151,7 @@ ConnectionPrivate::HandleResult ConnectionPrivate::handleOneReceived(const mtpPr
|
|||
mtpBuffer ConnectionPrivate::ungzip(const mtpPrime *from, const mtpPrime *end) const {
|
||||
MTPstring packed;
|
||||
packed.read(from, end); // read packed string as serialized mtp string type
|
||||
quint32 packedLen = packed.v.size(), unpackedChunk = packedLen, unpackedLen = 0;
|
||||
quint32 packedLen = packed.v.size(), unpackedChunk = packedLen;
|
||||
|
||||
mtpBuffer result; // * 4 because of mtpPrime type
|
||||
result.resize(0);
|
||||
|
|
|
@ -488,7 +488,6 @@ void Video::getState(ClickHandlerPtr &link, HistoryCursorState &cursor, QPoint p
|
|||
}
|
||||
|
||||
void Video::updateStatusText() {
|
||||
bool showPause = false;
|
||||
int statusSize = 0;
|
||||
if (_data->status == FileDownloadFailed || _data->status == FileUploadFailed) {
|
||||
statusSize = FileStatusSizeFailed;
|
||||
|
|
|
@ -1910,7 +1910,6 @@ void OverviewInner::repaintItem(const HistoryItem *msg) {
|
|||
int OverviewInner::countHeight() {
|
||||
if (_type == OverviewPhotos || _type == OverviewVideos) {
|
||||
auto count = _items.size();
|
||||
auto migratedFullCount = _migrated ? _migrated->overviewCount(_type) : 0;
|
||||
auto rows = (count / _photosInRow) + ((count % _photosInRow) ? 1 : 0);
|
||||
return (_rowWidth + st::overviewPhotoSkip) * rows + st::overviewPhotoSkip;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ void ChannelMembersWidget::refreshVisibility() {
|
|||
int ChannelMembersWidget::resizeGetHeight(int newWidth) {
|
||||
int newHeight = contentTop();
|
||||
|
||||
auto resizeButton = [this, &newHeight, newWidth](object_ptr<Ui::LeftOutlineButton> &button) {
|
||||
auto resizeButton = [&newHeight, newWidth](object_ptr<Ui::LeftOutlineButton> &button) {
|
||||
if (!button) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ GroupMembersWidget::GroupMembersWidget(QWidget *parent, PeerData *peer, TitleVis
|
|||
[this](const Notify::PeerUpdate &update) { notifyPeerUpdated(update); }));
|
||||
|
||||
setRemovedCallback([this, peer](PeerData *selectedPeer) { removePeer(selectedPeer); });
|
||||
setSelectedCallback([this](PeerData *selectedPeer) { Ui::showPeerProfile(selectedPeer); });
|
||||
setSelectedCallback([](PeerData *selectedPeer) { Ui::showPeerProfile(selectedPeer); });
|
||||
setUpdateItemCallback([this](Item *item) { updateItemStatusText(item); });
|
||||
setPreloadMoreCallback([this] { preloadMore(); });
|
||||
|
||||
|
|
|
@ -79,7 +79,6 @@ int InfoWidget::resizeGetHeight(int newWidth) {
|
|||
if (_about) {
|
||||
int textWidth = _about->naturalWidth();
|
||||
int availableWidth = newWidth - left - st::profileBlockMarginRight;
|
||||
int maxWidth = st::msgMaxWidth;
|
||||
accumulate_min(textWidth, availableWidth);
|
||||
accumulate_min(textWidth, st::msgMaxWidth);
|
||||
_about->resizeToWidth(textWidth + marginLeft + marginRight);
|
||||
|
|
|
@ -68,7 +68,6 @@ int InviteLinkWidget::resizeGetHeight(int newWidth) {
|
|||
if (_link) {
|
||||
int textWidth = _link->naturalWidth();
|
||||
int availableWidth = newWidth - left - st::profileBlockMarginRight;
|
||||
int maxWidth = st::msgMaxWidth;
|
||||
accumulate_min(textWidth, availableWidth);
|
||||
accumulate_min(textWidth, st::msgMaxWidth);
|
||||
_link->resizeToWidth(textWidth + marginLeft + marginRight);
|
||||
|
|
|
@ -63,7 +63,6 @@ void FixedBar::onBack() {
|
|||
int FixedBar::resizeGetHeight(int newWidth) {
|
||||
auto newHeight = 0;
|
||||
|
||||
auto buttonLeft = newWidth;
|
||||
_backButton->resizeToWidth(newWidth);
|
||||
_backButton->moveToLeft(0, 0);
|
||||
newHeight += _backButton->height();
|
||||
|
@ -263,7 +262,6 @@ void InnerWidget::keyPressEvent(QKeyEvent *e) {
|
|||
|
||||
void InnerWidget::updateSelected(QPoint localPos) {
|
||||
auto selected = -1;
|
||||
auto selectedKick = false;
|
||||
|
||||
if (rtl()) localPos.setX(width() - localPos.x());
|
||||
if (localPos.x() >= _contentLeft && localPos.x() < _contentLeft + _contentWidth && localPos.y() >= _contentTop) {
|
||||
|
|
|
@ -43,7 +43,6 @@ int BlockWidget::resizeGetHeight(int newWidth) {
|
|||
int x = contentLeft(), result = contentTop();
|
||||
int availw = newWidth - x;
|
||||
for_const (auto &row, _rows) {
|
||||
auto childMargins = row.child->getMargins();
|
||||
row.child->moveToLeft(x + row.margin.left(), result + row.margin.top(), newWidth);
|
||||
auto availRowWidth = availw - row.margin.left() - row.margin.right() - x;
|
||||
auto natural = row.child->naturalWidth();
|
||||
|
|
|
@ -221,7 +221,7 @@ void PrivacyWidget::autoLockUpdated() {
|
|||
void PrivacyWidget::onBlockedUsers() {
|
||||
Ui::show(Box<PeerListBox>(std::make_unique<BlockedBoxController>(), [](not_null<PeerListBox *> box) {
|
||||
box->addButton(langFactory(lng_close), [box] { box->closeBox(); });
|
||||
box->addLeftButton(langFactory(lng_blocked_list_add), [box] { BlockedBoxController::BlockNewUser(); });
|
||||
box->addLeftButton(langFactory(lng_blocked_list_add), [] { BlockedBoxController::BlockNewUser(); });
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -421,7 +421,6 @@ void PanelAnimation::paintFrame(QPainter &p, int x, int y, int outerWidth, doubl
|
|||
if (fadeTop != fadeBottom) {
|
||||
auto painterFadeTop = fadeTop / cIntRetinaFactor();
|
||||
auto painterFrameWidth = frameWidth / cIntRetinaFactor();
|
||||
auto painterFrameHeight = frameHeight / cIntRetinaFactor();
|
||||
p.drawPixmap(painterFrameLeft, painterFadeTop, painterFrameWidth, painterFadeBottom - painterFadeTop,
|
||||
_fadeMask, 0, fadeSkipLines, cIntRetinaFactor(), fadeBottom - fadeTop);
|
||||
}
|
||||
|
@ -430,8 +429,6 @@ void PanelAnimation::paintFrame(QPainter &p, int x, int y, int outerWidth, doubl
|
|||
}
|
||||
}
|
||||
}
|
||||
auto frameInts = _frameInts + frameLeft + frameTop * _frameIntsPerLine;
|
||||
auto frameIntsPerLineAdd = (_finalWidth - frameWidth) + _frameIntsPerLineAdded;
|
||||
|
||||
// Draw corners
|
||||
paintCorner(_topLeft, frameLeft, frameTop);
|
||||
|
|
|
@ -230,8 +230,7 @@ void prepareRound(QImage &image, QImage *cornerMasks, ImageRoundCorners corners)
|
|||
auto intsTopRight = ints + imageWidth - cornerWidth;
|
||||
auto intsBottomLeft = ints + (imageHeight - cornerHeight) * imageWidth;
|
||||
auto intsBottomRight = ints + (imageHeight - cornerHeight + 1) * imageWidth - cornerWidth;
|
||||
auto maskCorner = [imageWidth, imageHeight, imageIntsPerPixel, imageIntsPerLine](quint32 *imageInts,
|
||||
const QImage &mask) {
|
||||
auto maskCorner = [imageIntsPerPixel, imageIntsPerLine](quint32 *imageInts, const QImage &mask) {
|
||||
auto maskWidth = mask.width();
|
||||
auto maskHeight = mask.height();
|
||||
auto maskBytesPerPixel = (mask.depth() >> 3);
|
||||
|
|
|
@ -237,7 +237,7 @@ void SendButton::paintEvent(QPaintEvent *e) {
|
|||
paintRipple(p, (width() - st::historyAttachEmoji.rippleAreaSize) / 2,
|
||||
st::historyAttachEmoji.rippleAreaPosition.y(), ms, &rippleColor);
|
||||
|
||||
auto fastIcon = [recordActive, over, this] {
|
||||
auto fastIcon = [recordActive, over] {
|
||||
if (recordActive == 1.) {
|
||||
return &st::historyRecordVoiceActive;
|
||||
} else if (over) {
|
||||
|
|
|
@ -2500,7 +2500,7 @@ void Text::recountNaturalSize(bool initial, Qt::LayoutDirection optionsDir) {
|
|||
|
||||
_maxWidth = _minHeight = 0;
|
||||
qint32 lineHeight = 0;
|
||||
qint32 result = 0, lastNewlineStart = 0;
|
||||
qint32 lastNewlineStart = 0;
|
||||
QFixed _width = 0, last_rBearing = 0, last_rPadding = 0;
|
||||
for (auto i = _blocks.cbegin(), e = _blocks.cend(); i != e; ++i) {
|
||||
auto b = i->get();
|
||||
|
|
|
@ -304,7 +304,7 @@ void System::showNext() {
|
|||
notifyItem->Has<HistoryMessageForwarded>() ? notifyItem : nullptr; // forwarded notify grouping
|
||||
auto forwardedCount = 1;
|
||||
|
||||
auto ms = getms(true);
|
||||
auto ms = getms(true); // TODO(Randl): should it be asignment and not declaration?
|
||||
auto history = notifyItem->history();
|
||||
auto j = _whenMaps.find(history);
|
||||
if (j == _whenMaps.cend()) {
|
||||
|
|
|
@ -226,7 +226,6 @@ void Manager::moveWidgets() {
|
|||
}
|
||||
|
||||
if (count > 1 || !_queuedNotifications.empty()) {
|
||||
auto deltaY = st::notifyHideAllHeight + st::notifyDeltaY;
|
||||
if (!_hideAll) {
|
||||
_hideAll = std::make_unique<HideAllButton>(this, notificationStartPosition(), lastShiftCurrent,
|
||||
notificationShiftDirection());
|
||||
|
@ -596,7 +595,6 @@ void Notification::paintEvent(QPaintEvent *e) {
|
|||
p.setClipRect(e->rect());
|
||||
p.drawPixmap(0, 0, _cache);
|
||||
|
||||
auto buttonsLeft = st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft;
|
||||
auto buttonsTop = st::notifyTextTop + st::msgNameFont->height;
|
||||
if (a_actionsOpacity.animating(getms())) {
|
||||
p.setOpacity(a_actionsOpacity.current());
|
||||
|
|
|
@ -149,7 +149,7 @@ void EditorBlock::Row::fillValueString() {
|
|||
_valueString.append('a' + (code - 10));
|
||||
}
|
||||
};
|
||||
auto addCode = [this, addHex](int code) {
|
||||
auto addCode = [addHex](int code) {
|
||||
addHex(code / 16);
|
||||
addHex(code % 16);
|
||||
};
|
||||
|
@ -468,7 +468,7 @@ template <typename Callback> void EditorBlock::enumerateRowsFrom(int top, Callba
|
|||
int EditorBlock::resizeGetHeight(int newWidth) {
|
||||
auto result = 0;
|
||||
auto descriptionWidth = newWidth - st::themeEditorMargin.left() - st::themeEditorMargin.right();
|
||||
enumerateRows([this, &result, descriptionWidth](Row &row) {
|
||||
enumerateRows([&result, descriptionWidth](Row &row) {
|
||||
row.setTop(result);
|
||||
|
||||
auto height = row.height();
|
||||
|
|
|
@ -827,13 +827,10 @@ void Generator::paintBubble(const Bubble &bubble) {
|
|||
auto icon = ([&bubble] { return &(bubble.outbg ? st::historyFileOutPlay : st::historyFileInPlay); })();
|
||||
(*icon)[_palette].paintInCenter(*_p, inner);
|
||||
|
||||
auto namewidth = x + bubble.width - nameleft - nameright;
|
||||
|
||||
// rescale waveform by going in waveform.size * bar_count 1D grid
|
||||
auto active = bubble.outbg ? st::msgWaveformOutActive[_palette] : st::msgWaveformInActive[_palette];
|
||||
auto inactive = bubble.outbg ? st::msgWaveformOutInactive[_palette] : st::msgWaveformInInactive[_palette];
|
||||
qint32 wf_size = bubble.waveform.size();
|
||||
qint32 bar_count = wf_size;
|
||||
qint32 max_delta = st::msgWaveformMax - st::msgWaveformMin;
|
||||
auto wave_bottom = y + st::msgFilePadding.top() + st::msgWaveformMax;
|
||||
_p->setPen(Qt::NoPen);
|
||||
|
|
|
@ -69,23 +69,15 @@ Controller::ColumnLayout Controller::computeColumnLayout() const {
|
|||
accumulate_max(chatWidth, st::windowMinWidth);
|
||||
dialogsWidth = bodyWidth - chatWidth;
|
||||
|
||||
auto useOneColumnLayout = [this, bodyWidth, dialogsWidth] {
|
||||
auto useOneColumnLayout = [bodyWidth, dialogsWidth] {
|
||||
auto someSectionShown = !App::main()->selectingPeer() && App::main()->isSectionShown();
|
||||
if (dialogsWidth < st::dialogsPadding.x() && (Adaptive::OneColumn() || someSectionShown)) {
|
||||
return true;
|
||||
}
|
||||
if (bodyWidth < st::windowMinWidth + st::dialogsWidthMin) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return (dialogsWidth < st::dialogsPadding.x() && (Adaptive::OneColumn() || someSectionShown)) ||
|
||||
(bodyWidth < st::windowMinWidth + st::dialogsWidthMin);
|
||||
};
|
||||
|
||||
auto useSmallColumnLayout = [this, dialogsWidth] {
|
||||
auto useSmallColumnLayout = [dialogsWidth] {
|
||||
// Used if useOneColumnLayout() == false.
|
||||
if (dialogsWidth < st::dialogsWidthMin / 2) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return dialogsWidth < st::dialogsWidthMin / 2;
|
||||
};
|
||||
|
||||
if (useOneColumnLayout()) {
|
||||
|
@ -177,8 +169,7 @@ void Controller::showJumpToDate(not_null<PeerData *> peer, QDate requestedDate)
|
|||
};
|
||||
auto highlighted = requestedDate.isNull() ? currentPeerDate() : requestedDate;
|
||||
auto month = highlighted;
|
||||
auto box =
|
||||
Box<CalendarBox>(month, highlighted, [this, peer](const QDate &date) { Auth().api().jumpToDate(peer, date); });
|
||||
auto box = Box<CalendarBox>(month, highlighted, [peer](const QDate &date) { Auth().api().jumpToDate(peer, date); });
|
||||
box->setMinDate(minPeerDate());
|
||||
box->setMaxDate(maxPeerDate());
|
||||
Ui::show(std::move(box));
|
||||
|
|
|
@ -72,7 +72,6 @@ void SlideAnimation::setFinishedCallback(FinishedCallback &&callback) {
|
|||
}
|
||||
|
||||
void SlideAnimation::start() {
|
||||
auto delta = st::slideShift;
|
||||
auto fromLeft = (_direction == SlideDirection::FromLeft);
|
||||
if (fromLeft) std::swap(_cacheUnder, _cacheOver);
|
||||
_animation.start([this] { animationCallback(); }, fromLeft ? 1. : 0., fromLeft ? 0. : 1., st::slideDuration,
|
||||
|
|
Loading…
Reference in New Issue