mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-21 02:41:34 +00:00
Limit video messages size.
This commit is contained in:
parent
885e7f0471
commit
91a6af71a0
Telegram
Resources
SourceFiles
@ -243,12 +243,6 @@ dragPadding: margins(20px, 10px, 20px, 10px);
|
||||
|
||||
dragHeight: 72px;
|
||||
|
||||
minPhotoSize: 100px;
|
||||
maxMediaSize: 430px;
|
||||
maxStickerSize: 256px;
|
||||
maxGifSize: 320px;
|
||||
maxSignatureSize: 144px;
|
||||
|
||||
radialSize: size(50px, 50px);
|
||||
radialLine: 3px;
|
||||
radialDuration: 350;
|
||||
|
@ -9,6 +9,13 @@ using "basic.style";
|
||||
using "dialogs/dialogs.style";
|
||||
using "ui/widgets/widgets.style";
|
||||
|
||||
minPhotoSize: 100px;
|
||||
maxMediaSize: 430px;
|
||||
maxStickerSize: 256px;
|
||||
maxGifSize: 320px;
|
||||
maxVideoMessageSize: 240px;
|
||||
maxSignatureSize: 144px;
|
||||
|
||||
historyMinimalWidth: 380px;
|
||||
|
||||
historyScroll: ScrollArea(defaultScrollArea) {
|
||||
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/view/history_view_cursor_state.h"
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "styles/style_history.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -2030,13 +2030,16 @@ QSize HistoryGif::countOptimalSize() {
|
||||
th = ConvertScale(_data->thumb->height());
|
||||
}
|
||||
}
|
||||
if (tw > st::maxGifSize) {
|
||||
th = (st::maxGifSize * th) / tw;
|
||||
tw = st::maxGifSize;
|
||||
const auto maxSize = _data->isVideoMessage()
|
||||
? st::maxVideoMessageSize
|
||||
: st::maxGifSize;
|
||||
if (tw > maxSize) {
|
||||
th = (maxSize * th) / tw;
|
||||
tw = maxSize;
|
||||
}
|
||||
if (th > st::maxGifSize) {
|
||||
tw = (st::maxGifSize * tw) / th;
|
||||
th = st::maxGifSize;
|
||||
if (th > maxSize) {
|
||||
tw = (maxSize * tw) / th;
|
||||
th = maxSize;
|
||||
}
|
||||
if (!tw || !th) {
|
||||
tw = th = 1;
|
||||
@ -2085,13 +2088,16 @@ QSize HistoryGif::countCurrentSize(int newWidth) {
|
||||
th = ConvertScale(_data->thumb->height());
|
||||
}
|
||||
}
|
||||
if (tw > st::maxGifSize) {
|
||||
th = (st::maxGifSize * th) / tw;
|
||||
tw = st::maxGifSize;
|
||||
const auto maxSize = _data->isVideoMessage()
|
||||
? st::maxVideoMessageSize
|
||||
: st::maxGifSize;
|
||||
if (tw > maxSize) {
|
||||
th = (maxSize * th) / tw;
|
||||
tw = maxSize;
|
||||
}
|
||||
if (th > st::maxGifSize) {
|
||||
tw = (st::maxGifSize * tw) / th;
|
||||
th = st::maxGifSize;
|
||||
if (th > maxSize) {
|
||||
tw = (maxSize * tw) / th;
|
||||
th = maxSize;
|
||||
}
|
||||
if (!tw || !th) {
|
||||
tw = th = 1;
|
||||
|
@ -386,7 +386,7 @@ Video::Video(
|
||||
}
|
||||
|
||||
void Video::initDimensions() {
|
||||
_maxw = 2 * st::minPhotoSize;
|
||||
_maxw = 2 * st::overviewPhotoMinSize;
|
||||
_minh = _maxw;
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "mainwindow.h"
|
||||
#include "mainwidget.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_widgets.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/emoji_config.h"
|
||||
@ -26,6 +23,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "auth_session.h"
|
||||
#include "chat_helpers/stickers.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_widgets.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
#include "styles/style_history.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user