mirror of
https://github.com/vale981/tdesktop
synced 2025-03-08 19:21:39 -05:00
captions for documents done
This commit is contained in:
parent
4c13b5dbee
commit
fb7a48ec19
4 changed files with 17 additions and 13 deletions
|
@ -156,11 +156,11 @@ void PhotoSendBox::onCaptionResized() {
|
||||||
|
|
||||||
void PhotoSendBox::updateBoxSize() {
|
void PhotoSendBox::updateBoxSize() {
|
||||||
if (_file && _file->type == PreparePhoto) {
|
if (_file && _file->type == PreparePhoto) {
|
||||||
setMaxHeight(st::boxPhotoPadding.top() + _thumbh + st::boxPhotoPadding.bottom() + st::boxPhotoCompressedPadding.top() + _compressed.height() + (_compressed.checked() ? (st::boxPhotoCompressedPadding.bottom() + _caption.height()) : 0) + st::boxButtonPadding.top() + _send.height() + st::boxButtonPadding.bottom());
|
setMaxHeight(st::boxPhotoPadding.top() + _thumbh + st::boxPhotoPadding.bottom() + st::boxPhotoCompressedPadding.top() + _compressed.height() + st::boxPhotoCompressedPadding.bottom() + _caption.height() + st::boxButtonPadding.top() + _send.height() + st::boxButtonPadding.bottom());
|
||||||
} else if (_thumbw) {
|
} else if (_thumbw) {
|
||||||
setMaxHeight(st::boxPhotoPadding.top() + st::msgFileThumbPadding.top() + st::msgFileThumbSize + st::msgFileThumbPadding.bottom() + st::boxPhotoPadding.bottom() + st::boxButtonPadding.top() + _send.height() + st::boxButtonPadding.bottom());
|
setMaxHeight(st::boxPhotoPadding.top() + st::msgFileThumbPadding.top() + st::msgFileThumbSize + st::msgFileThumbPadding.bottom() + (_file ? (st::boxPhotoCompressedPadding.bottom() + _caption.height()) : 0) + st::boxPhotoPadding.bottom() + st::boxButtonPadding.top() + _send.height() + st::boxButtonPadding.bottom());
|
||||||
} else {
|
} else {
|
||||||
setMaxHeight(st::boxPhotoPadding.top() + st::msgFilePadding.top() + st::msgFileSize + st::msgFilePadding.bottom() + st::boxPhotoPadding.bottom() + st::boxButtonPadding.top() + _send.height() + st::boxButtonPadding.bottom());
|
setMaxHeight(st::boxPhotoPadding.top() + st::msgFilePadding.top() + st::msgFileSize + st::msgFilePadding.bottom() + (_file ? (st::boxPhotoCompressedPadding.bottom() + _caption.height()) : 0) + st::boxPhotoPadding.bottom() + st::boxButtonPadding.top() + _send.height() + st::boxButtonPadding.bottom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,8 +264,10 @@ void PhotoSendBox::hideAll() {
|
||||||
void PhotoSendBox::showAll() {
|
void PhotoSendBox::showAll() {
|
||||||
_send.show();
|
_send.show();
|
||||||
_cancel.show();
|
_cancel.show();
|
||||||
if (_file && _file->type == PreparePhoto) {
|
if (_file) {
|
||||||
_compressed.show();
|
if (_file->type == PreparePhoto) {
|
||||||
|
_compressed.show();
|
||||||
|
}
|
||||||
_caption.show();
|
_caption.show();
|
||||||
} else {
|
} else {
|
||||||
_caption.hide();
|
_caption.hide();
|
||||||
|
|
|
@ -4272,7 +4272,7 @@ void HistoryDocument::getState(TextLinkPtr &lnk, HistoryCursorState &state, int3
|
||||||
if (!_caption.isEmpty()) {
|
if (!_caption.isEmpty()) {
|
||||||
if (y >= bottom) {
|
if (y >= bottom) {
|
||||||
bool inText = false;
|
bool inText = false;
|
||||||
_caption.getState(lnk, inText, st::msgPadding.left(), y - bottom, _width - st::msgPadding.left() - st::msgPadding.right());
|
_caption.getState(lnk, inText, x - st::msgPadding.left(), y - bottom, _width - st::msgPadding.left() - st::msgPadding.right());
|
||||||
state = inText ? HistoryInTextCursorState : HistoryDefaultCursorState;
|
state = inText ? HistoryInTextCursorState : HistoryDefaultCursorState;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4285,11 +4285,11 @@ void HistoryDocument::getState(TextLinkPtr &lnk, HistoryCursorState &state, int3
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString HistoryDocument::inDialogsText() const {
|
const QString HistoryDocument::inDialogsText() const {
|
||||||
return _name.isEmpty() ? lang(lng_in_dlg_file) : _name;
|
return (_name.isEmpty() ? lang(lng_in_dlg_file) : _name) + (_caption.isEmpty() ? QString() : (' ' + _caption.original(0, 0xFFFF, Text::ExpandLinksNone)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString HistoryDocument::inHistoryText() const {
|
const QString HistoryDocument::inHistoryText() const {
|
||||||
return qsl("[ ") + lang(lng_in_dlg_file) + (_name.isEmpty() ? QString() : (qsl(" : ") + _name)) + qsl(" ]");
|
return qsl("[ ") + lang(lng_in_dlg_file) + (_name.isEmpty() ? QString() : (qsl(" : ") + _name)) + (_caption.isEmpty() ? QString() : (qsl(", ") + _caption.original(0, 0xFFFF, Text::ExpandLinksAll))) + qsl(" ]");
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryDocument::setStatusSize(int32 newSize, qint64 realDuration) const {
|
void HistoryDocument::setStatusSize(int32 newSize, qint64 realDuration) const {
|
||||||
|
@ -4658,11 +4658,11 @@ void HistoryGif::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x,
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString HistoryGif::inDialogsText() const {
|
const QString HistoryGif::inDialogsText() const {
|
||||||
return qsl("GIF");
|
return qsl("GIF") + (_caption.isEmpty() ? QString() : (' ' + _caption.original(0, 0xFFFF, Text::ExpandLinksNone)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString HistoryGif::inHistoryText() const {
|
const QString HistoryGif::inHistoryText() const {
|
||||||
return qsl("[ GIF ]");
|
return qsl("[ GIF ") + (_caption.isEmpty() ? QString() : (_caption.original(0, 0xFFFF, Text::ExpandLinksAll) + ' ')) + qsl(" ]");
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryGif::setStatusSize(int32 newSize) const {
|
void HistoryGif::setStatusSize(int32 newSize) const {
|
||||||
|
|
|
@ -5500,7 +5500,8 @@ void HistoryWidget::onDocumentUploaded(const FullMsgId &newId, const MTPInputFil
|
||||||
if (fromChannelName) {
|
if (fromChannelName) {
|
||||||
sendFlags |= MTPmessages_SendMedia::flag_broadcast;
|
sendFlags |= MTPmessages_SendMedia::flag_broadcast;
|
||||||
}
|
}
|
||||||
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedDocument(file, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string("")), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId);
|
QString caption = item->getMedia() ? item->getMedia()->getCaption() : QString();
|
||||||
|
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedDocument(file, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5524,7 +5525,8 @@ void HistoryWidget::onThumbDocumentUploaded(const FullMsgId &newId, const MTPInp
|
||||||
if (fromChannelName) {
|
if (fromChannelName) {
|
||||||
sendFlags |= MTPmessages_SendMedia::flag_broadcast;
|
sendFlags |= MTPmessages_SendMedia::flag_broadcast;
|
||||||
}
|
}
|
||||||
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedThumbDocument(file, thumb, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string("")), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId);
|
QString caption = item->getMedia() ? item->getMedia()->getCaption() : QString();
|
||||||
|
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedThumbDocument(file, thumb, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,7 +368,7 @@ static const mtpTypeId mtpLayers[] = {
|
||||||
mtpTypeId(mtpc_invokeWithLayer18),
|
mtpTypeId(mtpc_invokeWithLayer18),
|
||||||
};
|
};
|
||||||
static const uint32 mtpLayerMaxSingle = sizeof(mtpLayers) / sizeof(mtpLayers[0]);
|
static const uint32 mtpLayerMaxSingle = sizeof(mtpLayers) / sizeof(mtpLayers[0]);
|
||||||
static const mtpPrime mtpCurrentLayer = 44;
|
static const mtpPrime mtpCurrentLayer = 45;
|
||||||
|
|
||||||
template <typename bareT>
|
template <typename bareT>
|
||||||
class MTPBoxed : public bareT {
|
class MTPBoxed : public bareT {
|
||||||
|
|
Loading…
Add table
Reference in a new issue