mirror of https://github.com/procxx/kepka.git
documents design improved
This commit is contained in:
parent
200073b826
commit
6d74140e39
|
@ -1090,7 +1090,7 @@ msgDateImgSelectBg: #1c4a7187;
|
|||
msgDateImgPadding: point(8px, 2px);
|
||||
msgDateImgCheckSpace: 4px;
|
||||
|
||||
msgDogImg: sprite(213px, 93px, 126px, 126px);
|
||||
msgDogImg: sprite(216px, 93px, 126px, 126px);
|
||||
historyPadding: 10px;
|
||||
|
||||
collapseButton: flatButton(btnDefFlat) {
|
||||
|
@ -1171,10 +1171,6 @@ mediaHeaderSkip: 5px;
|
|||
mediaThumbSize: 48px;
|
||||
mediaNameTop: 3px;
|
||||
mediaDetailsShift: 3px;
|
||||
mediaDocOutImg: sprite(6px, 146px, 48px, 48px);
|
||||
mediaDocInImg: sprite(56px, 146px, 48px, 48px);
|
||||
mediaAudioOutImg: sprite(106px, 146px, 48px, 48px);
|
||||
mediaAudioInImg: sprite(156px, 146px, 48px, 48px);
|
||||
mediaMusicOutImg: sprite(322px, 345px, 48px, 48px);
|
||||
mediaMusicInImg: sprite(322px, 395px, 48px, 48px);
|
||||
mediaPlayOutImg: sprite(122px, 341px, 48px, 48px);
|
||||
|
@ -1197,7 +1193,47 @@ msgFileSize: 44px;
|
|||
msgFilePadding: margins(14px, 12px, 10px, 12px);
|
||||
msgFileThumbSize: 72px;
|
||||
msgFileThumbPadding: margins(10px, 10px, 14px, 10px);
|
||||
msgFileThumbNameTop: 12px;
|
||||
msgFileThumbStatusTop: 32px;
|
||||
msgFileThumbLinkTop: 60px;
|
||||
msgFileThumbLinkInFg: #3da5e0;
|
||||
msgFileThumbLinkInFgSelected: #3da5e0;
|
||||
msgFileThumbLinkOutFg: #5eba5b;
|
||||
msgFileThumbLinkOutFgSelected: #31a298;
|
||||
msgFileNameTop: 16px;
|
||||
msgFileStatusTop: 37px;
|
||||
msgFileMinWidth: 294px;
|
||||
msgFileInBg: #59b6eb;
|
||||
msgFileInBgOver: #4eade3;
|
||||
msgFileInBgSelected: #51a3d3;
|
||||
msgFileOutBg: #78c67f;
|
||||
msgFileOutBgOver: #6bc272;
|
||||
msgFileOutBgSelected: #5fb389;
|
||||
|
||||
msgFileOutImage: sprite(0px, 146px, 18px, 18px);
|
||||
msgFileOutImageSelected: sprite(18px, 146px, 18px, 18px);
|
||||
msgFileInImage: sprite(0px, 164px, 18px, 18px);
|
||||
msgFileInImageSelected: sprite(18px, 164px, 18px, 18px);
|
||||
msgFileOutFile: sprite(36px, 146px, 18px, 18px);
|
||||
msgFileOutFileSelected: sprite(54px, 146px, 18px, 18px);
|
||||
msgFileInFile: sprite(36px, 164px, 18px, 18px);
|
||||
msgFileInFileSelected: sprite(54px, 164px, 18px, 18px);
|
||||
msgFileOutDownload: sprite(72px, 142px, 14px, 20px);
|
||||
msgFileOutDownloadSelected: sprite(86px, 142px, 14px, 20px);
|
||||
msgFileInDownload: sprite(72px, 162px, 14px, 20px);
|
||||
msgFileInDownloadSelected: sprite(86px, 162px, 14px, 20px);
|
||||
msgFileOutCancel: sprite(100px, 147px, 16px, 16px);
|
||||
msgFileOutCancelSelected: sprite(116px, 147px, 16px, 16px);
|
||||
msgFileInCancel: sprite(100px, 165px, 16px, 16px);
|
||||
msgFileInCancelSelected: sprite(116px, 165px, 16px, 16px);
|
||||
msgFileOutPause: sprite(132px, 147px, 14px, 16px);
|
||||
msgFileOutPauseSelected: sprite(146px, 147px, 14px, 16px);
|
||||
msgFileInPause: sprite(132px, 165px, 14px, 16px);
|
||||
msgFileInPauseSelected: sprite(146px, 165px, 14px, 16px);
|
||||
msgFileOutPlay: sprite(160px, 146px, 20px, 18px);
|
||||
msgFileOutPlaySelected: sprite(180px, 146px, 20px, 18px);
|
||||
msgFileInPlay: sprite(160px, 164px, 18px, 20px);
|
||||
msgFileInPlaySelected: sprite(180px, 164px, 20px, 18px);
|
||||
|
||||
sendPadding: 9px;
|
||||
btnSend: flatButton(btnDefFlat) {
|
||||
|
|
|
@ -1612,6 +1612,7 @@ namespace App {
|
|||
convert->thumb = thumb;
|
||||
convert->dc = dc;
|
||||
convert->size = size;
|
||||
convert->recountIsImage();
|
||||
} else {
|
||||
if (!thumb->isNull() && (convert->thumb->isNull() || convert->thumb->width() < thumb->width() || convert->thumb->height() < thumb->height())) {
|
||||
convert->thumb = thumb;
|
||||
|
@ -1644,6 +1645,7 @@ namespace App {
|
|||
result = convert;
|
||||
} else {
|
||||
result = new DocumentData(document, access, date, attributes, mime, thumb, dc, size);
|
||||
result->recountIsImage();
|
||||
if (result->sticker()) result->sticker()->loc = thumbLocation;
|
||||
}
|
||||
documentsData.insert(document, result);
|
||||
|
@ -1658,6 +1660,7 @@ namespace App {
|
|||
result->thumb = thumb;
|
||||
result->dc = dc;
|
||||
result->size = size;
|
||||
result->recountIsImage();
|
||||
} else {
|
||||
if (!thumb->isNull() && (result->thumb->isNull() || result->thumb->width() < thumb->width() || result->thumb->height() < thumb->height())) {
|
||||
result->thumb = thumb;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 178 KiB |
Binary file not shown.
Before Width: | Height: | Size: 240 KiB After Width: | Height: | Size: 240 KiB |
|
@ -205,7 +205,7 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
|
|||
int32 rf(cIntRetinaFactor());
|
||||
p.drawPixmap(QPoint(x + st::mediaPadding.left(), y + st::mediaPadding.top()), _thumb, QRect(_thumbx * rf, _thumby * rf, st::mediaThumbSize * rf, st::mediaThumbSize * rf));
|
||||
} else if (_file) {
|
||||
p.drawPixmap(QPoint(x + st::mediaPadding.left(), y + st::mediaPadding.top()), App::sprite(), st::mediaDocOutImg);
|
||||
p.drawPixmap(QPoint(x + st::mediaPadding.left(), y + st::mediaPadding.top()), App::sprite(), st::mediaMusicOutImg);
|
||||
} else {
|
||||
p.drawPixmap(x + st::mediaPadding.left(), y + st::mediaPadding.top(), userDefPhoto(1)->pix(st::mediaThumbSize));
|
||||
}
|
||||
|
|
|
@ -3156,6 +3156,7 @@ void HistoryPhoto::initDimensions(const HistoryItem *parent) {
|
|||
_maxw += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
_minh += st::mediaPadding.top() + st::mediaPadding.bottom();
|
||||
if (!_caption.isEmpty()) {
|
||||
_maxw = qMax(_maxw, st::msgPadding.left() + _caption.maxWidth() + st::msgPadding.right());
|
||||
_minh += st::mediaCaptionSkip + _caption.minHeight() + st::msgPadding.bottom();
|
||||
}
|
||||
}
|
||||
|
@ -3550,11 +3551,11 @@ void HistoryVideo::draw(Painter &p, const HistoryItem *parent, bool selected, in
|
|||
RoundCorners cors(selected ? (outbg ? MessageOutSelectedCorners : MessageInSelectedCorners) : (outbg ? MessageOutCorners : MessageInCorners));
|
||||
App::roundRect(p, 0, 0, width, height, bg, cors, &sh);
|
||||
|
||||
if (_thumbw) {
|
||||
p.drawPixmap(QPoint(st::mediaPadding.left(), skipy + st::mediaPadding.top()), data->thumb->pixSingle(_thumbw, 0, st::mediaThumbSize, st::mediaThumbSize));
|
||||
} else {
|
||||
p.drawPixmap(QPoint(st::mediaPadding.left(), skipy + st::mediaPadding.top()), App::sprite(), (outbg ? st::mediaDocOutImg : st::mediaDocInImg));
|
||||
}
|
||||
//if (_thumbw) {
|
||||
// p.drawPixmap(QPoint(st::mediaPadding.left(), skipy + st::mediaPadding.top()), data->thumb->pixSingle(_thumbw, 0, st::mediaThumbSize, st::mediaThumbSize));
|
||||
//} else {
|
||||
// p.drawPixmap(QPoint(st::mediaPadding.left(), skipy + st::mediaPadding.top()), App::sprite(), (outbg ? st::mediaDocOutImg : st::mediaDocInImg));
|
||||
//}
|
||||
if (selected) {
|
||||
App::roundRect(p, st::mediaPadding.left(), skipy + st::mediaPadding.top(), st::mediaThumbSize, st::mediaThumbSize, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
}
|
||||
|
@ -3692,14 +3693,14 @@ void HistoryAudio::draw(Painter &p, const HistoryItem *parent, bool selected, in
|
|||
QString statusText;
|
||||
if (data->status == FileUploadFailed || data->status == FileDownloadFailed) {
|
||||
statusText = lang(lng_attach_failed);
|
||||
img = outbg ? st::mediaAudioOutImg : st::mediaAudioInImg;
|
||||
// img = outbg ? st::mediaAudioOutImg : st::mediaAudioInImg;
|
||||
} else if (data->status == FileUploading) {
|
||||
if (_uplTextCache.isEmpty() || _uplDone != data->uploadOffset) {
|
||||
_uplDone = data->uploadOffset;
|
||||
_uplTextCache = formatDownloadText(_uplDone, data->size);
|
||||
}
|
||||
statusText = _uplTextCache;
|
||||
img = outbg ? st::mediaAudioOutImg : st::mediaAudioInImg;
|
||||
// img = outbg ? st::mediaAudioOutImg : st::mediaAudioInImg;
|
||||
} else if (already || hasdata) {
|
||||
bool showPause = false;
|
||||
if (playing.msgId == parent->fullId() && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) {
|
||||
|
@ -3708,7 +3709,7 @@ void HistoryAudio::draw(Painter &p, const HistoryItem *parent, bool selected, in
|
|||
} else {
|
||||
statusText = formatDurationText(data->duration);
|
||||
}
|
||||
img = outbg ? (showPause ? st::mediaPauseOutImg : st::mediaPlayOutImg) : (showPause ? st::mediaPauseInImg : st::mediaPlayInImg);
|
||||
// img = outbg ? (showPause ? st::mediaPauseOutImg : st::mediaPlayOutImg) : (showPause ? st::mediaPauseInImg : st::mediaPlayInImg);
|
||||
} else {
|
||||
if (data->loader) {
|
||||
int32 offset = data->loader->currentOffset();
|
||||
|
@ -3720,10 +3721,10 @@ void HistoryAudio::draw(Painter &p, const HistoryItem *parent, bool selected, in
|
|||
} else {
|
||||
statusText = _size;
|
||||
}
|
||||
img = outbg ? st::mediaAudioOutImg : st::mediaAudioInImg;
|
||||
// img = outbg ? st::mediaAudioOutImg : st::mediaAudioInImg;
|
||||
}
|
||||
|
||||
p.drawPixmap(QPoint(st::mediaPadding.left(), skipy + st::mediaPadding.top()), App::sprite(), img);
|
||||
//p.drawPixmap(QPoint(st::mediaPadding.left(), skipy + st::mediaPadding.top()), App::sprite(), img);
|
||||
if (selected) {
|
||||
App::roundRect(p, st::mediaPadding.left(), skipy + st::mediaPadding.top(), st::mediaThumbSize, st::mediaThumbSize, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
}
|
||||
|
@ -3850,7 +3851,7 @@ HistoryDocument::HistoryDocument(DocumentData *document) : HistoryMedia()
|
|||
if (_name.isEmpty()) _name = qsl("Unknown File");
|
||||
_namew = st::normalFont->width(_name);
|
||||
|
||||
setStatusSize(DocumentStatusSizeReady);
|
||||
setStatusSize(FileStatusSizeReady);
|
||||
|
||||
if (withThumb()) {
|
||||
_data->thumb->load();
|
||||
|
@ -3869,11 +3870,11 @@ HistoryDocument::HistoryDocument(DocumentData *document) : HistoryMedia()
|
|||
|
||||
void HistoryDocument::setStatusSize(int32 newSize, qint64 realDuration) const {
|
||||
_statusSize = newSize;
|
||||
if (_statusSize == DocumentStatusSizeReady) {
|
||||
if (_statusSize == FileStatusSizeReady) {
|
||||
_statusText = _data->song() ? formatDurationAndSizeText(_data->song()->duration, _data->size) : formatSizeText(_data->size);
|
||||
} else if (_statusSize == DocumentStatusSizeLoaded) {
|
||||
} else if (_statusSize == FileStatusSizeLoaded) {
|
||||
_statusText = _data->song() ? formatDurationText(_data->song()->duration) : formatSizeText(_data->size);
|
||||
} else if (_statusSize == DocumentStatusSizeFailed) {
|
||||
} else if (_statusSize == FileStatusSizeFailed) {
|
||||
_statusText = lang(lng_attach_failed);
|
||||
} else if (_statusSize >= 0) {
|
||||
_statusText = formatDownloadText(_statusSize, _data->size);
|
||||
|
@ -3886,7 +3887,7 @@ bool HistoryDocument::updateStatusText(const HistoryItem *parent) const {
|
|||
bool showPause = false;
|
||||
int32 statusSize = 0, realDuration = 0;
|
||||
if (_data->status == FileDownloadFailed || _data->status == FileUploadFailed) {
|
||||
statusSize = DocumentStatusSizeFailed;
|
||||
statusSize = FileStatusSizeFailed;
|
||||
} else if (_data->status == FileUploading) {
|
||||
statusSize = _data->uploadOffset;
|
||||
} else if (_data->loader) {
|
||||
|
@ -3905,13 +3906,15 @@ bool HistoryDocument::updateStatusText(const HistoryItem *parent) const {
|
|||
realDuration = playingDuration / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency);
|
||||
showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting);
|
||||
} else {
|
||||
statusSize = DocumentStatusSizeLoaded;
|
||||
statusSize = FileStatusSizeLoaded;
|
||||
}
|
||||
if (!showPause && playing.msgId == parent->fullId() && App::main() && App::main()->player()->seekingSong(playing)) {
|
||||
showPause = true;
|
||||
}
|
||||
} else if (!_data->already().isEmpty() || !_data->data.isEmpty()) {
|
||||
statusSize = FileStatusSizeLoaded;
|
||||
} else {
|
||||
statusSize = DocumentStatusSizeReady;
|
||||
statusSize = FileStatusSizeReady;
|
||||
}
|
||||
if (statusSize != _statusSize) {
|
||||
setStatusSize(statusSize, realDuration);
|
||||
|
@ -3942,44 +3945,109 @@ void HistoryDocument::draw(Painter &p, const HistoryItem *parent, bool selected,
|
|||
if (width < 0) width = w;
|
||||
if (width < 1) return;
|
||||
|
||||
bool out = parent->out(), fromChannel = parent->fromChannel(), outbg = out && !fromChannel, hovered, pressed;
|
||||
bool out = parent->out(), fromChannel = parent->fromChannel(), outbg = out && !fromChannel;
|
||||
bool already = !_data->already().isEmpty(), hasdata = !_data->data.isEmpty();
|
||||
|
||||
if (width >= _maxw) {
|
||||
width = _maxw;
|
||||
}
|
||||
|
||||
style::color bg(selected ? (outbg ? st::msgOutSelectBg : st::msgInSelectBg) : (outbg ? st::msgOutBg : st::msgInBg));
|
||||
style::color sh(selected ? (outbg ? st::msgOutSelectShadow : st::msgInSelectShadow) : (outbg ? st::msgOutShadow : st::msgInShadow));
|
||||
RoundCorners cors(selected ? (outbg ? MessageOutSelectedCorners : MessageInSelectedCorners) : (outbg ? MessageOutCorners : MessageInCorners));
|
||||
App::roundRect(p, 0, 0, width, _height, bg, cors, &sh);
|
||||
|
||||
bool showPause = updateStatusText(parent);
|
||||
|
||||
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
||||
int32 twidth = width - tleft - st::mediaPadding.right();
|
||||
int32 secondwidth = width - tleft - st::msgPadding.right() - parent->skipBlockWidth();
|
||||
int32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0;
|
||||
bool wthumb = withThumb();
|
||||
if (wthumb) {
|
||||
nameleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right();
|
||||
nametop = st::msgFileThumbNameTop;
|
||||
nameright = st::msgFileThumbPadding.left();
|
||||
statustop = st::msgFileThumbStatusTop;
|
||||
linktop = st::msgFileThumbLinkTop;
|
||||
|
||||
p.setFont(st::normalFont->f);
|
||||
p.setPen(st::black->c);
|
||||
if (twidth < _namew) {
|
||||
p.drawText(tleft, st::mediaPadding.top() + st::mediaNameTop + st::normalFont->ascent, st::normalFont->elided(_name, twidth));
|
||||
QRect rthumb(rtlrect(st::msgFileThumbPadding.left(), st::msgFileThumbPadding.top(), st::msgFileThumbSize, st::msgFileThumbSize, width));
|
||||
if (_data->thumb->loaded()) {
|
||||
QPixmap thumb = (already || hasdata) ? _data->thumb->pixSingle(_thumbw, 0, st::msgFileThumbSize, st::msgFileThumbSize) : _data->thumb->pixBlurredSingle(_thumbw, 0, st::msgFileThumbSize, st::msgFileThumbSize);
|
||||
p.drawPixmap(rthumb.topLeft(), thumb);
|
||||
} else {
|
||||
App::roundRect(p, rthumb, st::black, BlackCorners);
|
||||
}
|
||||
if (selected) {
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
}
|
||||
|
||||
QString link;
|
||||
if (already || hasdata) {
|
||||
link = lang(lng_media_open_with).toUpper();
|
||||
} else {
|
||||
link = lang(_data->loader ? lng_media_cancel : lng_media_download).toUpper();
|
||||
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing);
|
||||
|
||||
QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(selected ? st::msgDateImgSelectBg : st::msgDateImgBg);
|
||||
p.drawEllipse(inner);
|
||||
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||
|
||||
style::sprite icon;
|
||||
if (_data->loader) {
|
||||
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
|
||||
} else {
|
||||
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
|
||||
}
|
||||
p.drawSpriteCenter(inner, icon);
|
||||
}
|
||||
|
||||
p.setFont(st::semiboldFont);
|
||||
p.setPen(outbg ? (selected ? st::msgFileThumbLinkOutFgSelected : st::msgFileThumbLinkOutFg) : (selected ? st::msgFileThumbLinkInFgSelected : st::msgFileThumbLinkInFg));
|
||||
p.drawTextLeft(nameleft, linktop, width, link);
|
||||
} else {
|
||||
p.drawText(tleft, st::mediaPadding.top() + st::mediaNameTop + st::normalFont->ascent, _name);
|
||||
nameleft = st::msgFilePadding.left() + st::msgFileSize + st::msgFilePadding.right();
|
||||
nametop = st::msgFileNameTop;
|
||||
nameright = st::msgFilePadding.left();
|
||||
statustop = st::msgFileStatusTop;
|
||||
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing);
|
||||
|
||||
QRect inner(rtlrect(st::msgFilePadding.left(), st::msgFilePadding.top(), st::msgFileSize, st::msgFileSize, width));
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(outbg ? (selected ? st::msgFileOutBgSelected : st::msgFileOutBg) : (selected ? st::msgFileInBgSelected : st::msgFileInBg));
|
||||
p.drawEllipse(inner);
|
||||
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||
|
||||
style::sprite icon;
|
||||
if (showPause) {
|
||||
icon = outbg ? (selected ? st::msgFileOutPauseSelected : st::msgFileOutPause) : (selected ? st::msgFileInPauseSelected : st::msgFileInPause);
|
||||
} else if (_statusSize < 0 || _statusSize == FileStatusSizeLoaded) {
|
||||
if (_data->song()) {
|
||||
icon = outbg ? (selected ? st::msgFileOutPlaySelected : st::msgFileOutPlay) : (selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
|
||||
} else if (_data->isImage()) {
|
||||
icon = outbg ? (selected ? st::msgFileOutImageSelected : st::msgFileOutImage) : (selected ? st::msgFileInImageSelected : st::msgFileInImage);
|
||||
} else {
|
||||
icon = outbg ? (selected ? st::msgFileOutFileSelected : st::msgFileOutFile) : (selected ? st::msgFileInFileSelected : st::msgFileInFile);
|
||||
}
|
||||
} else if (_data->loader) {
|
||||
icon = outbg ? (selected ? st::msgFileOutCancelSelected : st::msgFileOutCancel) : (selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
|
||||
} else {
|
||||
icon = outbg ? (selected ? st::msgFileOutDownloadSelected : st::msgFileOutDownload) : (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
|
||||
}
|
||||
p.drawSpriteCenter(inner, icon);
|
||||
}
|
||||
int32 namewidth = width - nameleft - nameright;
|
||||
|
||||
p.setFont(st::semiboldFont);
|
||||
p.setPen(st::black);
|
||||
if (namewidth < _namew) {
|
||||
p.drawTextLeft(nameleft, nametop, width, st::normalFont->elided(_name, namewidth));
|
||||
} else {
|
||||
p.drawTextLeft(nameleft, nametop, width, _name, _namew);
|
||||
}
|
||||
|
||||
style::color status(selected ? (outbg ? st::mediaOutSelectColor : st::mediaInSelectColor) : (outbg ? st::mediaOutColor : st::mediaInColor));
|
||||
p.setPen(status->p);
|
||||
|
||||
p.drawText(tleft, st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::normalFont->descent, _statusText);
|
||||
|
||||
p.setFont(st::msgDateFont->f);
|
||||
|
||||
style::color date(selected ? (outbg ? st::msgOutSelectDateColor : st::msgInSelectDateColor) : (outbg ? st::msgOutDateColor : st::msgInDateColor));
|
||||
p.setPen(date->p);
|
||||
|
||||
int32 fullRight = width, fullBottom = _height;
|
||||
parent->drawInfo(p, fullRight, fullBottom, selected, InfoDisplayDefault);
|
||||
p.setFont(st::normalFont);
|
||||
p.setPen(status);
|
||||
p.drawTextLeft(nameleft, statustop, width, _statusText);
|
||||
}
|
||||
|
||||
void HistoryDocument::drawInPlaylist(Painter &p, const HistoryItem *parent, bool selected, bool over, int32 width) const {
|
||||
|
@ -3990,6 +4058,7 @@ void HistoryDocument::drawInPlaylist(Painter &p, const HistoryItem *parent, bool
|
|||
style::color bg(selected ? st::msgInSelectBg : (over ? st::playlistHoverBg : st::msgInBg));
|
||||
p.fillRect(0, 0, width, height, bg->b);
|
||||
|
||||
QRect img = st::mediaMusicInImg;
|
||||
bool showPause = updateStatusText(parent);
|
||||
if (_data->song()) {
|
||||
SongMsgId playing;
|
||||
|
@ -4000,7 +4069,6 @@ void HistoryDocument::drawInPlaylist(Painter &p, const HistoryItem *parent, bool
|
|||
audioPlayer()->currentState(&playing, &playingState, &playingPosition, &playingDuration, &playingFrequency);
|
||||
}
|
||||
|
||||
QRect img;
|
||||
if (_data->status == FileDownloadFailed || _data->status == FileUploadFailed) {
|
||||
img = st::mediaMusicInImg;
|
||||
} else if (_data->status == FileUploading) {
|
||||
|
@ -4011,15 +4079,9 @@ void HistoryDocument::drawInPlaylist(Painter &p, const HistoryItem *parent, bool
|
|||
} else {
|
||||
img = st::mediaMusicInImg;
|
||||
}
|
||||
p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), App::sprite(), img);
|
||||
} else {
|
||||
if (_thumbw) {
|
||||
_data->thumb->checkload();
|
||||
p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), _data->thumb->pixSingle(_thumbw, 0, st::mediaThumbSize, st::mediaThumbSize));
|
||||
} else {
|
||||
p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), App::sprite(), st::mediaDocInImg);
|
||||
}
|
||||
}
|
||||
|
||||
p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), App::sprite(), img);
|
||||
if (selected) {
|
||||
App::roundRect(p, st::mediaPadding.left(), st::mediaPadding.top(), st::mediaThumbSize, st::mediaThumbSize, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
}
|
||||
|
@ -4958,7 +5020,7 @@ void HistoryWebPage::draw(Painter &p, const HistoryItem *parent, bool selected,
|
|||
data->doc->thumb->checkload();
|
||||
p.drawPixmap(QPoint(0, 0), data->doc->thumb->pixSingle(_docThumbWidth, 0, st::mediaThumbSize, st::mediaThumbSize));
|
||||
} else {
|
||||
p.drawPixmap(QPoint(0, 0), App::sprite(), (outbg ? st::mediaDocOutImg : st::mediaDocInImg));
|
||||
p.drawPixmap(QPoint(0, 0), App::sprite(), (outbg ? st::mediaMusicOutImg : st::mediaMusicInImg));
|
||||
}
|
||||
}
|
||||
if (selected) {
|
||||
|
|
|
@ -1252,9 +1252,15 @@ private:
|
|||
|
||||
};
|
||||
|
||||
static const int32 FileStatusSizeReady = 0x7FFFFFF0;
|
||||
static const int32 FileStatusSizeLoaded = 0x7FFFFFF1;
|
||||
static const int32 FileStatusSizeFailed = 0x7FFFFFF2;
|
||||
|
||||
QString formatSizeText(qint64 size);
|
||||
QString formatDownloadText(qint64 ready, qint64 total);
|
||||
QString formatDurationText(qint64 duration);
|
||||
QString formatDurationAndSizeText(qint64 duration, qint64 size);
|
||||
QString formatPlayedText(qint64 played, qint64 duration);
|
||||
|
||||
class HistoryVideo : public HistoryMedia {
|
||||
public:
|
||||
|
@ -1428,9 +1434,6 @@ private:
|
|||
void setStatusSize(int32 newSize, qint64 realDuration = 0) const;
|
||||
bool updateStatusText(const HistoryItem *parent) const; // returns showPause
|
||||
};
|
||||
static const int32 DocumentStatusSizeReady = 0x7FFFFFF0;
|
||||
static const int32 DocumentStatusSizeLoaded = 0x7FFFFFF1;
|
||||
static const int32 DocumentStatusSizeFailed = 0x7FFFFFF2;
|
||||
|
||||
class HistoryGif : public HistoryMedia {
|
||||
public:
|
||||
|
|
|
@ -961,8 +961,20 @@ void DocumentCancelLink::onClick(Qt::MouseButton button) const {
|
|||
data->cancel();
|
||||
}
|
||||
|
||||
DocumentData::DocumentData(const DocumentId &id, const uint64 &access, int32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size) :
|
||||
id(id), type(FileDocument), access(access), date(date), mime(mime), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), loader(0), _additional(0) {
|
||||
DocumentData::DocumentData(const DocumentId &id, const uint64 &access, int32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size) : id(id)
|
||||
, type(FileDocument)
|
||||
, access(access)
|
||||
, date(date)
|
||||
, mime(mime)
|
||||
, thumb(thumb)
|
||||
, dc(dc)
|
||||
, size(size)
|
||||
, status(FileReady)
|
||||
, uploadOffset(0)
|
||||
, openOnSave(0)
|
||||
, loader(0)
|
||||
, _additional(0)
|
||||
, _isImage(false) {
|
||||
setattributes(attributes);
|
||||
_location = Local::readFileLocation(mediaKey(DocumentFileLocation, dc, id));
|
||||
}
|
||||
|
@ -1034,8 +1046,38 @@ const FileLocation &DocumentData::location(bool check) {
|
|||
return _location;
|
||||
}
|
||||
|
||||
WebPageData::WebPageData(const WebPageId &id, WebPageType type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, DocumentData *doc, int32 duration, const QString &author, int32 pendingTill) :
|
||||
id(id), type(type), url(url), displayUrl(displayUrl), siteName(siteName), title(title), description(description), duration(duration), author(author), photo(photo), doc(doc), pendingTill(pendingTill) {
|
||||
void DocumentData::recountIsImage() {
|
||||
_isImage = false;
|
||||
|
||||
QString lowermime = mime.toLower(), namelower = name.toLower();
|
||||
if (lowermime.startsWith(qstr("image/"))) {
|
||||
_isImage = true;
|
||||
} else if (namelower.endsWith(qstr(".bmp"))
|
||||
|| namelower.endsWith(qstr(".jpg"))
|
||||
|| namelower.endsWith(qstr(".jpeg"))
|
||||
|| namelower.endsWith(qstr(".gif"))
|
||||
|| namelower.endsWith(qstr(".webp"))
|
||||
|| namelower.endsWith(qstr(".tga"))
|
||||
|| namelower.endsWith(qstr(".tiff"))
|
||||
|| namelower.endsWith(qstr(".tif"))
|
||||
|| namelower.endsWith(qstr(".psd"))
|
||||
|| namelower.endsWith(qstr(".png"))) {
|
||||
_isImage = true;
|
||||
}
|
||||
}
|
||||
|
||||
WebPageData::WebPageData(const WebPageId &id, WebPageType type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, DocumentData *doc, int32 duration, const QString &author, int32 pendingTill) : id(id)
|
||||
, type(type)
|
||||
, url(url)
|
||||
, displayUrl(displayUrl)
|
||||
, siteName(siteName)
|
||||
, title(title)
|
||||
, description(description)
|
||||
, duration(duration)
|
||||
, author(author)
|
||||
, photo(photo)
|
||||
, doc(doc)
|
||||
, pendingTill(pendingTill) {
|
||||
}
|
||||
|
||||
void PeerLink::onClick(Qt::MouseButton button) const {
|
||||
|
|
|
@ -1118,6 +1118,10 @@ struct DocumentData {
|
|||
SongData *song() {
|
||||
return (type == SongDocument) ? static_cast<SongData*>(_additional) : 0;
|
||||
}
|
||||
bool isImage() const {
|
||||
return _isImage;
|
||||
}
|
||||
void recountIsImage();
|
||||
|
||||
DocumentId id;
|
||||
DocumentType type;
|
||||
|
@ -1144,6 +1148,8 @@ struct DocumentData {
|
|||
private:
|
||||
|
||||
FileLocation _location;
|
||||
bool _isImage;
|
||||
|
||||
};
|
||||
|
||||
struct SongMsgId {
|
||||
|
|
Loading…
Reference in New Issue