Add a cheat code to install launcher on Linux

This commit is contained in:
Ilya Fedin 2020-11-01 14:55:19 +04:00 committed by John Preston
parent 0881e5b20d
commit 204a08df14
3 changed files with 12 additions and 3 deletions

View File

@ -1129,13 +1129,15 @@ void start() {
void finish() { void finish() {
} }
void InstallLauncher() { void InstallLauncher(bool force) {
static const auto DisabledByEnv = qEnvironmentVariableIsSet( static const auto DisabledByEnv = qEnvironmentVariableIsSet(
"TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION"); "TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION");
// don't update desktop file for alpha version or if updater is disabled // don't update desktop file for alpha version or if updater is disabled
if (cAlphaVersion() || Core::UpdaterDisabled() || DisabledByEnv) if ((cAlphaVersion() || Core::UpdaterDisabled() || DisabledByEnv)
&& !force) {
return; return;
}
const auto applicationsPath = QStandardPaths::writableLocation( const auto applicationsPath = QStandardPaths::writableLocation(
QStandardPaths::ApplicationsLocation) + '/'; QStandardPaths::ApplicationsLocation) + '/';

View File

@ -41,7 +41,7 @@ QString GetIconName();
inline void IgnoreApplicationActivationRightNow() { inline void IgnoreApplicationActivationRightNow() {
} }
void InstallLauncher(); void InstallLauncher(bool force = false);
} // namespace Platform } // namespace Platform

View File

@ -157,6 +157,13 @@ auto GenerateCodes() {
}); });
#endif // Q_OS_WIN || Q_OS_MAC #endif // Q_OS_WIN || Q_OS_MAC
#if defined Q_OS_UNIX && !defined Q_OS_MAC
codes.emplace(qsl("installauncher"), [](SessionController *window) {
Platform::InstallLauncher(true);
Ui::Toast::Show("Forced launcher installation.");
});
#endif // Q_OS_UNIX && !Q_OS_MAC
auto audioFilters = qsl("Audio files (*.wav *.mp3);;") + FileDialog::AllFilesFilter(); auto audioFilters = qsl("Audio files (*.wav *.mp3);;") + FileDialog::AllFilesFilter();
auto audioKeys = { auto audioKeys = {
qsl("msg_incoming"), qsl("msg_incoming"),