2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 23:25:15 +00:00

Merge remote-tracking branch 'tdesktop/dev' into dev

This commit is contained in:
RadRussianRus
2020-03-17 23:41:32 +03:00
16 changed files with 112 additions and 62 deletions

View File

@@ -21,6 +21,7 @@ jobs:
matrix: matrix:
defines: defines:
- "" - ""
- "DESKTOP_APP_DISABLE_DBUS_INTEGRATION"
env: env:
GIT: "https://github.com" GIT: "https://github.com"

View File

@@ -9,7 +9,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop" <Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE" ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A" Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="1.9.20.0" /> Version="1.9.21.0" />
<Properties> <Properties>
<DisplayName>Telegram Desktop</DisplayName> <DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram FZ-LLC</PublisherDisplayName> <PublisherDisplayName>Telegram FZ-LLC</PublisherDisplayName>

View File

@@ -442,6 +442,7 @@ void GifsListWidget::processPanelHideFinished() {
if (const auto result = item->getResult()) { if (const auto result = item->getResult()) {
result->unload(); result->unload();
} }
item->unloadAnimation();
}; };
// Preserve panel state through visibility toggles. // Preserve panel state through visibility toggles.
//clearInlineRows(false); //clearInlineRows(false);

View File

@@ -247,7 +247,6 @@ void Launcher::init() {
prepareSettings(); prepareSettings();
QApplication::setApplicationName(qsl("KotatogramDesktop")); QApplication::setApplicationName(qsl("KotatogramDesktop"));
QApplication::setApplicationDisplayName(AppName.utf16());
#if defined(Q_OS_LINUX) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if defined(Q_OS_LINUX) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
QApplication::setDesktopFileName(Platform::GetLauncherFilename()); QApplication::setDesktopFileName(Platform::GetLauncherFilename());

View File

@@ -22,9 +22,9 @@ constexpr auto AppId = "{C4A4AE8F-B9F7-4CC7-8A6C-BF7EEE87ACA5}"_cs;
constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs; constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs;
constexpr auto AppName = "Kotatogram Desktop"_cs; constexpr auto AppName = "Kotatogram Desktop"_cs;
constexpr auto AppFile = "Kotatogram"_cs; constexpr auto AppFile = "Kotatogram"_cs;
constexpr auto AppVersion = 1009020; constexpr auto AppVersion = 1009021;
constexpr auto AppVersionStr = "1.9.20"; constexpr auto AppVersionStr = "1.9.21";
constexpr auto AppBetaVersion = true; constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
constexpr auto AppKotatoVersion = 1001009; constexpr auto AppKotatoVersion = 1001009;
constexpr auto AppKotatoVersionStr = "1.1.9"; constexpr auto AppKotatoVersionStr = "1.1.9";

View File

@@ -357,6 +357,11 @@ void Gif::radialAnimationCallback(crl::time now) const {
} }
} }
void Gif::unloadAnimation() {
_gif.reset();
getShownDocument()->unload();
}
void Gif::clipCallback(Media::Clip::Notification notification) { void Gif::clipCallback(Media::Clip::Notification notification) {
using namespace Media::Clip; using namespace Media::Clip;
switch (notification) { switch (notification) {
@@ -370,8 +375,7 @@ void Gif::clipCallback(Media::Clip::Notification notification) {
auto frame = countFrameSize(); auto frame = countFrameSize();
_gif->start(frame.width(), frame.height(), _width, height, ImageRoundRadius::None, RectPart::None); _gif->start(frame.width(), frame.height(), _width, height, ImageRoundRadius::None, RectPart::None);
} else if (_gif->autoPausedGif() && !context()->inlineItemVisible(this)) { } else if (_gif->autoPausedGif() && !context()->inlineItemVisible(this)) {
_gif.reset(); unloadAnimation();
getShownDocument()->unload();
} }
} }
@@ -1429,6 +1433,11 @@ void Game::radialAnimationCallback(crl::time now) const {
} }
} }
void Game::unloadAnimation() {
_gif.reset();
getResultDocument()->unload();
}
void Game::clipCallback(Media::Clip::Notification notification) { void Game::clipCallback(Media::Clip::Notification notification) {
using namespace Media::Clip; using namespace Media::Clip;
switch (notification) { switch (notification) {
@@ -1440,8 +1449,7 @@ void Game::clipCallback(Media::Clip::Notification notification) {
} else if (_gif->ready() && !_gif->started()) { } else if (_gif->ready() && !_gif->started()) {
_gif->start(_frameSize.width(), _frameSize.height(), st::inlineThumbSize, st::inlineThumbSize, ImageRoundRadius::None, RectPart::None); _gif->start(_frameSize.width(), _frameSize.height(), st::inlineThumbSize, st::inlineThumbSize, ImageRoundRadius::None, RectPart::None);
} else if (_gif->autoPausedGif() && !context()->inlineItemVisible(this)) { } else if (_gif->autoPausedGif() && !context()->inlineItemVisible(this)) {
_gif.reset(); unloadAnimation();
getResultDocument()->unload();
} }
} }

View File

@@ -75,6 +75,8 @@ public:
int resizeGetHeight(int width) override; int resizeGetHeight(int width) override;
void unloadAnimation() override;
private: private:
QSize countFrameSize() const; QSize countFrameSize() const;
@@ -370,6 +372,8 @@ public:
QPoint point, QPoint point,
StateRequest request) const override; StateRequest request) const override;
void unloadAnimation() override;
private: private:
void countFrameSize(); void countFrameSize();

View File

@@ -80,6 +80,8 @@ public:
PhotoData *getPreviewPhoto() const; PhotoData *getPreviewPhoto() const;
virtual void preload() const; virtual void preload() const;
virtual void unloadAnimation() {
}
void update() const; void update() const;
void layoutChanged(); void layoutChanged();

View File

@@ -304,6 +304,7 @@ void Inner::hideFinish(bool completely) {
if (const auto result = item->getResult()) { if (const auto result = item->getResult()) {
result->unload(); result->unload();
} }
item->unloadAnimation();
}; };
clearInlineRows(false); clearInlineRows(false);
for (const auto &[result, layout] : _inlineLayouts) { for (const auto &[result, layout] : _inlineLayouts) {

View File

@@ -186,8 +186,7 @@ QIcon TrayIconGen(int counter, bool muted) {
.pixmap(desiredSize) .pixmap(desiredSize)
.toImage(); .toImage();
} else { } else {
const auto availableSizes = systemIcon const auto availableSizes = systemIcon.availableSizes();
.availableSizes();
const auto biggestSize = ranges::max_element( const auto biggestSize = ranges::max_element(
availableSizes, availableSizes,
@@ -282,12 +281,33 @@ std::unique_ptr<QTemporaryFile> TrayIconFile(
static const auto templateName = AppRuntimeDirectory() static const auto templateName = AppRuntimeDirectory()
+ kTrayIconFilename.utf16(); + kTrayIconFilename.utf16();
const auto desiredSize = QSize(size, size);
auto ret = std::make_unique<QTemporaryFile>( auto ret = std::make_unique<QTemporaryFile>(
templateName, templateName,
parent); parent);
ret->open(); ret->open();
icon.pixmap(size).save(ret.get());
if (icon.actualSize(desiredSize) == desiredSize) {
icon.pixmap(desiredSize).save(ret.get());
} else {
const auto availableSizes = icon.availableSizes();
const auto biggestSize = ranges::max_element(
availableSizes,
std::less<>(),
&QSize::width);
icon
.pixmap(*biggestSize)
.scaled(
desiredSize,
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation)
.save(ret.get());
}
ret->close(); ret->close();
return ret; return ret;
@@ -422,13 +442,13 @@ void MainWindow::initHook() {
cSetSupportTray(trayAvailable); cSetSupportTray(trayAvailable);
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
auto sniWatcher = new QDBusServiceWatcher( auto sniWatcher = new QDBusServiceWatcher(
kSNIWatcherService.utf16(), kSNIWatcherService.utf16(),
QDBusConnection::sessionBus(), QDBusConnection::sessionBus(),
QDBusServiceWatcher::WatchForOwnerChange, QDBusServiceWatcher::WatchForOwnerChange,
this); this);
connect( connect(
sniWatcher, sniWatcher,
&QDBusServiceWatcher::serviceOwnerChanged, &QDBusServiceWatcher::serviceOwnerChanged,
this, this,
@@ -473,7 +493,7 @@ void MainWindow::setSNITrayIcon(int counter, bool muted, bool firstShow) {
const auto iconName = GetTrayIconName(counter, muted); const auto iconName = GetTrayIconName(counter, muted);
if (qEnvironmentVariableIsSet(kDisableTrayCounter.utf8()) if (qEnvironmentVariableIsSet(kDisableTrayCounter.utf8())
&& (!iconName.isEmpty() && ((!iconName.isEmpty() && !InSnap())
|| qEnvironmentVariableIsSet(kForcePanelIcon.utf8()))) { || qEnvironmentVariableIsSet(kForcePanelIcon.utf8()))) {
if (_sniTrayIcon->iconName() == iconName) { if (_sniTrayIcon->iconName() == iconName) {
return; return;

View File

@@ -115,7 +115,7 @@ bool Inhibited() {
const QDBusReply<QVariant> reply = QDBusConnection::sessionBus().call( const QDBusReply<QVariant> reply = QDBusConnection::sessionBus().call(
message); message);
constexpr auto notSupportedErrors = { const auto notSupportedErrors = {
QDBusError::ServiceUnknown, QDBusError::ServiceUnknown,
QDBusError::InvalidArgs, QDBusError::InvalidArgs,
}; };

View File

@@ -280,8 +280,16 @@ QString AppRuntimeDirectory() {
QStandardPaths::RuntimeLocation); QStandardPaths::RuntimeLocation);
if (InSandbox()) { if (InSandbox()) {
const auto flatpakId = [&] {
if (!qEnvironmentVariableIsEmpty("FLATPAK_ID")) {
return QString::fromLatin1(qgetenv("FLATPAK_ID"));
} else {
return GetLauncherBasename();
}
}();
runtimeDir += qsl("/app/") runtimeDir += qsl("/app/")
+ QString::fromLatin1(qgetenv("FLATPAK_ID")); + flatpakId;
} }
if (!QFileInfo::exists(runtimeDir)) { // non-systemd distros if (!QFileInfo::exists(runtimeDir)) { // non-systemd distros
@@ -374,7 +382,7 @@ std::optional<crl::time> LastUserInputTime() {
const QDBusReply<uint> reply = QDBusConnection::sessionBus().call( const QDBusReply<uint> reply = QDBusConnection::sessionBus().call(
message); message);
constexpr auto notSupportedErrors = { const auto notSupportedErrors = {
QDBusError::ServiceUnknown, QDBusError::ServiceUnknown,
QDBusError::NotSupported, QDBusError::NotSupported,
}; };

View File

@@ -27,8 +27,8 @@
#include "statusnotifieritem.h" #include "statusnotifieritem.h"
#include "statusnotifieritemadaptor.h" #include "statusnotifieritemadaptor.h"
#include <QDBusInterface>
#include <QDBusServiceWatcher> #include <QDBusServiceWatcher>
#include <QDBusMessage>
#include <dbusmenuexporter.h> #include <dbusmenuexporter.h>
int StatusNotifierItem::mServiceCounter = 0; int StatusNotifierItem::mServiceCounter = 0;
@@ -75,11 +75,16 @@ StatusNotifierItem::~StatusNotifierItem()
void StatusNotifierItem::registerToHost() void StatusNotifierItem::registerToHost()
{ {
QDBusInterface interface(QLatin1String("org.kde.StatusNotifierWatcher"), QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.kde.StatusNotifierWatcher"),
QLatin1String("/StatusNotifierWatcher"), QLatin1String("/StatusNotifierWatcher"),
QLatin1String("org.kde.StatusNotifierWatcher"), QLatin1String("org.kde.StatusNotifierWatcher"),
mSessionBus); QLatin1String("RegisterStatusNotifierItem"));
interface.asyncCall(QLatin1String("RegisterStatusNotifierItem"), mSessionBus.baseService());
message.setArguments({
mSessionBus.baseService()
});
mSessionBus.send(message);
} }
void StatusNotifierItem::onServiceOwnerChanged(const QString& service, const QString& oldOwner, void StatusNotifierItem::onServiceOwnerChanged(const QString& service, const QString& oldOwner,
@@ -292,10 +297,23 @@ void StatusNotifierItem::Scroll(int delta, const QString &orientation)
void StatusNotifierItem::showMessage(const QString& title, const QString& msg, void StatusNotifierItem::showMessage(const QString& title, const QString& msg,
const QString& iconName, int secs) const QString& iconName, int secs)
{ {
QDBusInterface interface(QLatin1String("org.freedesktop.Notifications"), QLatin1String("/org/freedesktop/Notifications"), QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.Notifications"),
QLatin1String("org.freedesktop.Notifications"), mSessionBus); QLatin1String("/org/freedesktop/Notifications"),
interface.call(QLatin1String("Notify"), mTitle, (uint) 0, iconName, title, QLatin1String("org.freedesktop.Notifications"),
msg, QStringList(), QVariantMap(), secs); QLatin1String("Notify"));
message.setArguments({
mTitle,
(uint) 0,
iconName,
title,
msg,
QStringList(),
QVariantMap(),
secs
});
mSessionBus.send(message);
} }
IconPixmapList StatusNotifierItem::iconToPixmapList(const QIcon& icon) IconPixmapList StatusNotifierItem::iconToPixmapList(const QIcon& icon)

View File

@@ -1,7 +1,7 @@
AppVersion 1009020 AppVersion 1009021
AppVersionStrMajor 1.9 AppVersionStrMajor 1.9
AppVersionStrSmall 1.9.20 AppVersionStrSmall 1.9.21
AppVersionStr 1.9.20 AppVersionStr 1.9.21
BetaChannel 1 BetaChannel 0
AlphaVersion 0 AlphaVersion 0
AppVersionOriginal 1.9.20.beta AppVersionOriginal 1.9.21

View File

@@ -1,3 +1,8 @@
1.9.21 (16.03.20)
- Mark new messages as read while scrolling down through them.
- Improved spellchecking on Windows 7 and Linux.
1.9.20 beta (14.03.20) 1.9.20 beta (14.03.20)
- Fix crash in shared links search. - Fix crash in shared links search.

View File

@@ -118,6 +118,10 @@ parts:
snapcraftctl set-version "$version" snapcraftctl set-version "$version"
sed -i 's|^Icon=.*|Icon=/share/icons/hicolor/512x512/apps/kotatogram.png|g' lib/xdg/kotatogramdesktop.desktop sed -i 's|^Icon=.*|Icon=/share/icons/hicolor/512x512/apps/kotatogram.png|g' lib/xdg/kotatogramdesktop.desktop
override-build: |
snapcraftctl build
mkdir -p "$SNAPCRAFT_PART_INSTALL/etc/fonts"
cp "$SNAPCRAFT_PART_SRC/Telegram/lib_ui/qt_conf/fc-custom.conf" "$SNAPCRAFT_PART_INSTALL/etc/fonts/fonts.conf"
after: after:
- cmake - cmake
- desktop-qt5 - desktop-qt5
@@ -155,11 +159,13 @@ parts:
- locales-all - locales-all
- xdg-user-dirs - xdg-user-dirs
- fcitx-frontend-qt5 - fcitx-frontend-qt5
stage: [-etc/fonts/fonts.conf]
qt5-gtk-platform: qt5-gtk-platform:
plugin: nil plugin: nil
stage-packages: stage-packages:
- qt5-gtk-platformtheme - qt5-gtk-platformtheme
stage: [-etc/fonts/fonts.conf]
cmake: cmake:
source: "https://gitlab.kitware.com/cmake/cmake.git" source: "https://gitlab.kitware.com/cmake/cmake.git"
@@ -191,59 +197,37 @@ parts:
source-branch: release/4.2 source-branch: release/4.2
plugin: autotools plugin: autotools
build-packages: build-packages:
- libtool
- pkg-config
- texi2html
- yasm - yasm
- libass-dev - libasound2-dev
- libfreetype6-dev
- libgpac-dev
- liblzma-dev
- libopus-dev - libopus-dev
- libsdl1.2-dev
- libtheora-dev
- libva-dev - libva-dev
- libvdpau-dev - libvdpau-dev
- libvorbis-dev
- libxcb1-dev
- libxcb-shm0-dev
- libxcb-xfixes0-dev
- zlib1g-dev
stage-packages: stage-packages:
- freeglut3 - libasound2
- libass9
- libfreetype6
- libgpac4
- liblzma5
- libopus0 - libopus0
- libslang2
- libsdl1.2debian
- libtheora0
- libva2 - libva2
- libva-drm2 - libva-drm2
- libvdpau1 - libvdpau1
- libvorbis0a
- libxcb1
- libxcb-shm0
- libxcb-xfixes0
- zlib1g
configflags: configflags:
- --prefix=/usr - --prefix=/usr
- --disable-debug - --disable-debug
- --disable-programs - --disable-programs
- --disable-doc - --disable-doc
- --disable-autodetect
- --disable-everything - --disable-everything
- --disable-neon - --disable-neon
- --disable-iconv
- --enable-gpl - --enable-gpl
- --enable-version3 - --enable-version3
- --enable-libopus - --enable-libopus
- --enable-vaapi
- --enable-vdpau
- --enable-decoder=aac - --enable-decoder=aac
- --enable-decoder=aac_latm - --enable-decoder=aac_latm
- --enable-decoder=aasc - --enable-decoder=aasc
- --enable-decoder=flac - --enable-decoder=flac
- --enable-decoder=gif - --enable-decoder=gif
- --enable-decoder=h264 - --enable-decoder=h264
- --enable-decoder=h264_vdpau
- --enable-decoder=mp1 - --enable-decoder=mp1
- --enable-decoder=mp1float - --enable-decoder=mp1float
- --enable-decoder=mp2 - --enable-decoder=mp2
@@ -255,7 +239,6 @@ parts:
- --enable-decoder=mp3on4 - --enable-decoder=mp3on4
- --enable-decoder=mp3on4float - --enable-decoder=mp3on4float
- --enable-decoder=mpeg4 - --enable-decoder=mpeg4
- --enable-decoder=mpeg4_vdpau
- --enable-decoder=msmpeg4v2 - --enable-decoder=msmpeg4v2
- --enable-decoder=msmpeg4v3 - --enable-decoder=msmpeg4v3
- --enable-decoder=opus - --enable-decoder=opus