2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Move icon name getter to cross-platform header

This commit is contained in:
Ilya Fedin
2022-09-19 06:58:27 +04:00
committed by John Preston
parent 5132fd5010
commit d9318c9935
7 changed files with 37 additions and 31 deletions

View File

@@ -60,7 +60,6 @@ namespace Platform {
namespace {
constexpr auto kDesktopFile = ":/misc/telegramdesktop.desktop"_cs;
constexpr auto kIconName = "telegram"_cs;
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
void PortalAutostart(bool start, bool silent) {
@@ -174,18 +173,6 @@ void PortalAutostart(bool start, bool silent) {
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
QString FlatpakID() {
static const auto Result = [] {
if (!qEnvironmentVariableIsEmpty("FLATPAK_ID")) {
return qEnvironmentVariable("FLATPAK_ID");
} else {
return cExeName();
}
}();
return Result;
}
bool GenerateDesktopFile(
const QString &targetPath,
const QString &args,
@@ -271,7 +258,7 @@ QString AppRuntimeDirectory() {
QStandardPaths::RuntimeLocation);
if (KSandbox::isFlatpak()) {
runtimeDir += qsl("/app/") + FlatpakID();
runtimeDir += qsl("/app/") + base::FlatpakID();
}
if (!QFileInfo::exists(runtimeDir)) { // non-systemd distros
@@ -301,13 +288,6 @@ QString SingleInstanceLocalServerName(const QString &hash) {
}
}
QString GetIconName() {
static const auto Result = KSandbox::isFlatpak()
? FlatpakID()
: kIconName.utf16();
return Result;
}
std::optional<bool> IsDarkMode() {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
[[maybe_unused]] static const auto Inited = [] {
@@ -476,7 +456,7 @@ void start() {
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
qputenv("PULSE_PROP_application.name", AppName.utf8());
qputenv("PULSE_PROP_application.icon_name", GetIconName().toLatin1());
qputenv("PULSE_PROP_application.icon_name", base::IconName().toLatin1());
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Glib::init();
@@ -532,7 +512,7 @@ void InstallLauncher(bool force) {
if (!QDir(icons).exists()) QDir().mkpath(icons);
const auto icon = icons + kIconName.utf16() + qsl(".png");
const auto icon = icons + base::IconName() + qsl(".png");
auto iconExists = QFile::exists(icon);
if (Local::oldSettingsVersion() < 2008012 && iconExists) {
// Icon was changed.