Playing game state is set for 10 seconds instead of 30.
Also moved some icons from sprite to separate b&w files.
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 93 KiB |
@ -1837,12 +1837,6 @@ mvControlMargin: 0px;
|
||||
mvControlSize: 90px;
|
||||
mvIconSize: size(60px, 56px);
|
||||
|
||||
mvLeft: sprite(320px, 445px, 12px, 22px);
|
||||
mvRight: sprite(332px, 445px, 12px, 22px);
|
||||
mvClose: sprite(344px, 445px, 18px, 18px);
|
||||
mvSave: sprite(362px, 445px, 14px, 19px);
|
||||
mvMore: sprite(376px, 445px, 5px, 21px);
|
||||
|
||||
mvDropdown: dropdown(dropdownDef) {
|
||||
shadow: sprite(0px, 0px, 0px, 0px);
|
||||
padding: margins(11px, 12px, 11px, 12px);
|
||||
@ -1904,10 +1898,6 @@ mvDocExtFont: font(semibold 18px);
|
||||
mvDocExtColor: white;
|
||||
mvDocExtPadding: 10px;
|
||||
mvDocLinksTop: 57px;
|
||||
mvDocRed: sprite(0px, 400px, 25px, 25px);
|
||||
mvDocYellow: sprite(25px, 400px, 25px, 25px);
|
||||
mvDocGreen: sprite(50px, 400px, 25px, 25px);
|
||||
mvDocBlue: sprite(75px, 400px, 25px, 25px);
|
||||
mvDocIconSize: 80px;
|
||||
|
||||
mvDocLink: linkButton(btnDefLink) {
|
||||
|
BIN
Telegram/Resources/icons/mediaview_close.png
Normal file
After Width: | Height: | Size: 172 B |
BIN
Telegram/Resources/icons/mediaview_close@2x.png
Normal file
After Width: | Height: | Size: 351 B |
BIN
Telegram/Resources/icons/mediaview_download.png
Normal file
After Width: | Height: | Size: 142 B |
BIN
Telegram/Resources/icons/mediaview_download@2x.png
Normal file
After Width: | Height: | Size: 227 B |
BIN
Telegram/Resources/icons/mediaview_file_corner.png
Normal file
After Width: | Height: | Size: 188 B |
BIN
Telegram/Resources/icons/mediaview_file_corner@2x.png
Normal file
After Width: | Height: | Size: 303 B |
BIN
Telegram/Resources/icons/mediaview_more.png
Normal file
After Width: | Height: | Size: 146 B |
BIN
Telegram/Resources/icons/mediaview_more@2x.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
Telegram/Resources/icons/mediaview_next.png
Normal file
After Width: | Height: | Size: 296 B |
BIN
Telegram/Resources/icons/mediaview_next@2x.png
Normal file
After Width: | Height: | Size: 497 B |
BIN
Telegram/Resources/icons/mediaview_previous.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
Telegram/Resources/icons/mediaview_previous@2x.png
Normal file
After Width: | Height: | Size: 496 B |
@ -32,6 +32,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#include "window/top_bar_widget.h"
|
||||
#include "observer_peer.h"
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int kStatusShowClientsideRecordVideo = 6000;
|
||||
constexpr int kStatusShowClientsideUploadVideo = 6000;
|
||||
constexpr int kStatusShowClientsideRecordVoice = 6000;
|
||||
constexpr int kStatusShowClientsideUploadVoice = 6000;
|
||||
constexpr int kStatusShowClientsideUploadPhoto = 6000;
|
||||
constexpr int kStatusShowClientsideUploadFile = 6000;
|
||||
constexpr int kStatusShowClientsideChooseLocation = 6000;
|
||||
constexpr int kStatusShowClientsideChooseContact = 6000;
|
||||
constexpr int kStatusShowClientsidePlayGame = 10000;
|
||||
|
||||
} // namespace
|
||||
|
||||
void historyInit() {
|
||||
historyInitMessages();
|
||||
historyInitMedia();
|
||||
@ -561,18 +575,18 @@ void Histories::regSendAction(History *history, UserData *user, const MTPSendMes
|
||||
uint64 ms = getms();
|
||||
switch (action.type()) {
|
||||
case mtpc_sendMessageTypingAction: history->typing[user] = ms + 6000; break;
|
||||
case mtpc_sendMessageRecordVideoAction: history->sendActions.insert(user, SendAction(SendActionRecordVideo, ms + 6000)); break;
|
||||
case mtpc_sendMessageUploadVideoAction: history->sendActions.insert(user, SendAction(SendActionUploadVideo, ms + 6000, action.c_sendMessageUploadVideoAction().vprogress.v)); break;
|
||||
case mtpc_sendMessageRecordAudioAction: history->sendActions.insert(user, SendAction(SendActionRecordVoice, ms + 6000)); break;
|
||||
case mtpc_sendMessageUploadAudioAction: history->sendActions.insert(user, SendAction(SendActionUploadVoice, ms + 6000, action.c_sendMessageUploadAudioAction().vprogress.v)); break;
|
||||
case mtpc_sendMessageUploadPhotoAction: history->sendActions.insert(user, SendAction(SendActionUploadPhoto, ms + 6000, action.c_sendMessageUploadPhotoAction().vprogress.v)); break;
|
||||
case mtpc_sendMessageUploadDocumentAction: history->sendActions.insert(user, SendAction(SendActionUploadFile, ms + 6000, action.c_sendMessageUploadDocumentAction().vprogress.v)); break;
|
||||
case mtpc_sendMessageGeoLocationAction: history->sendActions.insert(user, SendAction(SendActionChooseLocation, ms + 6000)); break;
|
||||
case mtpc_sendMessageChooseContactAction: history->sendActions.insert(user, SendAction(SendActionChooseContact, ms + 6000)); break;
|
||||
case mtpc_sendMessageRecordVideoAction: history->sendActions.insert(user, SendAction(SendActionRecordVideo, ms + kStatusShowClientsideRecordVideo)); break;
|
||||
case mtpc_sendMessageUploadVideoAction: history->sendActions.insert(user, SendAction(SendActionUploadVideo, ms + kStatusShowClientsideUploadVideo, action.c_sendMessageUploadVideoAction().vprogress.v)); break;
|
||||
case mtpc_sendMessageRecordAudioAction: history->sendActions.insert(user, SendAction(SendActionRecordVoice, ms + kStatusShowClientsideRecordVoice)); break;
|
||||
case mtpc_sendMessageUploadAudioAction: history->sendActions.insert(user, SendAction(SendActionUploadVoice, ms + kStatusShowClientsideUploadVoice, action.c_sendMessageUploadAudioAction().vprogress.v)); break;
|
||||
case mtpc_sendMessageUploadPhotoAction: history->sendActions.insert(user, SendAction(SendActionUploadPhoto, ms + kStatusShowClientsideUploadPhoto, action.c_sendMessageUploadPhotoAction().vprogress.v)); break;
|
||||
case mtpc_sendMessageUploadDocumentAction: history->sendActions.insert(user, SendAction(SendActionUploadFile, ms + kStatusShowClientsideUploadFile, action.c_sendMessageUploadDocumentAction().vprogress.v)); break;
|
||||
case mtpc_sendMessageGeoLocationAction: history->sendActions.insert(user, SendAction(SendActionChooseLocation, ms + kStatusShowClientsideChooseLocation)); break;
|
||||
case mtpc_sendMessageChooseContactAction: history->sendActions.insert(user, SendAction(SendActionChooseContact, ms + kStatusShowClientsideChooseContact)); break;
|
||||
case mtpc_sendMessageGamePlayAction: {
|
||||
auto it = history->sendActions.find(user);
|
||||
if (it == history->sendActions.end() || it->type == SendActionPlayGame || it->until <= ms) {
|
||||
history->sendActions.insert(user, SendAction(SendActionPlayGame, ms + 30000));
|
||||
history->sendActions.insert(user, SendAction(SendActionPlayGame, ms + kStatusShowClientsidePlayGame));
|
||||
}
|
||||
} break;
|
||||
default: return;
|
||||
|
@ -5844,7 +5844,9 @@ void HistoryWidget::botCallbackDone(BotCallbackInfo info, const MTPmessages_BotC
|
||||
if (info.game) {
|
||||
url = appendShareGameScoreUrl(url, info.msgId);
|
||||
BotGameUrlClickHandler(info.bot, url).onClick(Qt::LeftButton);
|
||||
updateSendAction(item->history(), SendActionPlayGame);
|
||||
if (item && (!item->history()->peer->isChannel() || item->history()->peer->isMegagroup())) {
|
||||
updateSendAction(item->history(), SendActionPlayGame);
|
||||
}
|
||||
} else {
|
||||
UrlClickHandler(url).onClick(Qt::LeftButton);
|
||||
}
|
||||
|
@ -68,3 +68,26 @@ mediaviewVolumeIcon: icon {{ "media_volume", mediaviewPlaybackInactive, point(0p
|
||||
mediaviewVolumeOnIcon: icon {{ "media_volume", mediaviewPlaybackActive, point(0px, 0px) }};
|
||||
mediaviewVolumeIconTop: 8px;
|
||||
mediaviewControllerRadius: 25px;
|
||||
|
||||
mediaviewLeft: icon {{ "mediaview_previous", #ffffff }};
|
||||
mediaviewRight: icon {{ "mediaview_next", #ffffff }};
|
||||
mediaviewClose: icon {{ "mediaview_close", #ffffff }};
|
||||
mediaviewSave: icon {{ "mediaview_download", #ffffff }};
|
||||
mediaviewMore: icon {{ "mediaview_more", #ffffff }};
|
||||
|
||||
mediaviewFileRed: icon {
|
||||
{ size(25px, 25px), #ffffff },
|
||||
{ "mediaview_file_corner", #d55959 },
|
||||
};
|
||||
mediaviewFileYellow: icon {
|
||||
{ size(25px, 25px), #ffffff },
|
||||
{ "mediaview_file_corner", #e8a659 },
|
||||
};
|
||||
mediaviewFileGreen: icon {
|
||||
{ size(25px, 25px), #ffffff },
|
||||
{ "mediaview_file_corner", #49a957 },
|
||||
};
|
||||
mediaviewFileBlue: icon {
|
||||
{ size(25px, 25px), #ffffff },
|
||||
{ "mediaview_file_corner", #599dcf },
|
||||
};
|
||||
|
@ -160,11 +160,11 @@ void MediaView::moveToScreen() {
|
||||
|
||||
int32 navSkip = 2 * st::mvControlMargin + st::mvControlSize;
|
||||
_closeNav = myrtlrect(width() - st::mvControlMargin - st::mvControlSize, st::mvControlMargin, st::mvControlSize, st::mvControlSize);
|
||||
_closeNavIcon = centersprite(_closeNav, st::mvClose);
|
||||
_closeNavIcon = centerrect(_closeNav, st::mediaviewClose);
|
||||
_leftNav = myrtlrect(st::mvControlMargin, navSkip, st::mvControlSize, height() - 2 * navSkip);
|
||||
_leftNavIcon = centersprite(_leftNav, st::mvLeft);
|
||||
_leftNavIcon = centerrect(_leftNav, st::mediaviewLeft);
|
||||
_rightNav = myrtlrect(width() - st::mvControlMargin - st::mvControlSize, navSkip, st::mvControlSize, height() - 2 * navSkip);
|
||||
_rightNavIcon = centersprite(_rightNav, st::mvRight);
|
||||
_rightNavIcon = centerrect(_rightNav, st::mediaviewRight);
|
||||
|
||||
_saveMsg.moveTo((width() - _saveMsg.width()) / 2, (height() - _saveMsg.height()) / 2);
|
||||
}
|
||||
@ -327,9 +327,9 @@ void MediaView::updateControls() {
|
||||
|
||||
_saveVisible = ((_photo && _photo->loaded()) || (_doc && (_doc->loaded(DocumentData::FilePathResolveChecked) || (!fileShown() && (_photo || _doc)))));
|
||||
_saveNav = myrtlrect(width() - st::mvIconSize.width() * 2, height() - st::mvIconSize.height(), st::mvIconSize.width(), st::mvIconSize.height());
|
||||
_saveNavIcon = centersprite(_saveNav, st::mvSave);
|
||||
_saveNavIcon = centerrect(_saveNav, st::mediaviewSave);
|
||||
_moreNav = myrtlrect(width() - st::mvIconSize.width(), height() - st::mvIconSize.height(), st::mvIconSize.width(), st::mvIconSize.height());
|
||||
_moreNavIcon = centersprite(_moreNav, st::mvMore);
|
||||
_moreNavIcon = centerrect(_moreNav, st::mediaviewMore);
|
||||
|
||||
QDateTime d, dNow(date(unixtime()));
|
||||
if (_photo) {
|
||||
@ -1235,7 +1235,7 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty
|
||||
if (!_doc || _doc->thumb->isNull()) {
|
||||
int32 colorIndex = documentColorIndex(_doc, _docExt);
|
||||
_docIconColor = documentColor(colorIndex);
|
||||
style::sprite thumbs[] = { st::mvDocBlue, st::mvDocGreen, st::mvDocRed, st::mvDocYellow };
|
||||
const style::icon *(thumbs[]) = { &st::mediaviewFileBlue, &st::mediaviewFileGreen, &st::mediaviewFileRed, &st::mediaviewFileYellow };
|
||||
_docIcon = thumbs[colorIndex];
|
||||
|
||||
int32 extmaxw = (st::mvDocIconSize - st::mvDocExtPadding * 2);
|
||||
@ -1552,7 +1552,7 @@ void MediaView::paintEvent(QPaintEvent *e) {
|
||||
} else {
|
||||
p.setOpacity(st::mvBgOpacity);
|
||||
for (int i = 0, l = region.rectCount(); i < l; ++i) {
|
||||
p.fillRect(rs.at(i), st::mvBgColor->b);
|
||||
p.fillRect(rs.at(i), st::mvBgColor);
|
||||
}
|
||||
p.setCompositionMode(m);
|
||||
}
|
||||
@ -1664,8 +1664,8 @@ void MediaView::paintEvent(QPaintEvent *e) {
|
||||
}
|
||||
if (!_doc || _doc->thumb->isNull()) {
|
||||
p.fillRect(_docIconRect, _docIconColor->b);
|
||||
if ((!_doc || _doc->loaded()) && (!radial || radialOpacity < 1)) {
|
||||
p.drawSprite(_docIconRect.topLeft() + QPoint(rtl() ? 0 : (_docIconRect.width() - _docIcon.pxWidth()), 0), _docIcon);
|
||||
if ((!_doc || _doc->loaded()) && (!radial || radialOpacity < 1) && _docIcon) {
|
||||
_docIcon->paint(p, _docIconRect.x() + (_docIconRect.width() - _docIcon->width()), _docIconRect.y(), width());
|
||||
p.setPen(st::mvDocExtColor->p);
|
||||
p.setFont(st::mvDocExtFont->f);
|
||||
if (!_docExt.isEmpty()) {
|
||||
@ -1697,68 +1697,68 @@ void MediaView::paintEvent(QPaintEvent *e) {
|
||||
if (co > 0) {
|
||||
// left nav bar
|
||||
if (_leftNav.intersects(r) && _leftNavVisible) {
|
||||
float64 o = overLevel(OverLeftNav);
|
||||
auto o = overLevel(OverLeftNav);
|
||||
if (o > 0) {
|
||||
p.setOpacity(o * st::mvControlBgOpacity * co);
|
||||
for (int i = 0, l = region.rectCount(); i < l; ++i) {
|
||||
QRect fill(_leftNav.intersected(rs.at(i)));
|
||||
auto fill = _leftNav.intersected(rs.at(i));
|
||||
if (!fill.isEmpty()) p.fillRect(fill, st::black->b);
|
||||
}
|
||||
}
|
||||
if (_leftNavIcon.intersects(r)) {
|
||||
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co);
|
||||
p.drawSprite(_leftNavIcon.topLeft(), st::mvLeft);
|
||||
st::mediaviewLeft.paintInCenter(p, _leftNavIcon);
|
||||
}
|
||||
}
|
||||
|
||||
// right nav bar
|
||||
if (_rightNav.intersects(r) && _rightNavVisible) {
|
||||
float64 o = overLevel(OverRightNav);
|
||||
auto o = overLevel(OverRightNav);
|
||||
if (o > 0) {
|
||||
p.setOpacity(o * st::mvControlBgOpacity * co);
|
||||
for (int i = 0, l = region.rectCount(); i < l; ++i) {
|
||||
QRect fill(_rightNav.intersected(rs.at(i)));
|
||||
auto fill = _rightNav.intersected(rs.at(i));
|
||||
if (!fill.isEmpty()) p.fillRect(fill, st::black);
|
||||
}
|
||||
}
|
||||
if (_rightNavIcon.intersects(r)) {
|
||||
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co);
|
||||
p.drawSprite(_rightNavIcon.topLeft(), st::mvRight);
|
||||
st::mediaviewRight.paintInCenter(p, _rightNavIcon);
|
||||
}
|
||||
}
|
||||
|
||||
// close button
|
||||
if (_closeNav.intersects(r)) {
|
||||
float64 o = overLevel(OverClose);
|
||||
auto o = overLevel(OverClose);
|
||||
if (o > 0) {
|
||||
p.setOpacity(o * st::mvControlBgOpacity * co);
|
||||
for (int i = 0, l = region.rectCount(); i < l; ++i) {
|
||||
QRect fill(_closeNav.intersected(rs.at(i)));
|
||||
auto fill = _closeNav.intersected(rs.at(i));
|
||||
if (!fill.isEmpty()) p.fillRect(fill, st::black);
|
||||
}
|
||||
}
|
||||
if (_closeNavIcon.intersects(r)) {
|
||||
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co);
|
||||
p.drawSprite(_closeNavIcon.topLeft(), st::mvClose);
|
||||
st::mediaviewClose.paintInCenter(p, _closeNavIcon);
|
||||
}
|
||||
}
|
||||
|
||||
// save button
|
||||
if (_saveVisible && _saveNavIcon.intersects(r)) {
|
||||
float64 o = overLevel(OverSave);
|
||||
auto o = overLevel(OverSave);
|
||||
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co);
|
||||
p.drawSprite(_saveNavIcon.topLeft(), st::mvSave);
|
||||
st::mediaviewSave.paintInCenter(p, _saveNavIcon);
|
||||
}
|
||||
|
||||
// more area
|
||||
if (_moreNavIcon.intersects(r)) {
|
||||
float64 o = overLevel(OverMore);
|
||||
auto o = overLevel(OverMore);
|
||||
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co);
|
||||
p.drawSprite(_moreNavIcon.topLeft(), st::mvMore);
|
||||
st::mediaviewMore.paintInCenter(p, _moreNavIcon);
|
||||
}
|
||||
|
||||
p.setPen(st::white->p);
|
||||
p.setFont(st::mvThickFont->f);
|
||||
p.setPen(st::white);
|
||||
p.setFont(st::mvThickFont);
|
||||
|
||||
// header
|
||||
if (_headerNav.intersects(r)) {
|
||||
|
@ -229,7 +229,7 @@ private:
|
||||
bool gifShown() const;
|
||||
void stopGif();
|
||||
|
||||
style::sprite _docIcon;
|
||||
const style::icon *_docIcon = nullptr;
|
||||
style::color _docIconColor;
|
||||
QString _docName, _docSize, _docExt;
|
||||
int _docNameWidth = 0, _docSizeWidth = 0, _docExtWidth = 0;
|
||||
|
@ -37,6 +37,9 @@ inline QRect rtlrect(const QRect &r, int outerw) {
|
||||
inline QRect centerrect(const QRect &inRect, const QRect &rect) {
|
||||
return QRect(inRect.x() + (inRect.width() - rect.width()) / 2, inRect.y() + (inRect.height() - rect.height()) / 2, rect.width(), rect.height());
|
||||
}
|
||||
inline QRect centerrect(const QRect &inRect, const style::icon &icon) {
|
||||
return centerrect(inRect, QRect(0, 0, icon.width(), icon.height()));
|
||||
}
|
||||
|
||||
namespace style {
|
||||
namespace internal {
|
||||
|