2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +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:
defines:
- ""
- "DESKTOP_APP_DISABLE_DBUS_INTEGRATION"
env:
GIT: "https://github.com"

View File

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

View File

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

View File

@@ -247,7 +247,6 @@ void Launcher::init() {
prepareSettings();
QApplication::setApplicationName(qsl("KotatogramDesktop"));
QApplication::setApplicationDisplayName(AppName.utf16());
#if defined(Q_OS_LINUX) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
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 AppName = "Kotatogram Desktop"_cs;
constexpr auto AppFile = "Kotatogram"_cs;
constexpr auto AppVersion = 1009020;
constexpr auto AppVersionStr = "1.9.20";
constexpr auto AppBetaVersion = true;
constexpr auto AppVersion = 1009021;
constexpr auto AppVersionStr = "1.9.21";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
constexpr auto AppKotatoVersion = 1001009;
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) {
using namespace Media::Clip;
switch (notification) {
@@ -370,8 +375,7 @@ void Gif::clipCallback(Media::Clip::Notification notification) {
auto frame = countFrameSize();
_gif->start(frame.width(), frame.height(), _width, height, ImageRoundRadius::None, RectPart::None);
} else if (_gif->autoPausedGif() && !context()->inlineItemVisible(this)) {
_gif.reset();
getShownDocument()->unload();
unloadAnimation();
}
}
@@ -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) {
using namespace Media::Clip;
switch (notification) {
@@ -1440,8 +1449,7 @@ void Game::clipCallback(Media::Clip::Notification notification) {
} else if (_gif->ready() && !_gif->started()) {
_gif->start(_frameSize.width(), _frameSize.height(), st::inlineThumbSize, st::inlineThumbSize, ImageRoundRadius::None, RectPart::None);
} else if (_gif->autoPausedGif() && !context()->inlineItemVisible(this)) {
_gif.reset();
getResultDocument()->unload();
unloadAnimation();
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
AppVersion 1009020
AppVersion 1009021
AppVersionStrMajor 1.9
AppVersionStrSmall 1.9.20
AppVersionStr 1.9.20
BetaChannel 1
AppVersionStrSmall 1.9.21
AppVersionStr 1.9.21
BetaChannel 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)
- Fix crash in shared links search.

View File

@@ -118,6 +118,10 @@ parts:
snapcraftctl set-version "$version"
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:
- cmake
- desktop-qt5
@@ -155,11 +159,13 @@ parts:
- locales-all
- xdg-user-dirs
- fcitx-frontend-qt5
stage: [-etc/fonts/fonts.conf]
qt5-gtk-platform:
plugin: nil
stage-packages:
- qt5-gtk-platformtheme
stage: [-etc/fonts/fonts.conf]
cmake:
source: "https://gitlab.kitware.com/cmake/cmake.git"
@@ -191,59 +197,37 @@ parts:
source-branch: release/4.2
plugin: autotools
build-packages:
- libtool
- pkg-config
- texi2html
- yasm
- libass-dev
- libfreetype6-dev
- libgpac-dev
- liblzma-dev
- libasound2-dev
- libopus-dev
- libsdl1.2-dev
- libtheora-dev
- libva-dev
- libvdpau-dev
- libvorbis-dev
- libxcb1-dev
- libxcb-shm0-dev
- libxcb-xfixes0-dev
- zlib1g-dev
stage-packages:
- freeglut3
- libass9
- libfreetype6
- libgpac4
- liblzma5
- libasound2
- libopus0
- libslang2
- libsdl1.2debian
- libtheora0
- libva2
- libva-drm2
- libvdpau1
- libvorbis0a
- libxcb1
- libxcb-shm0
- libxcb-xfixes0
- zlib1g
configflags:
- --prefix=/usr
- --disable-debug
- --disable-programs
- --disable-doc
- --disable-autodetect
- --disable-everything
- --disable-neon
- --disable-iconv
- --enable-gpl
- --enable-version3
- --enable-libopus
- --enable-vaapi
- --enable-vdpau
- --enable-decoder=aac
- --enable-decoder=aac_latm
- --enable-decoder=aasc
- --enable-decoder=flac
- --enable-decoder=gif
- --enable-decoder=h264
- --enable-decoder=h264_vdpau
- --enable-decoder=mp1
- --enable-decoder=mp1float
- --enable-decoder=mp2
@@ -255,7 +239,6 @@ parts:
- --enable-decoder=mp3on4
- --enable-decoder=mp3on4float
- --enable-decoder=mpeg4
- --enable-decoder=mpeg4_vdpau
- --enable-decoder=msmpeg4v2
- --enable-decoder=msmpeg4v3
- --enable-decoder=opus