Move QGuiApplication::setDesktopFileName call to Platform::start

It depends on Core::UpdaterDisabled that is not initialized in Launcher::initHook yet
This commit is contained in:
Ilya Fedin 2022-09-05 00:15:59 +04:00 committed by John Preston
parent 00ee31ce2d
commit 88f1f8ff22
2 changed files with 20 additions and 19 deletions

View File

@ -64,25 +64,6 @@ int Launcher::exec() {
void Launcher::initHook() {
QApplication::setAttribute(Qt::AA_DisableSessionManager, true);
QApplication::setDesktopFileName([] {
if (!Core::UpdaterDisabled() && !cExeName().isEmpty()) {
const auto appimagePath = qsl("file://%1%2").arg(
cExeDir(),
cExeName()).toUtf8();
char md5Hash[33] = { 0 };
hashMd5Hex(
appimagePath.constData(),
appimagePath.size(),
md5Hash);
return qsl("appimagekit_%1-%2.desktop").arg(
md5Hash,
AppName.utf16().replace(' ', '_'));
}
return qsl(QT_STRINGIFY(TDESKTOP_LAUNCHER_BASENAME) ".desktop");
}());
}
bool Launcher::launchUpdater(UpdaterLaunch action) {

View File

@ -488,6 +488,26 @@ int psFixPrevious() {
namespace Platform {
void start() {
QGuiApplication::setDesktopFileName([] {
if (!Core::UpdaterDisabled() && !cExeName().isEmpty()) {
const auto appimagePath = qsl("file://%1%2").arg(
cExeDir(),
cExeName()).toUtf8();
char md5Hash[33] = { 0 };
hashMd5Hex(
appimagePath.constData(),
appimagePath.size(),
md5Hash);
return qsl("appimagekit_%1-%2.desktop").arg(
md5Hash,
AppName.utf16().replace(' ', '_'));
}
return qsl(QT_STRINGIFY(TDESKTOP_LAUNCHER_BASENAME) ".desktop");
}());
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
qputenv("PULSE_PROP_application.name", AppName.utf8());