mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 23:00:58 +00:00
fixed couple of crashes, webpage doc init, added tooltips to overview, fixed shared links empty url, langs updated for 0.8.55 stable version
This commit is contained in:
parent
25b6740f91
commit
b0c23fb875
@ -2441,7 +2441,7 @@ void HistoryVideo::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x
|
||||
}
|
||||
|
||||
int32 dateX = width - st::msgPadding.right() + st::msgDateDelta.x() - parent->timeWidth(true) + st::msgDateSpace;
|
||||
int32 dateY = _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->height;
|
||||
int32 dateY = height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->height;
|
||||
bool inDate = QRect(dateX, dateY, parent->timeWidth(true) - st::msgDateSpace, st::msgDateFont->height).contains(x, y);
|
||||
if (inDate) {
|
||||
state = HistoryInDateCursorState;
|
||||
@ -3886,31 +3886,18 @@ void HistoryContact::updateFrom(const MTPMessageMedia &media) {
|
||||
|
||||
HistoryWebPage::HistoryWebPage(WebPageData *data) : HistoryMedia()
|
||||
, data(data)
|
||||
, _openl(data->url.isEmpty() ? 0 : new TextLink(data->url))
|
||||
, _attachl((data->photo && data->type != WebPageVideo) ? static_cast<ITextLink*>(new PhotoLink(data->photo)) : static_cast<ITextLink*>(data->doc ? new DocumentOpenLink(data->doc) : 0))
|
||||
, _openl(0)
|
||||
, _attachl(0)
|
||||
, _asArticle(false)
|
||||
, _title(st::msgMinWidth - st::webPageLeft)
|
||||
, _description(st::msgMinWidth - st::webPageLeft)
|
||||
, _siteNameWidth(0)
|
||||
, _docSize(data->doc ? (data->doc->song() ? formatDurationAndSizeText(data->doc->song()->duration, data->doc->size) : formatSizeText(data->doc->size)) : QString())
|
||||
, _docName(data->doc ? documentName(data->doc) : QString())
|
||||
, _durationWidth(0)
|
||||
, _docNameWidth(data->doc ? (st::mediaFont->m.width(_docName.isEmpty() ? qsl("Document") : _docName)) : 0)
|
||||
, _docNameWidth(0)
|
||||
, _docThumbWidth(0)
|
||||
, _docDownloadDone(0)
|
||||
, _pixw(0), _pixh(0)
|
||||
{
|
||||
if (data->doc) {
|
||||
data->doc->thumb->load();
|
||||
|
||||
int32 tw = data->doc->thumb->width(), th = data->doc->thumb->height();
|
||||
if (data->doc->thumb->isNull() || !tw || !th) {
|
||||
_docThumbWidth = 0;
|
||||
} else if (tw > th) {
|
||||
_docThumbWidth = (tw * st::mediaThumbSize) / th;
|
||||
} else {
|
||||
_docThumbWidth = st::mediaThumbSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWebPage::initDimensions(const HistoryItem *parent) {
|
||||
@ -3924,6 +3911,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) {
|
||||
if (!_openl && !data->url.isEmpty()) _openl = TextLinkPtr(new TextLink(data->url));
|
||||
if (!_attachl && data->photo && data->type != WebPageVideo) _attachl = TextLinkPtr(new PhotoLink(data->photo));
|
||||
if (!_attachl && data->doc) _attachl = TextLinkPtr(new DocumentOpenLink(data->doc));
|
||||
|
||||
if (data->photo && data->type != WebPagePhoto && data->type != WebPageVideo) {
|
||||
if (data->type == WebPageProfile) {
|
||||
_asArticle = true;
|
||||
@ -3935,6 +3923,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) {
|
||||
} else {
|
||||
_asArticle = false;
|
||||
}
|
||||
|
||||
if (_asArticle) {
|
||||
w = st::webPagePhotoSize;
|
||||
_maxw = st::webPageLeft + st::webPagePhotoSize;
|
||||
@ -3962,6 +3951,22 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) {
|
||||
_minh = qMax(thumbh, int32(st::minPhotoSize));
|
||||
_minh += st::webPagePhotoSkip;
|
||||
} else if (data->doc) {
|
||||
if (!data->doc->thumb->isNull()) {
|
||||
data->doc->thumb->load();
|
||||
|
||||
int32 tw = data->doc->thumb->width(), th = data->doc->thumb->height();
|
||||
if (data->doc->thumb->isNull() || !tw || !th) {
|
||||
_docThumbWidth = 0;
|
||||
} else if (tw > th) {
|
||||
_docThumbWidth = (tw * st::mediaThumbSize) / th;
|
||||
} else {
|
||||
_docThumbWidth = st::mediaThumbSize;
|
||||
}
|
||||
}
|
||||
_docName = documentName(data->doc);
|
||||
_docSize = data->doc->song() ? formatDurationAndSizeText(data->doc->song()->duration, data->doc->size) : formatSizeText(data->doc->size);
|
||||
_docNameWidth = st::mediaFont->m.width(_docName.isEmpty() ? qsl("Document") : _docName);
|
||||
|
||||
if (parent == animated.msg) {
|
||||
_maxw = st::webPageLeft + (animated.w / cIntRetinaFactor()) + parent->timeWidth(true);
|
||||
_minh = animated.h / cIntRetinaFactor();
|
||||
|
@ -1181,7 +1181,7 @@ public:
|
||||
void unregItem(HistoryItem *item);
|
||||
|
||||
bool hasReplyPreview() const {
|
||||
return data->photo && !data->photo->thumb->isNull();
|
||||
return (data->photo && !data->photo->thumb->isNull()) || (data->doc && !data->doc->thumb->isNull());
|
||||
}
|
||||
ImagePtr replyPreview();
|
||||
|
||||
|
@ -1372,7 +1372,7 @@ void HistoryList::onUpdateSelected() {
|
||||
}
|
||||
}
|
||||
textlnkOver(lnk);
|
||||
QToolTip::showText(_dragPos, QString(), App::wnd());
|
||||
QToolTip::hideText();
|
||||
App::hoveredLinkItem((lnk && !lnkInDesc) ? item : 0);
|
||||
if (textlnkOver()) {
|
||||
if (App::hoveredLinkItem()) {
|
||||
@ -1386,7 +1386,7 @@ void HistoryList::onUpdateSelected() {
|
||||
linkTipTimer.start(1000);
|
||||
}
|
||||
if (_dragCursorState == HistoryInDateCursorState && cursorState != HistoryInDateCursorState) {
|
||||
QToolTip::showText(_dragPos, QString(), App::wnd());
|
||||
QToolTip::hideText();
|
||||
}
|
||||
|
||||
if (_dragAction == NoDrag) {
|
||||
@ -1549,11 +1549,14 @@ void HistoryList::applyDragSelection(SelectedItems *toItems) const {
|
||||
|
||||
void HistoryList::showLinkTip() {
|
||||
TextLinkPtr lnk = textlnkOver();
|
||||
int32 dd = QApplication::startDragDistance();
|
||||
QPoint dp(mapFromGlobal(_dragPos));
|
||||
QRect r(dp.x() - dd, dp.y() - dd, 2 * dd, 2 * dd);
|
||||
if (lnk && !lnk->fullDisplayed()) {
|
||||
QToolTip::showText(_dragPos, lnk->readable(), App::wnd());
|
||||
QToolTip::showText(_dragPos, lnk->readable(), this, r);
|
||||
} else if (_dragCursorState == HistoryInDateCursorState && _dragAction == NoDrag) {
|
||||
if (App::hoveredItem()) {
|
||||
QToolTip::showText(_dragPos, App::hoveredItem()->date.toString(QLocale::system().dateTimeFormat(QLocale::LongFormat)), App::wnd());
|
||||
QToolTip::showText(_dragPos, App::hoveredItem()->date.toString(QLocale::system().dateTimeFormat(QLocale::LongFormat)), this, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1882,7 +1885,10 @@ void BotKeyboard::showCommandTip() {
|
||||
if (_sel >= 0) {
|
||||
int row = (_sel / MatrixRowShift), col = _sel % MatrixRowShift;
|
||||
if (!_btns.at(row).at(col).full) {
|
||||
QToolTip::showText(_lastMousePos, _btns.at(row).at(col).cmd);
|
||||
int32 dd = QApplication::startDragDistance();
|
||||
QPoint dp(mapFromGlobal(_lastMousePos));
|
||||
QRect r(dp.x() - dd, dp.y() - dd, 2 * dd, 2 * dd);
|
||||
QToolTip::showText(_lastMousePos, _btns.at(row).at(col).cmd, this, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1908,7 +1914,7 @@ void BotKeyboard::updateSelected() {
|
||||
if (newSel >= 0) break;
|
||||
}
|
||||
if (newSel != _sel) {
|
||||
QToolTip::showText(_lastMousePos, QString(), App::wnd());
|
||||
QToolTip::hideText();
|
||||
if (newSel < 0) {
|
||||
setCursor(style::cur_default);
|
||||
} else if (_sel < 0) {
|
||||
@ -2721,19 +2727,17 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) {
|
||||
bool canShowNow = _history->isReadyFor(showAtMsgId, true);
|
||||
if (!canShowNow) {
|
||||
delayedShowAt(showAtMsgId);
|
||||
return;
|
||||
} else {
|
||||
clearDelayedShowAt();
|
||||
if (_replyReturn && _replyReturn->id == showAtMsgId) {
|
||||
calcNextReplyReturn();
|
||||
}
|
||||
|
||||
_showAtMsgId = showAtMsgId;
|
||||
_histInited = false;
|
||||
|
||||
historyLoaded();
|
||||
}
|
||||
|
||||
clearDelayedShowAt();
|
||||
if (_replyReturn && _replyReturn->id == showAtMsgId) {
|
||||
calcNextReplyReturn();
|
||||
}
|
||||
|
||||
_showAtMsgId = showAtMsgId;
|
||||
_histInited = false;
|
||||
|
||||
historyLoaded();
|
||||
|
||||
emit peerShown(_peer);
|
||||
App::main()->topBar()->update();
|
||||
update();
|
||||
|
@ -60,6 +60,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_weekday7_full" = "Sonntag";
|
||||
|
||||
"lng_month_day" = "{day}. {month}";
|
||||
"lng_month_day_year" = "{day} {month}, {year}";
|
||||
|
||||
"lng_cancel" = "Abbrechen";
|
||||
"lng_continue" = "Weiter";
|
||||
@ -117,6 +118,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
"lng_code_ph" = "Dein Code";
|
||||
"lng_code_desc" = "Wir haben dir einen Aktivierungscode gesendet.\nBitte Code hier eingeben.";
|
||||
"lng_code_telegram" = "Bitte den Code eingeben, den du in der\nzuvor benutzen [b]Telegram[/b]-App erhalten hast.";
|
||||
"lng_code_no_telegram" = "Code per SMS senden";
|
||||
"lng_code_call" = "Telegram ruft dich an in {minutes}:{seconds}";
|
||||
"lng_code_calling" = "Telegram ruft dich an..";
|
||||
"lng_code_called" = "Telegram ruft dich gerade an.";
|
||||
|
@ -60,6 +60,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_weekday7_full" = "domingo";
|
||||
|
||||
"lng_month_day" = "{day} de {month}";
|
||||
"lng_month_day_year" = "{day} de {month} de {year}";
|
||||
|
||||
"lng_cancel" = "Cancelar";
|
||||
"lng_continue" = "Continuar";
|
||||
@ -117,6 +118,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
"lng_code_ph" = "Tu código";
|
||||
"lng_code_desc" = "Hemos enviado un mensaje con un código de \nactivación a tu teléfono. Por favor, ponlo abajo.";
|
||||
"lng_code_telegram" = "Por favor, pon el código que acabas\nde recibir en tu otra aplicación de [b]Telegram[/b].";
|
||||
"lng_code_no_telegram" = "Enviar el código vía SMS";
|
||||
"lng_code_call" = "Telegram marcará tu número en {minutes}:{seconds}";
|
||||
"lng_code_calling" = "Solicitando una llamada de Telegram...";
|
||||
"lng_code_called" = "Telegram marcó tu número";
|
||||
|
@ -60,6 +60,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_weekday7_full" = "Domenica";
|
||||
|
||||
"lng_month_day" = "{day} {month}";
|
||||
"lng_month_day_year" = "{day} {month} {year}";
|
||||
|
||||
"lng_cancel" = "Annulla";
|
||||
"lng_continue" = "Continua";
|
||||
@ -117,6 +118,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
"lng_code_ph" = "Codice";
|
||||
"lng_code_desc" = "Abbiamo inviato un messaggio col codice\ndi attivazione al tuo telefono. Inseriscilo qui";
|
||||
"lng_code_telegram" = "Per favore inserisci il codice che hai\nappena ricevuto nell'altra app di [b]Telegram[/b].";
|
||||
"lng_code_no_telegram" = "Invia codice tramite SMS";
|
||||
"lng_code_call" = "Telegram ti chiamerà tra {minutes}:{seconds}";
|
||||
"lng_code_calling" = "Richiedendo una telefonata da Telegram..";
|
||||
"lng_code_called" = "Telegram ti ha chiamato";
|
||||
@ -199,7 +202,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_settings_auto_update" = "Aggiorna automaticamente";
|
||||
"lng_settings_current_version" = "Versione {version}";
|
||||
"lng_settings_check_now" = "Cerca aggiornamenti";
|
||||
"lng_settings_update_checking" = "Ricerca aggiornamenti..";
|
||||
"lng_settings_update_checking" = "Cerco aggiornamenti..";
|
||||
"lng_settings_latest_installed" = "L'ultima versione è installata";
|
||||
"lng_settings_downloading" = "Download aggiornamento {ready} / {total} MB..";
|
||||
"lng_settings_update_ready" = "La nuova versione è pronta";
|
||||
@ -643,7 +646,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
"lng_new_authorization" = "{name},\nAbbiamo rilevato un accesso al tuo account da un nuovo dispositivo il {day}, {date} alle {time}\n\nDispositivo: {device}\nPosizione: {location}\n\nSe non sei tu, puoi andare su Impostazioni – Mostra tutte le sessioni e terminare quella sessione.\n\nSe credi che qualcuno si sia collegato al tuo account contro il tuo volere, puoi attivare la verifica in due passaggi nelle Impostazioni. \n\nGrazie, \nIl Team di Telegram";
|
||||
|
||||
"lng_new_version_wrap" = "Telegram Desktop si è aggiornato alla versione {version}\n\n{changes}\n\nLa cronologia degli update è disponibile qui:\n{link}";
|
||||
"lng_new_version_wrap" = "Telegram Desktop si è aggiornato alla versione {version}\n\n{changes}\n\nLa cronologia degli aggiornamenti è disponibile qui:\n{link}";
|
||||
"lng_new_version_minor" = "— Bug fix e altri miglioramenti minori";
|
||||
"lng_new_version_text" = "— Includi chat silenziate nel badge nelle Impostazioni\n— Panoramica dei link condivisi e ricerca nei media condivisi\n— Anteprima quando invii una GIF o un file PDF.";
|
||||
|
||||
|
@ -60,6 +60,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_weekday7_full" = "일요일";
|
||||
|
||||
"lng_month_day" = "{month} {day}일";
|
||||
"lng_month_day_year" = "{month} {day}, {year}";
|
||||
|
||||
"lng_cancel" = "취소";
|
||||
"lng_continue" = "계속";
|
||||
@ -117,6 +118,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
"lng_code_ph" = "코드번호";
|
||||
"lng_code_desc" = "인증코드 메세지를 휴대폰으로 전송하였습니다.\n인증코드를 아래에 입력하여 주세요.";
|
||||
"lng_code_telegram" = "[b]텔레그램[/b] 앱으로 부터 방금 수신받은,\n코드를 입력해주세요.";
|
||||
"lng_code_no_telegram" = "코드를 SMS로 전송";
|
||||
"lng_code_call" = "텔레그램이 {minutes}:{seconds}후에는 전화를 겁니다.";
|
||||
"lng_code_calling" = "텔레그램으로부터 전화 요청을 하고 있습니다..";
|
||||
"lng_code_called" = "텔레그램이 회원님의 전화번호로 전화를 걸었습니다.";
|
||||
|
@ -60,6 +60,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_weekday7_full" = "zondag";
|
||||
|
||||
"lng_month_day" = "{day} {month}";
|
||||
"lng_month_day_year" = "{day} {month}, {year}";
|
||||
|
||||
"lng_cancel" = "Annuleren";
|
||||
"lng_continue" = "Doorgaan";
|
||||
@ -117,6 +118,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
"lng_code_ph" = "Je code";
|
||||
"lng_code_desc" = "We hebben een bericht met activatiecode\nverstuurd naar je nummer, geef deze hieronder in.";
|
||||
"lng_code_telegram" = "Voer de code in die je zojuist\nhebt ontvangen in je vorige [b]Telegram[/b]-app.";
|
||||
"lng_code_no_telegram" = "Verstuur code via SMS";
|
||||
"lng_code_call" = "Telegram belt je over {minutes}:{seconds}";
|
||||
"lng_code_calling" = "Oproepverzoek versturen naar Telegram";
|
||||
"lng_code_called" = "Telegram heeft je nummer gebeld";
|
||||
|
@ -60,6 +60,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
"lng_weekday7_full" = "Domingo";
|
||||
|
||||
"lng_month_day" = "{month} {day}";
|
||||
"lng_month_day_year" = "{day} {month}, {year}";
|
||||
|
||||
"lng_cancel" = "Cancelar";
|
||||
"lng_continue" = "Continuar";
|
||||
@ -117,6 +118,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
|
||||
"lng_code_ph" = "Código";
|
||||
"lng_code_desc" = "Enviamos uma SMS com um código de ativação\npara o seu telefone. Insira-o abaixo.";
|
||||
"lng_code_telegram" = "Por favor insira código recebido\nem seu aplicativo prévio do [b]Telegram[/b]";
|
||||
"lng_code_no_telegram" = "Enviar código via SMS";
|
||||
"lng_code_call" = "Telegram irá te ligar em {minutes}{seconds}";
|
||||
"lng_code_calling" = "Aguardando a ligação do Telegram..";
|
||||
"lng_code_called" = "Telegram ligou para o seu número";
|
||||
|
@ -2559,7 +2559,9 @@ void MainWidget::onPeerShown(PeerData *peer) {
|
||||
_topBar.hide();
|
||||
}
|
||||
resizeEvent(0);
|
||||
if (animating()) _topBar.hide();
|
||||
if (animating()) {
|
||||
_topBar.hide();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::searchInPeer(PeerData *peer) {
|
||||
|
@ -27,7 +27,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
#include "application.h"
|
||||
#include "gui/filedialog.h"
|
||||
|
||||
OverviewInner::CachedLink::CachedLink(HistoryItem *item) : text(st::msgMinWidth) {
|
||||
OverviewInner::CachedLink::CachedLink(HistoryItem *item) : titleWidth(0), page(0), pixw(0), pixh(0), text(st::msgMinWidth) {
|
||||
QString msgText;
|
||||
LinksInText msgLinks;
|
||||
item->getTextWithLinks(msgText, msgLinks);
|
||||
@ -71,24 +71,31 @@ OverviewInner::CachedLink::CachedLink(HistoryItem *item) : text(st::msgMinWidth)
|
||||
TextParseOptions opts = { TextParseMultiline, int32(st::linksMaxWidth), 3 * st::msgFont->height, Qt::LayoutDirectionAuto };
|
||||
text.setText(st::msgFont, msgText.mid(from, till - from), opts);
|
||||
}
|
||||
int32 tw = 0, th = 0;
|
||||
if (page && page->photo) {
|
||||
if (!page->photo->full->loaded()) page->photo->medium->load(false, false);
|
||||
|
||||
int32 tw = convertScale(page->photo->medium->width()), th = convertScale(page->photo->medium->height());
|
||||
if (tw > st::dlgPhotoSize) {
|
||||
if (th > tw) {
|
||||
th = th * st::dlgPhotoSize / tw;
|
||||
tw = st::dlgPhotoSize;
|
||||
} else if (th > st::dlgPhotoSize) {
|
||||
tw = tw * st::dlgPhotoSize / th;
|
||||
th = st::dlgPhotoSize;
|
||||
}
|
||||
}
|
||||
pixw = tw;
|
||||
pixh = th;
|
||||
if (pixw < 1) pixw = 1;
|
||||
if (pixh < 1) pixh = 1;
|
||||
tw = convertScale(page->photo->medium->width());
|
||||
th = convertScale(page->photo->medium->height());
|
||||
} else if (page && page->doc) {
|
||||
if (!page->doc->thumb->loaded()) page->doc->thumb->load(false, false);
|
||||
|
||||
tw = convertScale(page->doc->thumb->width());
|
||||
th = convertScale(page->doc->thumb->height());
|
||||
}
|
||||
if (tw > st::dlgPhotoSize) {
|
||||
if (th > tw) {
|
||||
th = th * st::dlgPhotoSize / tw;
|
||||
tw = st::dlgPhotoSize;
|
||||
} else if (th > st::dlgPhotoSize) {
|
||||
tw = tw * st::dlgPhotoSize / th;
|
||||
th = st::dlgPhotoSize;
|
||||
}
|
||||
}
|
||||
pixw = tw;
|
||||
pixh = th;
|
||||
if (pixw < 1) pixw = 1;
|
||||
if (pixh < 1) pixh = 1;
|
||||
|
||||
if (page) {
|
||||
title = page->title;
|
||||
@ -155,6 +162,7 @@ OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, const
|
||||
, _minHeight(0)
|
||||
, _addToY(0)
|
||||
, _cursor(style::cur_default)
|
||||
, _cursorState(HistoryDefaultCursorState)
|
||||
, _dragAction(NoDrag)
|
||||
, _dragItem(0), _selectedMsgId(0)
|
||||
, _dragItemIndex(-1)
|
||||
@ -181,6 +189,8 @@ OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, const
|
||||
|
||||
App::contextItem(0);
|
||||
|
||||
_linkTipTimer.setSingleShot(true);
|
||||
connect(&_linkTipTimer, SIGNAL(timeout()), this, SLOT(showLinkTip()));
|
||||
_touchSelectTimer.setSingleShot(true);
|
||||
connect(&_touchSelectTimer, SIGNAL(timeout()), this, SLOT(onTouchSelect()));
|
||||
|
||||
@ -348,13 +358,19 @@ OverviewInner::CachedLink *OverviewInner::cachedLink(HistoryItem *item) {
|
||||
return i.value();
|
||||
}
|
||||
|
||||
QString OverviewInner::urlByIndex(MsgId msgid, int32 index, int32 lnkIndex) const {
|
||||
QString OverviewInner::urlByIndex(MsgId msgid, int32 index, int32 lnkIndex, bool *fullShown) const {
|
||||
fixItemIndex(index, msgid);
|
||||
if (index < 0 || !_items[index].link) return QString();
|
||||
|
||||
if (lnkIndex < 0 && _items[index].link->page) {
|
||||
return _items[index].link->page->url;
|
||||
if (lnkIndex < 0) {
|
||||
if (fullShown) *fullShown = (_items[index].link->urls.size() == 1) && (_items[index].link->urls.at(0).width <= _linksWidth - (st::dlgPhotoSize + st::dlgPhotoPadding));
|
||||
if (_items[index].link->page) {
|
||||
return _items[index].link->page->url;
|
||||
} else if (!_items[index].link->urls.isEmpty()) {
|
||||
return _items[index].link->urls.at(0).url;
|
||||
}
|
||||
} else if (lnkIndex > 0 && lnkIndex <= _items[index].link->urls.size()) {
|
||||
if (fullShown) *fullShown = _items[index].link->urls.at(lnkIndex - 1).width <= _linksWidth - (st::dlgPhotoSize + st::dlgPhotoPadding);
|
||||
return _items[index].link->urls.at(lnkIndex - 1).url;
|
||||
}
|
||||
return QString();
|
||||
@ -1254,6 +1270,7 @@ void OverviewInner::onUpdateSelected() {
|
||||
HistoryItem *item = 0;
|
||||
int32 index = -1;
|
||||
int32 newsel = 0;
|
||||
HistoryCursorState cursorState = HistoryDefaultCursorState;
|
||||
if (_type == OverviewPhotos) {
|
||||
float64 w = (float64(_width - st::overviewPhotoSkip) / _photosInRow);
|
||||
int32 inRow = int32((m.x() - (st::overviewPhotoSkip / 2)) / w), vsize = (_vsize + st::overviewPhotoSkip);
|
||||
@ -1402,7 +1419,6 @@ void OverviewInner::onUpdateSelected() {
|
||||
}
|
||||
left += st::msgPhotoSkip;
|
||||
}
|
||||
HistoryCursorState cursorState = HistoryDefaultCursorState;
|
||||
TextLinkPtr link;
|
||||
media->getState(link, cursorState, m.x() - left, m.y() - y - st::msgMargin.top(), item, w);
|
||||
if (link) lnk = link;
|
||||
@ -1427,6 +1443,7 @@ void OverviewInner::onUpdateSelected() {
|
||||
textlnkOver(lnk);
|
||||
App::hoveredLinkItem(lnk ? item : 0);
|
||||
updateMsg(App::hoveredLinkItem());
|
||||
QToolTip::hideText();
|
||||
} else {
|
||||
App::mousedItem(item);
|
||||
}
|
||||
@ -1435,6 +1452,16 @@ void OverviewInner::onUpdateSelected() {
|
||||
if (oldMousedItem) updateMsg(App::histItemById(oldMousedItem));
|
||||
_lnkOverIndex = lnkIndex;
|
||||
if (item) updateMsg(item);
|
||||
QToolTip::hideText();
|
||||
}
|
||||
if (_cursorState == HistoryInDateCursorState && cursorState != HistoryInDateCursorState) {
|
||||
QToolTip::hideText();
|
||||
}
|
||||
if (cursorState != _cursorState) {
|
||||
_cursorState = cursorState;
|
||||
}
|
||||
if (lnk || lnkIndex || cursorState == HistoryInDateCursorState) {
|
||||
_linkTipTimer.start(1000);
|
||||
}
|
||||
|
||||
fixItemIndex(_dragItemIndex, _dragItem);
|
||||
@ -1580,6 +1607,27 @@ void OverviewInner::onUpdateSelected() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OverviewInner::showLinkTip() {
|
||||
TextLinkPtr lnk = textlnkOver();
|
||||
int32 dd = QApplication::startDragDistance();
|
||||
QPoint dp(mapFromGlobal(_dragPos));
|
||||
QRect r(dp.x() - dd, dp.y() - dd, 2 * dd, 2 * dd);
|
||||
if (lnk && !lnk->fullDisplayed()) {
|
||||
QToolTip::showText(_dragPos, lnk->readable(), this, r);
|
||||
} else if (_lnkOverIndex) {
|
||||
bool fullLink = false;
|
||||
QString url = urlByIndex(_mousedItem, _mousedItemIndex, _lnkOverIndex, &fullLink);
|
||||
if (!fullLink) {
|
||||
QToolTip::showText(_dragPos, url, this, r);
|
||||
}
|
||||
} else if (_cursorState == HistoryInDateCursorState && _dragAction == NoDrag && _mousedItem) {
|
||||
if (HistoryItem *item = App::histItemById(_mousedItem)) {
|
||||
QToolTip::showText(_dragPos, item->date.toString(QLocale::system().dateTimeFormat(QLocale::LongFormat)), this, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OverviewInner::updateDragSelection(MsgId dragSelFrom, int32 dragSelFromIndex, MsgId dragSelTo, int32 dragSelToIndex, bool dragSelecting) {
|
||||
if (_dragSelFrom != dragSelFrom || _dragSelFromIndex != dragSelFromIndex || _dragSelTo != dragSelTo || _dragSelToIndex != dragSelToIndex || _dragSelecting != dragSelecting) {
|
||||
_dragSelFrom = dragSelFrom;
|
||||
|
@ -78,6 +78,7 @@ public:
|
||||
public slots:
|
||||
|
||||
void onUpdateSelected();
|
||||
void showLinkTip();
|
||||
|
||||
void openContextUrl();
|
||||
void copyContextUrl();
|
||||
@ -211,8 +212,11 @@ private:
|
||||
|
||||
int32 _width, _height, _minHeight, _addToY;
|
||||
|
||||
QTimer _linkTipTimer;
|
||||
|
||||
// selection support, like in HistoryWidget
|
||||
Qt::CursorShape _cursor;
|
||||
HistoryCursorState _cursorState;
|
||||
typedef QMap<MsgId, uint32> SelectedItems;
|
||||
SelectedItems _selected;
|
||||
enum DragAction {
|
||||
@ -232,7 +236,7 @@ private:
|
||||
uint16 _dragSymbol;
|
||||
bool _dragWasInactive;
|
||||
|
||||
QString urlByIndex(MsgId msgid, int32 index, int32 lnkIndex) const;
|
||||
QString urlByIndex(MsgId msgid, int32 index, int32 lnkIndex, bool *fullShown = 0) const;
|
||||
bool urlIsEmail(const QString &url) const;
|
||||
|
||||
QString _contextMenuUrl;
|
||||
|
Loading…
Reference in New Issue
Block a user