merged with optimized gifs scroll

This commit is contained in:
John Preston 2015-12-30 16:41:51 +08:00
commit fa9850c319
10 changed files with 38 additions and 24 deletions

View File

@ -141,7 +141,7 @@ Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu >
PKG_CONFIG_PATH="/mingw64/lib/pkgconfig:$PKG_CONFIG_PATH"
./configure --toolchain=msvc --disable-programs --disable-doc --disable-everything --disable-mmx --enable-libopus --enable-decoder=aac --enable-decoder=aac_latm --enable-decoder=aasc --enable-decoder=flac --enable-decoder=gif --enable-decoder=h264 --enable-decoder=mp1 --enable-decoder=mp1float --enable-decoder=mp2 --enable-decoder=mp2float --enable-decoder=mp3 --enable-decoder=mp3adu --enable-decoder=mp3adufloat --enable-decoder=mp3float --enable-decoder=mp3on4 --enable-decoder=mp3on4float --enable-decoder=mpeg4 --enable-decoder=msmpeg4v2 --enable-decoder=msmpeg4v3 --enable-decoder=wavpack --enable-decoder=opus --enable-decoder=vorbis --enable-decoder=wmalossless --enable-decoder=wmapro --enable-decoder=wmav1 --enable-decoder=wmav2 --enable-decoder=wmavoice --enable-encoder=libopus --enable-hwaccel=h264_d3d11va --enable-hwaccel=h264_dxva2 --enable-parser=aac --enable-parser=aac_latm --enable-parser=flac --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=opus --enable-parser=vorbis --enable-demuxer=aac --enable-demuxer=flac --enable-demuxer=gif --enable-demuxer=h264 --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=ogg --enable-demuxer=wav --enable-muxer=ogg --enable-muxer=opus --extra-ldflags="-libpath:/d/TBuild/Libraries/opus/win32/VS2010/Win32/Release celt.lib silk_common.lib silk_float.lib"
./configure --toolchain=msvc --disable-programs --disable-doc --disable-everything --disable-w32threads --disable-mmx --enable-libopus --enable-decoder=aac --enable-decoder=aac_latm --enable-decoder=aasc --enable-decoder=flac --enable-decoder=gif --enable-decoder=h264 --enable-decoder=mp1 --enable-decoder=mp1float --enable-decoder=mp2 --enable-decoder=mp2float --enable-decoder=mp3 --enable-decoder=mp3adu --enable-decoder=mp3adufloat --enable-decoder=mp3float --enable-decoder=mp3on4 --enable-decoder=mp3on4float --enable-decoder=mpeg4 --enable-decoder=msmpeg4v2 --enable-decoder=msmpeg4v3 --enable-decoder=wavpack --enable-decoder=opus --enable-decoder=vorbis --enable-decoder=wmalossless --enable-decoder=wmapro --enable-decoder=wmav1 --enable-decoder=wmav2 --enable-decoder=wmavoice --enable-encoder=libopus --enable-hwaccel=h264_d3d11va --enable-hwaccel=h264_dxva2 --enable-parser=aac --enable-parser=aac_latm --enable-parser=flac --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=opus --enable-parser=vorbis --enable-demuxer=aac --enable-demuxer=flac --enable-demuxer=gif --enable-demuxer=h264 --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=ogg --enable-demuxer=wav --enable-muxer=ogg --enable-muxer=opus --extra-ldflags="-libpath:/d/TBuild/Libraries/opus/win32/VS2010/Win32/Release celt.lib silk_common.lib silk_float.lib"
make
make install

View File

@ -598,6 +598,8 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
"lng_switch_emoji" = "Emoji";
"lng_saved_gifs" = "Saved GIFs";
"lng_inline_bot_results" = "Results from {inline_bot}";
"lng_inline_bot_no_results" = "No results";
"lng_box_remove" = "Remove";
@ -830,7 +832,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
"lng_new_version_wrap" = "Telegram Desktop was updated to version {version}\n\n{changes}\n\nFull version history is available here:\n{link}";
"lng_new_version_minor" = "— Bug fixes and other minor improvements";
"lng_new_version_text" = "— Sticker management: manually rearrange your sticker packs, pack order is now synced across all your devices\n— Click and hold on a sticker to preview it before sending\n— New context menu for chats in chats list\n— Support for all existing emoji";
"lng_new_version_text" = "GIF revolution: 10x faster sending and downloading, autoplay, save your favorite GIFs to a dedicated tab on the sticker panel.\n\nMore about GIFs:\n{gifs_link}\n\nInline bots: A new way to add bot content to any chat. Type a bot's username and your query in the text field to get instant results and send them to your chat partner. Try typing “@gif dog” in your next chat. Sample bots: @gif, @wiki, @bingpic, @vid.\n\nMore about inline bots:\n{bots_link}\n\nAlso in this release: New cute design for media, automatic download settings for photos, voice messages and GIFs.";
"lng_menu_insert_unicode" = "Insert Unicode control character";

View File

@ -708,7 +708,7 @@ void Application::checkMapVersion() {
if (cDevVersion() && Local::oldMapVersion() < 9014) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Sticker management: manually rearrange your sticker packs, pack order is now synced across all your devices\n\xe2\x80\x94 Click and hold on a sticker to preview it before sending\n\xe2\x80\x94 New context menu for chats in chats list\n\xe2\x80\x94 Support for all existing emoji");// .replace('@', qsl("@") + QChar(0x200D));
} else if (Local::oldMapVersion() < 9015) {
versionFeatures = lang(lng_new_version_text).trimmed();
// versionFeatures = lang(lng_new_version_text).trimmed();
} else {
versionFeatures = lang(lng_new_version_minor).trimmed();
}

View File

@ -1215,6 +1215,7 @@ StickerPanInner::StickerPanInner() : TWidget()
, _top(0)
, _showingSavedGifs(cShowingSavedGifs())
, _showingContextItems(_showingSavedGifs)
, _lastScrolled(0)
, _selected(-1)
, _pressedSel(-1)
, _settings(this, lang(lng_stickers_you_have))
@ -1230,6 +1231,9 @@ StickerPanInner::StickerPanInner() : TWidget()
_previewTimer.setSingleShot(true);
connect(&_previewTimer, SIGNAL(timeout()), this, SLOT(onPreview()));
_updateContextItems.setSingleShot(true);
connect(&_updateContextItems, SIGNAL(timeout()), this, SLOT(onUpdateContextItems()));
}
void StickerPanInner::setMaxHeight(int32 h) {
@ -1241,6 +1245,7 @@ void StickerPanInner::setMaxHeight(int32 h) {
void StickerPanInner::setScrollTop(int top) {
if (top == _top) return;
_lastScrolled = getms();
_top = top;
updateSelected();
}
@ -1778,20 +1783,12 @@ void StickerPanInner::refreshContextRows(const ContextResults &results) {
}
void StickerPanInner::ui_repaintContextItem(const LayoutContextItem *layout) {
int32 position = layout->position();
if (!_showingContextItems || position < 0) return;
int32 row = position / MatrixRowShift, col = position % MatrixRowShift;
t_assert((row < _contextRows.size()) && (col < _contextRows.at(row).items.size()));
const ContextItems &contextItems(_contextRows.at(row).items);
int32 left = st::savedGifsLeft, top = st::emojiPanHeader;
for (int32 i = 0; i < row; ++i) {
top += _contextRows.at(i).height;
uint64 ms = getms();
if (_lastScrolled + 100 <= ms) {
update();
} else {
_updateContextItems.start(_lastScrolled + 100 - ms);
}
for (int32 i = 0; i < col; ++i) left += contextItems.at(i)->width() + st::savedGifsSkip;
rtlupdate(left, top, contextItems.at(col)->width(), contextItems.at(col)->height());
}
bool StickerPanInner::ui_isContextItemVisible(const LayoutContextItem *layout) {
@ -2135,6 +2132,17 @@ void StickerPanInner::onPreview() {
}
}
void StickerPanInner::onUpdateContextItems() {
if (!_showingContextItems) return;
uint64 ms = getms();
if (_lastScrolled + 100 <= ms) {
update();
} else {
_updateContextItems.start(_lastScrolled + 100 - ms);
}
}
void StickerPanInner::step_selected(uint64 ms, bool timer) {
QRegion toUpdate;
for (Animations::iterator i = _animations.begin(); i != _animations.end();) {

View File

@ -395,6 +395,7 @@ public slots:
void updateSelected();
void onSettings();
void onPreview();
void onUpdateContextItems();
signals:
@ -444,6 +445,8 @@ private:
QList<bool> _custom;
bool _showingSavedGifs, _showingContextItems;
uint64 _lastScrolled;
QTimer _updateContextItems;
typedef QList<LayoutContextItem*> ContextItems;
struct ContextRow {

View File

@ -449,6 +449,7 @@ QPixmap imagePix(QImage img, int32 w, int32 h, bool smooth, bool blurred, bool r
}
}
if (rounded) imageRound(img);
img.setDevicePixelRatio(cRetinaFactor());
return QPixmap::fromImage(img, Qt::ColorOnly);
}

View File

@ -474,9 +474,9 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
"lng_failed_add_not_mutual_channel" = "Lo sentimos, si una persona deja el canal, \nsólo un contacto mutuo puede volver \na invitarlo (necesitan tener tu \nnúmero y tú el de ellos).";
"lng_sure_delete_contact" = "¿Quieres eliminar a {contact} de tu lista de contactos?";
"lng_sure_delete_history" = "¿Quieres eliminar todo el historial de mensajes con {contact}?\n\nEsta acción no se puede deshacer.";
"lng_sure_delete_history" = "¿Quieres borrar todo el historial de mensajes con {contact}?\n\nEsta acción no se puede deshacer.";
"lng_sure_delete_group_history" = "¿Quieres borrar todo el historial en «{group}»?\n\nEsta acción no se puede deshacer.";
"lng_sure_delete_and_exit" = "¿Quieres eliminar todo el historial de mensajes y dejar el grupo «{group}»?\n\nEsta acción no se puede deshacer.";
"lng_sure_delete_and_exit" = "¿Quieres borrar todo el historial de mensajes y dejar el grupo «{group}»?\n\nEsta acción no se puede deshacer.";
"lng_sure_leave_channel" = "¿Quieres dejar este canal?";
"lng_sure_delete_channel" = "¿Quieres eliminar este canal? Todos los miembros y mensajes se perderán.";
"lng_sure_leave_group" = "¿Quieres salir del grupo?\nNo puedes deshacer esta acción.";
@ -616,7 +616,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
"lng_broadcast_ph" = "Difunde un mensaje...";
"lng_record_cancel" = "Suelta fuera de aquí para cancelar";
"lng_empty_history" = "";
"lng_willbe_history" = "Por favor, selecciona un chat para comenzar";
"lng_willbe_history" = "Selecciona un chat para comenzar";
"lng_message_with_from" = "[c]{from}:[/c] {message}";
"lng_from_you" = "Tú";
"lng_bot_description" = "¿Qué puede hacer este bot?";
@ -717,7 +717,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
"lng_send_image_too_large" = "No se pudo enviar el archivo, porque es más grande que 1.5 GB :(";
"lng_send_folder" = "No se pudo enviar «{name}», porque es un directorio :(";
"lng_forward_choose" = "Elegir destinatario...";
"lng_forward_choose" = "Elige un destinatario...";
"lng_forward_cant" = "Lo sentimos, no puedes reenviar aquí :(";
"lng_forward_confirm" = "¿Reenviar a {recipient}?";
"lng_forward_share_contact" = "¿Compartir contacto con {recipient}?";

View File

@ -556,7 +556,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
"lng_media_type_links" = "Link condivisi";
"lng_media_open_with" = "Apri con";
"lng_media_download" = "Download";
"lng_media_download" = "Scarica";
"lng_media_cancel" = "Annulla";
"lng_media_video" = "Video";
"lng_media_audio" = "Nota vocale";

View File

@ -342,7 +342,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
"lng_connection_try_ipv6" = "Tentando conexão via IPv6";
"lng_connection_host_ph" = "Nome do host";
"lng_connection_port_ph" = "Porta";
"lng_connection_user_ph" = "Nome de usuário";
"lng_connection_user_ph" = "Usuário";
"lng_connection_password_ph" = "Senha";
"lng_connection_save" = "Salvar";
"lng_settings_show_sessions" = "Exibir todas as sessões";
@ -448,7 +448,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
"lng_create_group_next" = "Próximo";
"lng_create_group_create" = "Criar";
"lng_create_group_title" = "Novo Grupo";
"lng_create_group_about" = "Grupos são ideais para comunidades menores, \neles podem ter até {count:_not_used|# membro|# membros}";
"lng_create_group_about" = "Grupos são ideais para comunidades menores,\ncom até {count:_not_used|# membro|# membros}";
"lng_create_channel_title" = "Novo Canal";
"lng_create_channel_about" = "Canais são uma ferramenta para transmitir suas mensagens para audiências ilimitadas";
"lng_create_public_channel_title" = "Canal Público";

View File

@ -1388,7 +1388,7 @@ void LayoutContextGif::paint(Painter &p, const QRect &clip, uint32 selection, co
if (!_doc->thumb->isNull()) {
if (_doc->thumb->loaded()) {
if (_thumb.width() != _width * cIntRetinaFactor() || _thumb.height() != height * cIntRetinaFactor()) {
const_cast<LayoutContextGif*>(this)->_thumb = _doc->thumb->pixNoCache(frame.width(), frame.height(), true, false, false, _width, height);
const_cast<LayoutContextGif*>(this)->_thumb = _doc->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, _width, height);
}
} else {
_doc->thumb->load();