mirror of https://github.com/procxx/kepka.git
preparing version 0.8.37.dev
This commit is contained in:
parent
1268774517
commit
a65ef6fb00
|
@ -1,11 +1,11 @@
|
|||
@echo OFF
|
||||
|
||||
set "AppVersionStrMajor=0.8"
|
||||
set "AppVersion=8036"
|
||||
set "AppVersionStrSmall=0.8.36"
|
||||
set "AppVersionStr=0.8.36"
|
||||
set "AppVersionStrFull=0.8.36.0"
|
||||
set "DevChannel=0"
|
||||
set "AppVersion=8037"
|
||||
set "AppVersionStrSmall=0.8.37"
|
||||
set "AppVersionStr=0.8.37"
|
||||
set "AppVersionStrFull=0.8.37.0"
|
||||
set "DevChannel=1"
|
||||
|
||||
if %DevChannel% neq 0 goto preparedev
|
||||
|
||||
|
|
|
@ -1997,3 +1997,5 @@ playerVolume: sprite(352px, 179px, 44px, 12px);
|
|||
playerInactiveOpacity: 0.8;
|
||||
playerUnavailableOpacity: 0.3;
|
||||
playerDuration: 200;
|
||||
|
||||
playlistHoverBg: #f2f2f2;
|
||||
|
|
|
@ -640,8 +640,8 @@ void Application::checkMapVersion() {
|
|||
psRegisterCustomScheme();
|
||||
if (Local::oldMapVersion()) {
|
||||
QString versionFeatures;
|
||||
if (DevChannel && Local::oldMapVersion() < 8035) {
|
||||
versionFeatures = lang(lng_new_version_minor);// QString::fromUtf8("\xe2\x80\x94 Forward photos, media and stickers with drag-n-drop\n\xe2\x80\x94 Drag-n-drop text messages by timestamp to forward them\n\xe2\x80\x94 Larger stickers panel");// .replace('@', qsl("@") + QChar(0x200D));
|
||||
if (DevChannel && Local::oldMapVersion() < 8037) {
|
||||
versionFeatures = lang(lng_new_version_text);// QString::fromUtf8("\xe2\x80\x94 Forward photos, media and stickers with drag-n-drop\n\xe2\x80\x94 Drag-n-drop text messages by timestamp to forward them\n\xe2\x80\x94 Larger stickers panel");// .replace('@', qsl("@") + QChar(0x200D));
|
||||
} else if (!DevChannel && Local::oldMapVersion() < 8036) {
|
||||
versionFeatures = lang(lng_new_version_text).trimmed();
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
static const int32 AppVersion = 8036;
|
||||
static const wchar_t *AppVersionStr = L"0.8.36";
|
||||
static const bool DevChannel = false;
|
||||
static const int32 AppVersion = 8037;
|
||||
static const wchar_t *AppVersionStr = L"0.8.37";
|
||||
static const bool DevChannel = true;
|
||||
|
||||
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
|
||||
static const wchar_t *AppName = L"Telegram Desktop";
|
||||
|
|
|
@ -3053,6 +3053,116 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, bool selected
|
|||
}
|
||||
}
|
||||
|
||||
void HistoryDocument::drawInPlaylist(QPainter &p, const HistoryItem *parent, bool selected, bool over, int32 width) const {
|
||||
bool out = parent->out(), already = !data->already().isEmpty(), hasdata = !data->data.isEmpty();
|
||||
int32 height = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom();
|
||||
|
||||
style::color bg(selected ? st::msgInSelectBg : (over ? st::playlistHoverBg : st::msgInBg));
|
||||
p.fillRect(0, 0, width, height, bg->b);
|
||||
|
||||
QString statusText;
|
||||
if (data->song()) {
|
||||
SongMsgId playing;
|
||||
AudioPlayerState playingState = AudioPlayerStopped;
|
||||
int64 playingPosition = 0, playingDuration = 0;
|
||||
int32 playingFrequency = 0;
|
||||
if (audioPlayer()) {
|
||||
audioPlayer()->currentState(&playing, &playingState, &playingPosition, &playingDuration, &playingFrequency);
|
||||
}
|
||||
|
||||
QRect img;
|
||||
if (data->status == FileFailed) {
|
||||
statusText = lang(lng_attach_failed);
|
||||
img = st::mediaAudioInImg;
|
||||
} else if (data->status == FileUploading) {
|
||||
if (_uplTextCache.isEmpty() || _uplDone != data->uploadOffset) {
|
||||
_uplDone = data->uploadOffset;
|
||||
_uplTextCache = formatDownloadText(_uplDone, data->size);
|
||||
}
|
||||
statusText = _uplTextCache;
|
||||
img = st::mediaAudioInImg;
|
||||
} else if (already || hasdata) {
|
||||
bool isPlaying = (playing.msgId == parent->id);
|
||||
bool showPause = false;
|
||||
if (playing.msgId == parent->id && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) {
|
||||
statusText = formatDurationText(playingPosition / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)) + qsl(" / ") + formatDurationText(playingDuration / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency));
|
||||
showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting);
|
||||
} else {
|
||||
statusText = formatDurationText(data->song()->duration);
|
||||
}
|
||||
if (!showPause && playing.msgId == parent->id && App::main() && App::main()->player()->seekingSong(playing)) showPause = true;
|
||||
img = isPlaying ? (showPause ? st::mediaPauseOutImg : st::mediaPlayOutImg) : (showPause ? st::mediaPauseInImg : st::mediaPlayInImg);
|
||||
} else {
|
||||
if (data->loader) {
|
||||
int32 offset = data->loader->currentOffset();
|
||||
if (_dldTextCache.isEmpty() || _dldDone != offset) {
|
||||
_dldDone = offset;
|
||||
_dldTextCache = formatDownloadText(_dldDone, data->size);
|
||||
}
|
||||
statusText = _dldTextCache;
|
||||
} else {
|
||||
statusText = _size;
|
||||
}
|
||||
img = st::mediaAudioInImg;
|
||||
}
|
||||
|
||||
p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), App::sprite(), img);
|
||||
} else {
|
||||
if (data->status == FileFailed) {
|
||||
statusText = lang(lng_attach_failed);
|
||||
} else if (data->status == FileUploading) {
|
||||
if (_uplTextCache.isEmpty() || _uplDone != data->uploadOffset) {
|
||||
_uplDone = data->uploadOffset;
|
||||
_uplTextCache = formatDownloadText(_uplDone, data->size);
|
||||
}
|
||||
statusText = _uplTextCache;
|
||||
} else if (data->loader) {
|
||||
int32 offset = data->loader->currentOffset();
|
||||
if (_dldTextCache.isEmpty() || _dldDone != offset) {
|
||||
_dldDone = offset;
|
||||
_dldTextCache = formatDownloadText(_dldDone, data->size);
|
||||
}
|
||||
statusText = _dldTextCache;
|
||||
} else {
|
||||
statusText = _size;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (selected) {
|
||||
App::roundRect(p, st::mediaPadding.left(), st::mediaPadding.top(), st::mediaThumbSize, st::mediaThumbSize, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
}
|
||||
|
||||
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
||||
int32 twidth = width - tleft - st::mediaPadding.right();
|
||||
int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right();
|
||||
int32 secondwidth = width - tleft - fullTimeWidth;
|
||||
|
||||
p.setFont(st::mediaFont->f);
|
||||
p.setPen(st::black->c);
|
||||
if (twidth < _namew) {
|
||||
p.drawText(tleft, st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->m.elidedText(_name, Qt::ElideRight, twidth));
|
||||
} else {
|
||||
p.drawText(tleft, st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, _name);
|
||||
}
|
||||
|
||||
style::color status(selected ? st::mediaInSelectColor : st::mediaInColor);
|
||||
p.setPen(status->p);
|
||||
p.drawText(tleft, st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->descent, statusText);
|
||||
}
|
||||
|
||||
TextLinkPtr HistoryDocument::linkInPlaylist() {
|
||||
if (!data->loader && data->access) {
|
||||
return _openl;
|
||||
}
|
||||
return TextLinkPtr();
|
||||
}
|
||||
|
||||
void HistoryDocument::regItem(HistoryItem *item) {
|
||||
App::regDocumentItem(data, item);
|
||||
}
|
||||
|
|
|
@ -1046,6 +1046,9 @@ public:
|
|||
}
|
||||
ImagePtr replyPreview();
|
||||
|
||||
void drawInPlaylist(QPainter &p, const HistoryItem *parent, bool selected, bool over, int32 width) const;
|
||||
TextLinkPtr linkInPlaylist();
|
||||
|
||||
private:
|
||||
|
||||
DocumentData *data;
|
||||
|
|
|
@ -2076,8 +2076,7 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
|
|||
if (!animCache.isNull()) {
|
||||
overview->animShow(animCache, animTopBarCache, back, lastScrollTop);
|
||||
} else {
|
||||
overview->show();
|
||||
overview->activate();
|
||||
overview->fastShow();
|
||||
}
|
||||
history.animStop();
|
||||
history.showPeer(0, 0, false, true);
|
||||
|
|
|
@ -40,13 +40,16 @@ OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, const
|
|||
, _photosInRow(1)
|
||||
, _photosToAdd(0)
|
||||
, _selMode(false)
|
||||
, _audioLeft(st::msgMargin.left())
|
||||
, _audioWidth(st::msgMinWidth)
|
||||
, _audioHeight(st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom())
|
||||
, _width(st::wndMinWidth)
|
||||
, _height(0)
|
||||
, _minHeight(0)
|
||||
, _addToY(0)
|
||||
, _cursor(style::cur_default)
|
||||
, _dragAction(NoDrag)
|
||||
, _dragItem(0)
|
||||
, _dragItem(0), _selectedMsgId(0)
|
||||
, _dragItemIndex(-1)
|
||||
, _mousedItem(0)
|
||||
, _mousedItemIndex(-1)
|
||||
|
@ -77,6 +80,10 @@ OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, const
|
|||
|
||||
mediaOverviewUpdated();
|
||||
setMouseTracking(true);
|
||||
|
||||
if (_type == OverviewAudioDocuments) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool OverviewInner::event(QEvent *e) {
|
||||
|
@ -133,7 +140,7 @@ void OverviewInner::touchUpdateSpeed() {
|
|||
void OverviewInner::fixItemIndex(int32 ¤t, MsgId msgId) const {
|
||||
if (!msgId) {
|
||||
current = -1;
|
||||
} else if (_type == OverviewPhotos) {
|
||||
} else if (_type == OverviewPhotos || _type == OverviewAudioDocuments) {
|
||||
int32 l = _hist->_overview[_type].size();
|
||||
if (current < 0 || current >= l || _hist->_overview[_type][current] != msgId) {
|
||||
current = -1;
|
||||
|
@ -166,6 +173,10 @@ bool OverviewInner::itemHasPoint(MsgId msgId, int32 index, int32 x, int32 y) con
|
|||
if (x >= 0 && x < _vsize && y >= 0 && y < _vsize) {
|
||||
return true;
|
||||
}
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
if (x >= _audioLeft && x < _audioLeft + _audioWidth && y >= 0 && y < _audioHeight) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
HistoryItem *item = App::histItemById(msgId);
|
||||
HistoryMedia *media = item ? item->getMedia(true) : 0;
|
||||
|
@ -185,6 +196,8 @@ bool OverviewInner::itemHasPoint(MsgId msgId, int32 index, int32 x, int32 y) con
|
|||
int32 OverviewInner::itemHeight(MsgId msgId, int32 index) const {
|
||||
if (_type == OverviewPhotos) {
|
||||
return _vsize;
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
return _audioHeight;
|
||||
}
|
||||
|
||||
fixItemIndex(index, msgId);
|
||||
|
@ -200,7 +213,7 @@ void OverviewInner::moveToNextItem(MsgId &msgId, int32 &index, MsgId upTo, int32
|
|||
}
|
||||
|
||||
index += delta;
|
||||
if (_type == OverviewPhotos) {
|
||||
if (_type == OverviewPhotos || _type == OverviewAudioDocuments) {
|
||||
if (index < 0 || index >= _hist->_overview[_type].size()) {
|
||||
msgId = 0;
|
||||
index = -1;
|
||||
|
@ -234,6 +247,8 @@ void OverviewInner::updateMsg(MsgId itemId, int32 itemIndex) {
|
|||
int32 vsize = (_vsize + st::overviewPhotoSkip);
|
||||
int32 row = (_photosToAdd + itemIndex) / _photosInRow, col = (_photosToAdd + itemIndex) % _photosInRow;
|
||||
update(int32(col * w), _addToY + int32(row * vsize), qCeil(w), vsize);
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
update(_audioLeft, _addToY + int32(itemIndex * _audioHeight), _audioWidth, _audioHeight);
|
||||
} else {
|
||||
HistoryItem *item = App::histItemById(itemId);
|
||||
HistoryMedia *media = item ? item->getMedia(true) : 0;
|
||||
|
@ -570,7 +585,7 @@ void OverviewInner::applyDragSelection() {
|
|||
}
|
||||
if (_dragSelecting) {
|
||||
for (int32 i = _dragSelToIndex; i <= _dragSelFromIndex; ++i) {
|
||||
MsgId msgid = (_type == OverviewPhotos) ? _hist->_overview[_type][i] : _items[i].msgid;
|
||||
MsgId msgid = (_type == OverviewPhotos || _type == OverviewAudioDocuments) ? _hist->_overview[_type][i] : _items[i].msgid;
|
||||
if (!msgid) continue;
|
||||
|
||||
SelectedItems::iterator j = _selected.find(msgid);
|
||||
|
@ -589,7 +604,7 @@ void OverviewInner::applyDragSelection() {
|
|||
}
|
||||
} else {
|
||||
for (int32 i = _dragSelToIndex; i <= _dragSelFromIndex; ++i) {
|
||||
MsgId msgid = (_type == OverviewPhotos) ? _hist->_overview[_type][i] : _items[i].msgid;
|
||||
MsgId msgid = (_type == OverviewPhotos || _type == OverviewAudioDocuments) ? _hist->_overview[_type][i] : _items[i].msgid;
|
||||
if (!msgid) continue;
|
||||
|
||||
SelectedItems::iterator j = _selected.find(msgid);
|
||||
|
@ -612,6 +627,8 @@ QPoint OverviewInner::mapMouseToItem(QPoint p, MsgId itemId, int32 itemIndex) {
|
|||
float64 w = (_width - st::overviewPhotoSkip) / float64(_photosInRow);
|
||||
p.setX(p.x() - int32(col * w) - st::overviewPhotoSkip);
|
||||
p.setY(p.y() - _addToY - row * (_vsize + st::overviewPhotoSkip) - st::overviewPhotoSkip);
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
p.setY(p.y() - _addToY - itemIndex * _audioHeight);
|
||||
} else {
|
||||
p.setY(p.y() - _addToY - (_height - _items[itemIndex].y));
|
||||
}
|
||||
|
@ -622,6 +639,16 @@ void OverviewInner::clear() {
|
|||
_cached.clear();
|
||||
}
|
||||
|
||||
int32 OverviewInner::itemTop(MsgId msgId) const {
|
||||
if (_type == OverviewAudioDocuments) {
|
||||
int32 index = _hist->_overview[_type].indexOf(msgId);
|
||||
if (index >= 0) {
|
||||
return _addToY + int32(index * _audioHeight);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
QPixmap OverviewInner::genPix(PhotoData *photo, int32 size) {
|
||||
size *= cIntRetinaFactor();
|
||||
QImage img = (photo->full->loaded() ? photo->full : (photo->medium->loaded() ? photo->medium : photo->thumb))->pix().toImage();
|
||||
|
@ -747,6 +774,32 @@ void OverviewInner::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
int32 from = int32(r.top() - _addToY) / int32(_audioHeight);
|
||||
int32 to = int32(r.bottom() - _addToY) / int32(_audioHeight) + 1;
|
||||
History::MediaOverview &overview(_hist->_overview[_type]);
|
||||
int32 count = overview.size();
|
||||
p.translate(_audioLeft, _addToY + from * _audioHeight);
|
||||
for (int32 index = from; index < to; ++index) {
|
||||
if (index >= count) break;
|
||||
|
||||
HistoryItem *item = App::histItemById(overview[index]);
|
||||
HistoryMedia *m = item ? item->getMedia(true) : 0;
|
||||
if (!m || m->type() != MediaTypeDocument) continue;
|
||||
|
||||
uint32 sel = 0;
|
||||
if (index >= selfrom && index <= selto) {
|
||||
sel = (_dragSelecting && item->id > 0) ? FullItemSel : 0;
|
||||
} else if (hasSel) {
|
||||
SelectedItems::const_iterator i = _selected.constFind(item->id);
|
||||
if (i != selEnd) {
|
||||
sel = i.value();
|
||||
}
|
||||
}
|
||||
|
||||
static_cast<HistoryDocument*>(m)->drawInPlaylist(p, item, (sel == FullItemSel), ((_menu ? (App::contextItem() ? App::contextItem()->id : 0) : _selectedMsgId) == item->id), _audioWidth);
|
||||
p.translate(0, _audioHeight);
|
||||
}
|
||||
} else {
|
||||
p.translate(0, st::msgMargin.top() + _addToY);
|
||||
int32 y = 0, w = _width - st::msgMargin.left() - st::msgMargin.right();
|
||||
|
@ -825,6 +878,7 @@ void OverviewInner::onUpdateSelected() {
|
|||
TextLinkPtr lnk;
|
||||
HistoryItem *item = 0;
|
||||
int32 index = -1;
|
||||
_selectedMsgId = 0;
|
||||
if (_type == OverviewPhotos) {
|
||||
float64 w = (float64(_width - st::overviewPhotoSkip) / _photosInRow);
|
||||
int32 inRow = int32((m.x() - (st::overviewPhotoSkip / 2)) / w), vsize = (_vsize + st::overviewPhotoSkip);
|
||||
|
@ -860,6 +914,36 @@ void OverviewInner::onUpdateSelected() {
|
|||
} else {
|
||||
return;
|
||||
}
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
int32 i = int32((m.y() - _addToY) / _audioHeight), count = _hist->_overview[_type].size();
|
||||
if (!count) return;
|
||||
|
||||
bool upon = true;
|
||||
if (i < 0) {
|
||||
i = 0;
|
||||
_selectedMsgId = -1;
|
||||
upon = false;
|
||||
}
|
||||
if (i >= count) {
|
||||
i = count - 1;
|
||||
_selectedMsgId = -1;
|
||||
upon = false;
|
||||
}
|
||||
MsgId msgid = _hist->_overview[_type][i];
|
||||
HistoryItem *histItem = App::histItemById(msgid);
|
||||
if (histItem) {
|
||||
item = histItem;
|
||||
index = i;
|
||||
if (upon && m.x() >= _audioLeft && m.x() < _audioLeft + _audioWidth) {
|
||||
HistoryMedia *media = item->getMedia(true);
|
||||
if (media && media->type() == MediaTypeDocument) {
|
||||
lnk = static_cast<HistoryDocument*>(media)->linkInPlaylist();
|
||||
if (_selectedMsgId >= 0) _selectedMsgId = item->id;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
int32 w = _width - st::msgMargin.left() - st::msgMargin.right();
|
||||
if (_items.isEmpty()) return;
|
||||
|
@ -954,7 +1038,7 @@ void OverviewInner::onUpdateSelected() {
|
|||
_selected[_dragItem] = 0;
|
||||
updateDragSelection(0, -1, 0, -1, false);
|
||||
} else {
|
||||
bool selectingDown = (_type == OverviewPhotos ? (_mousedItemIndex > _dragItemIndex) : (_mousedItemIndex < _dragItemIndex)) || (_mousedItemIndex == _dragItemIndex && (_type == OverviewPhotos ? (_dragStartPos.x() < m.x()) : (_dragStartPos.y() < m.y())));
|
||||
bool selectingDown = ((_type == OverviewPhotos || _type == OverviewAudioDocuments) ? (_mousedItemIndex > _dragItemIndex) : (_mousedItemIndex < _dragItemIndex)) || (_mousedItemIndex == _dragItemIndex && (_type == OverviewPhotos ? (_dragStartPos.x() < m.x()) : (_dragStartPos.y() < m.y())));
|
||||
MsgId dragSelFrom = _dragItem, dragSelTo = _mousedItem;
|
||||
int32 dragSelFromIndex = _dragItemIndex, dragSelToIndex = _mousedItemIndex;
|
||||
if (!itemHasPoint(dragSelFrom, dragSelFromIndex, _dragStartPos.x(), _dragStartPos.y())) { // maybe exclude dragSelFrom
|
||||
|
@ -963,6 +1047,10 @@ void OverviewInner::onUpdateSelected() {
|
|||
if (_dragStartPos.x() >= _vsize || ((_mousedItem == dragSelFrom) && (m.x() < _dragStartPos.x() + QApplication::startDragDistance()))) {
|
||||
moveToNextItem(dragSelFrom, dragSelFromIndex, dragSelTo, 1);
|
||||
}
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
if (_dragStartPos.y() >= itemHeight(dragSelFrom, dragSelFromIndex) || ((_mousedItem == dragSelFrom) && (m.y() < _dragStartPos.y() + QApplication::startDragDistance()))) {
|
||||
moveToNextItem(dragSelFrom, dragSelFromIndex, dragSelTo, 1);
|
||||
}
|
||||
} else {
|
||||
if (_dragStartPos.y() >= (itemHeight(dragSelFrom, dragSelFromIndex) - st::msgMargin.bottom()) || ((_mousedItem == dragSelFrom) && (m.y() < _dragStartPos.y() + QApplication::startDragDistance()))) {
|
||||
moveToNextItem(dragSelFrom, dragSelFromIndex, dragSelTo, -1);
|
||||
|
@ -973,6 +1061,10 @@ void OverviewInner::onUpdateSelected() {
|
|||
if (_dragStartPos.x() < 0 || ((_mousedItem == dragSelFrom) && (m.x() >= _dragStartPos.x() - QApplication::startDragDistance()))) {
|
||||
moveToNextItem(dragSelFrom, dragSelFromIndex, dragSelTo, -1);
|
||||
}
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
if (_dragStartPos.y() < 0 || ((_mousedItem == dragSelFrom) && (m.y() >= _dragStartPos.y() - QApplication::startDragDistance()))) {
|
||||
moveToNextItem(dragSelFrom, dragSelFromIndex, dragSelTo, -1);
|
||||
}
|
||||
} else {
|
||||
if (_dragStartPos.y() < st::msgMargin.top() || ((_mousedItem == dragSelFrom) && (m.y() >= _dragStartPos.y() - QApplication::startDragDistance()))) {
|
||||
moveToNextItem(dragSelFrom, dragSelFromIndex, dragSelTo, 1);
|
||||
|
@ -986,6 +1078,10 @@ void OverviewInner::onUpdateSelected() {
|
|||
if (m.x() < 0) {
|
||||
moveToNextItem(dragSelTo, dragSelToIndex, dragSelFrom, -1);
|
||||
}
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
if (m.y() < 0) {
|
||||
moveToNextItem(dragSelTo, dragSelToIndex, dragSelFrom, 1);
|
||||
}
|
||||
} else {
|
||||
if (m.y() < st::msgMargin.top()) {
|
||||
moveToNextItem(dragSelTo, dragSelToIndex, dragSelFrom, 1);
|
||||
|
@ -996,6 +1092,10 @@ void OverviewInner::onUpdateSelected() {
|
|||
if (m.x() >= _vsize) {
|
||||
moveToNextItem(dragSelTo, dragSelToIndex, dragSelFrom, 1);
|
||||
}
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
if (m.y() >= itemHeight(dragSelTo, dragSelToIndex)) {
|
||||
moveToNextItem(dragSelTo, dragSelToIndex, dragSelFrom, 1);
|
||||
}
|
||||
} else {
|
||||
if (m.y() >= itemHeight(dragSelTo, dragSelToIndex) - st::msgMargin.bottom()) {
|
||||
moveToNextItem(dragSelTo, dragSelToIndex, dragSelFrom, -1);
|
||||
|
@ -1007,7 +1107,7 @@ void OverviewInner::onUpdateSelected() {
|
|||
MsgId dragFirstAffected = dragSelFrom;
|
||||
int32 dragFirstAffectedIndex = dragSelFromIndex;
|
||||
while (dragFirstAffectedIndex >= 0 && dragFirstAffected <= 0) {
|
||||
moveToNextItem(dragFirstAffected, dragFirstAffectedIndex, dragSelTo, ((selectingDown && (_type == OverviewPhotos)) || (!selectingDown && (_type != OverviewPhotos))) ? -1 : 1);
|
||||
moveToNextItem(dragFirstAffected, dragFirstAffectedIndex, dragSelTo, ((selectingDown && (_type == OverviewPhotos || _type == OverviewAudioDocuments)) || (!selectingDown && (_type != OverviewPhotos && _type != OverviewAudioDocuments))) ? -1 : 1);
|
||||
}
|
||||
if (dragFirstAffectedIndex >= 0) {
|
||||
SelectedItems::const_iterator i = _selected.constFind(dragFirstAffected);
|
||||
|
@ -1083,6 +1183,10 @@ void OverviewInner::enterEvent(QEvent *e) {
|
|||
}
|
||||
|
||||
void OverviewInner::leaveEvent(QEvent *e) {
|
||||
if (_selectedMsgId > 0) {
|
||||
_selectedMsgId = 0;
|
||||
updateMsg(App::histItemById(_selectedMsgId));
|
||||
}
|
||||
if (textlnkOver()) {
|
||||
updateMsg(App::hoveredLinkItem());
|
||||
textlnkOver(TextLinkPtr());
|
||||
|
@ -1097,6 +1201,8 @@ void OverviewInner::leaveEvent(QEvent *e) {
|
|||
|
||||
void OverviewInner::resizeEvent(QResizeEvent *e) {
|
||||
_width = width();
|
||||
_audioWidth = qMin(_width - st::profilePadding.left() - st::profilePadding.right(), int(st::profileMaxWidth));
|
||||
_audioLeft = (_width - _audioWidth) / 2;
|
||||
showAll(true);
|
||||
onUpdateSelected();
|
||||
update();
|
||||
|
@ -1106,6 +1212,8 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
if (_menu) {
|
||||
_menu->deleteLater();
|
||||
_menu = 0;
|
||||
updateMsg(App::contextItem());
|
||||
if (_selectedMsgId > 0) updateMsg(App::histItemById(_selectedMsgId));
|
||||
}
|
||||
if (e->reason() == QContextMenuEvent::Mouse) {
|
||||
dragActionUpdate(e->globalPos());
|
||||
|
@ -1165,6 +1273,8 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
_menu->addAction(lang(lng_context_select_msg), this, SLOT(selectMessage()))->setEnabled(true);
|
||||
}
|
||||
App::contextItem(App::hoveredLinkItem());
|
||||
updateMsg(App::contextItem());
|
||||
if (_selectedMsgId > 0) updateMsg(App::histItemById(_selectedMsgId));
|
||||
} else if (App::mousedItem() && App::mousedItem()->id == _mousedItem) {
|
||||
_menu = new ContextMenu(_overview);
|
||||
_menu->addAction(lang(lng_context_to_msg), this, SLOT(goToMessage()))->setEnabled(true);
|
||||
|
@ -1182,6 +1292,8 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
_menu->addAction(lang(lng_context_select_msg), this, SLOT(selectMessage()))->setEnabled(true);
|
||||
}
|
||||
App::contextItem(App::mousedItem());
|
||||
updateMsg(App::contextItem());
|
||||
if (_selectedMsgId > 0) updateMsg(App::histItemById(_selectedMsgId));
|
||||
}
|
||||
if (_menu) {
|
||||
_menu->deleteOnHide();
|
||||
|
@ -1194,7 +1306,7 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
int32 OverviewInner::resizeToWidth(int32 nwidth, int32 scrollTop, int32 minHeight) {
|
||||
if (width() == nwidth && minHeight == _minHeight) return scrollTop;
|
||||
_minHeight = minHeight;
|
||||
_addToY = (_height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
_addToY = (_type != OverviewAudioDocuments && _height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
if (_type == OverviewPhotos && _resizeIndex < 0) {
|
||||
_resizeIndex = _photosInRow * ((scrollTop + minHeight) / int32(_vsize + st::overviewPhotoSkip)) + _photosInRow - 1;
|
||||
_resizeSkip = (scrollTop + minHeight) - ((scrollTop + minHeight) / int32(_vsize + st::overviewPhotoSkip)) * int32(_vsize + st::overviewPhotoSkip);
|
||||
|
@ -1317,6 +1429,8 @@ void OverviewInner::openContextFile() {
|
|||
void OverviewInner::onMenuDestroy(QObject *obj) {
|
||||
if (_menu == obj) {
|
||||
_menu = 0;
|
||||
updateMsg(App::contextItem());
|
||||
if (_selectedMsgId > 0) updateMsg(App::histItemById(_selectedMsgId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1382,7 +1496,7 @@ void OverviewInner::onTouchScrollTimer() {
|
|||
|
||||
void OverviewInner::mediaOverviewUpdated(bool fromResize) {
|
||||
int32 oldHeight = _height;
|
||||
if (_type != OverviewPhotos) {
|
||||
if (_type != OverviewPhotos && _type != OverviewAudioDocuments) {
|
||||
History::MediaOverview &o(_hist->_overview[_type]);
|
||||
int32 l = o.size();
|
||||
_items.reserve(2 * l); // day items
|
||||
|
@ -1477,7 +1591,7 @@ void OverviewInner::mediaOverviewUpdated(bool fromResize) {
|
|||
if (_height != y) {
|
||||
_height = y;
|
||||
if (!fromResize) {
|
||||
_addToY = (_height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
_addToY = (_type != OverviewAudioDocuments && _height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
resize(width(), _minHeight > _height ? _minHeight : _height);
|
||||
}
|
||||
}
|
||||
|
@ -1544,7 +1658,7 @@ void OverviewInner::itemRemoved(HistoryItem *item) {
|
|||
}
|
||||
|
||||
void OverviewInner::itemResized(HistoryItem *item, bool scrollToIt) {
|
||||
if (_type != OverviewPhotos) {
|
||||
if (_type != OverviewPhotos && _type != OverviewAudioDocuments) {
|
||||
HistoryMedia *media = item ? item->getMedia(true) : 0;
|
||||
if (!media) return;
|
||||
|
||||
|
@ -1562,7 +1676,7 @@ void OverviewInner::itemResized(HistoryItem *item, bool scrollToIt) {
|
|||
_items[j].y += newh;
|
||||
}
|
||||
_height = _items[l - 1].y;
|
||||
_addToY = (_height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
_addToY = (_type != OverviewAudioDocuments && _height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
resize(width(), _minHeight > _height ? _minHeight : _height);
|
||||
if (scrollToIt) {
|
||||
if (_addToY + _height - from > _scroll->scrollTop() + _scroll->height()) {
|
||||
|
@ -1592,6 +1706,11 @@ void OverviewInner::msgUpdated(const HistoryItem *msg) {
|
|||
int32 row = (_photosToAdd + index) / _photosInRow, col = (_photosToAdd + index) % _photosInRow;
|
||||
update(int32(col * w), _addToY + int32(row * vsize), qCeil(w), vsize);
|
||||
}
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
int32 index = _hist->_overview[_type].indexOf(msgid);
|
||||
if (index >= 0) {
|
||||
update(_audioLeft, _addToY + int32(index * _audioHeight), _audioWidth, _audioHeight);
|
||||
}
|
||||
} else {
|
||||
for (int32 i = 0, l = _items.size(); i != l; ++i) {
|
||||
if (_items[i].msgid == msgid) {
|
||||
|
@ -1620,13 +1739,16 @@ void OverviewInner::showAll(bool recountHeights) {
|
|||
}
|
||||
int32 rows = ((_photosToAdd + count) / _photosInRow) + (((_photosToAdd + count) % _photosInRow) ? 1 : 0);
|
||||
newHeight = _height = (_vsize + st::overviewPhotoSkip) * rows + st::overviewPhotoSkip;
|
||||
} else if (_type == OverviewAudioDocuments) {
|
||||
int32 count = _hist->_overview[_type].size(), fullCount = _hist->_overviewCount[_type];
|
||||
newHeight = _height = count * _audioHeight;
|
||||
} else {
|
||||
if (recountHeights && _type == OverviewVideos) { // recount heights because of captions
|
||||
mediaOverviewUpdated(true);
|
||||
}
|
||||
newHeight = _height;
|
||||
}
|
||||
_addToY = (_height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
_addToY = (_type != OverviewAudioDocuments && _height < _minHeight) ? (_minHeight - _height) : 0;
|
||||
if (newHeight < _minHeight) {
|
||||
newHeight = _minHeight;
|
||||
}
|
||||
|
@ -1661,6 +1783,8 @@ OverviewWidget::OverviewWidget(QWidget *parent, const PeerData *peer, MediaOverv
|
|||
connect(&_scrollTimer, SIGNAL(timeout()), this, SLOT(onScrollTimer()));
|
||||
_scrollTimer.setSingleShot(false);
|
||||
|
||||
connect(App::main()->player(), SIGNAL(playerSongChanged(MsgId)), this, SLOT(onPlayerSongChanged(MsgId)));
|
||||
|
||||
switchType(type);
|
||||
}
|
||||
|
||||
|
@ -1705,7 +1829,7 @@ void OverviewWidget::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
QRect r(e->rect());
|
||||
if (type() == OverviewPhotos) {
|
||||
if (type() == OverviewPhotos || type() == OverviewAudioDocuments) {
|
||||
p.fillRect(r, st::white->b);
|
||||
} else {
|
||||
bool hasTopBar = !App::main()->topBar()->isHidden(), hasPlayer = !App::main()->player()->isHidden();
|
||||
|
@ -1827,12 +1951,36 @@ int32 OverviewWidget::lastScrollTop() const {
|
|||
return _scroll.scrollTop();
|
||||
}
|
||||
|
||||
int32 OverviewWidget::countBestScroll() const {
|
||||
if (type() == OverviewAudioDocuments && audioPlayer()) {
|
||||
SongMsgId playing;
|
||||
AudioPlayerState playingState = AudioPlayerStopped;
|
||||
audioPlayer()->currentState(&playing, &playingState);
|
||||
if (playing) {
|
||||
int32 top = _inner.itemTop(playing.msgId);
|
||||
if (top >= 0) {
|
||||
return snap(top - int(_scroll.height() - (st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom())) / 2, 0, _scroll.scrollTopMax());
|
||||
}
|
||||
}
|
||||
}
|
||||
return _scroll.scrollTopMax();
|
||||
}
|
||||
|
||||
void OverviewWidget::fastShow(bool back, int32 lastScrollTop) {
|
||||
stopGif();
|
||||
resizeEvent(0);
|
||||
_scrollSetAfterShow = (lastScrollTop < 0 ? countBestScroll() : lastScrollTop);
|
||||
show();
|
||||
_inner.setFocus();
|
||||
doneShow();
|
||||
}
|
||||
|
||||
void OverviewWidget::animShow(const QPixmap &bgAnimCache, const QPixmap &bgAnimTopBarCache, bool back, int32 lastScrollTop) {
|
||||
stopGif();
|
||||
_bgAnimCache = bgAnimCache;
|
||||
_bgAnimTopBarCache = bgAnimTopBarCache;
|
||||
resizeEvent(0);
|
||||
_scroll.scrollToY(lastScrollTop < 0 ? _scroll.scrollTopMax() : lastScrollTop);
|
||||
_scroll.scrollToY(lastScrollTop < 0 ? countBestScroll() : lastScrollTop);
|
||||
_animCache = myGrab(this, rect());
|
||||
App::main()->topBar()->stopAnim();
|
||||
_animTopBarCache = myGrab(App::main()->topBar(), QRect(0, 0, width(), st::topBarHeight));
|
||||
|
@ -1950,6 +2098,15 @@ void OverviewWidget::onScrollTimer() {
|
|||
_scroll.scrollToY(_scroll.scrollTop() + d);
|
||||
}
|
||||
|
||||
void OverviewWidget::onPlayerSongChanged(MsgId msgId) {
|
||||
if (type() == OverviewAudioDocuments) {
|
||||
// int32 top = _inner.itemTop(msgId);
|
||||
// if (top > 0) {
|
||||
// _scroll.scrollToY(snap(top - int(_scroll.height() - (st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom())) / 2, 0, _scroll.scrollTopMax()));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
void OverviewWidget::checkSelectingScroll(QPoint point) {
|
||||
if (point.y() < _scroll.scrollTop()) {
|
||||
_scrollDelta = point.y() - _scroll.scrollTop();
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
OverviewInner(OverviewWidget *overview, ScrollArea *scroll, const PeerData *peer, MediaOverviewType type);
|
||||
|
||||
void clear();
|
||||
int32 itemTop(MsgId msgId) const;
|
||||
|
||||
bool event(QEvent *e);
|
||||
void touchEvent(QTouchEvent *e);
|
||||
|
@ -130,6 +131,9 @@ private:
|
|||
CachedSizes _cached;
|
||||
bool _selMode;
|
||||
|
||||
// audio documents
|
||||
int32 _audioLeft, _audioWidth, _audioHeight;
|
||||
|
||||
// other
|
||||
typedef struct _CachedItem {
|
||||
_CachedItem() : msgid(0), y(0) {
|
||||
|
@ -158,7 +162,7 @@ private:
|
|||
};
|
||||
DragAction _dragAction;
|
||||
QPoint _dragStartPos, _dragPos;
|
||||
MsgId _dragItem;
|
||||
MsgId _dragItem, _selectedMsgId;
|
||||
int32 _dragItemIndex;
|
||||
MsgId _mousedItem;
|
||||
int32 _mousedItemIndex;
|
||||
|
@ -210,7 +214,9 @@ public:
|
|||
|
||||
int32 lastWidth() const;
|
||||
int32 lastScrollTop() const;
|
||||
int32 countBestScroll() const;
|
||||
|
||||
void fastShow(bool back = false, int32 lastScrollTop = -1);
|
||||
void animShow(const QPixmap &oldAnimCache, const QPixmap &bgAnimTopBarCache, bool back = false, int32 lastScrollTop = -1);
|
||||
bool animStep(float64 ms);
|
||||
|
||||
|
@ -241,6 +247,7 @@ public slots:
|
|||
void onScroll();
|
||||
|
||||
void onScrollTimer();
|
||||
void onPlayerSongChanged(MsgId msgId);
|
||||
|
||||
void onForwardSelected();
|
||||
void onDeleteSelected();
|
||||
|
|
|
@ -545,4 +545,8 @@ void PlayerWidget::updateState(SongMsgId playing, AudioPlayerState playingState,
|
|||
startPlay(o->at(_index + 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (songChanged) {
|
||||
emit playerSongChanged(_song.msgId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,10 @@ public:
|
|||
|
||||
bool seekingSong(const SongMsgId &song) const;
|
||||
|
||||
signals:
|
||||
|
||||
void playerSongChanged(MsgId msgId);
|
||||
|
||||
private:
|
||||
|
||||
enum OverState {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.8.36</string>
|
||||
<string>0.8.37</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
|
|
Binary file not shown.
|
@ -1701,7 +1701,7 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.36;
|
||||
CURRENT_PROJECT_VERSION = 0.8.37;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
|
@ -1719,7 +1719,7 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 0.8.36;
|
||||
CURRENT_PROJECT_VERSION = 0.8.37;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = fast;
|
||||
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
|
||||
|
@ -1745,10 +1745,10 @@
|
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.36;
|
||||
CURRENT_PROJECT_VERSION = 0.8.37;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DYLIB_COMPATIBILITY_VERSION = 0.8;
|
||||
DYLIB_CURRENT_VERSION = 0.8.36;
|
||||
DYLIB_CURRENT_VERSION = 0.8.37;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
|
@ -1888,10 +1888,10 @@
|
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 0.8.36;
|
||||
CURRENT_PROJECT_VERSION = 0.8.37;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DYLIB_COMPATIBILITY_VERSION = 0.8;
|
||||
DYLIB_CURRENT_VERSION = 0.8.36;
|
||||
DYLIB_CURRENT_VERSION = 0.8.37;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
echo 0.8 8036 0.8.36 0
|
||||
echo 0.8 8037 0.8.37 1
|
||||
# AppVersionStrMajor AppVersion AppVersionStr DevChannel
|
||||
|
|
Loading…
Reference in New Issue