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