From b6c452d59d04a1969495bb0cee79fd1da2c54061 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 8 Jun 2023 10:31:17 +0200 Subject: [PATCH] Terminal: Clean up settings Qt Creator <= 10 accidentally wrote the default terminal into the settings on macOS instead of leaving the values empty. So the change from "openTerminal.py" to just "Terminal.app" might not be correctly reflected in the settings. Make sure that the terminal setting is removed in all cases, if it is set to the default. Amends f003234510b924bf1c901843263fbbb69992f5e9 Change-Id: I9d099999f55b4003ac6e7f4a4b679b893eaffc90 Reviewed-by: Marcus Tillmanns --- src/libs/utils/terminalcommand.cpp | 2 ++ src/plugins/coreplugin/mainwindow.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/libs/utils/terminalcommand.cpp b/src/libs/utils/terminalcommand.cpp index 923b0cd4fe2..bb1492515f3 100644 --- a/src/libs/utils/terminalcommand.cpp +++ b/src/libs/utils/terminalcommand.cpp @@ -114,6 +114,8 @@ TerminalCommand TerminalCommand::terminalEmulator() if (s_settings && HostOsInfo::isAnyUnixHost() && s_settings->contains(kTerminalCommandKey)) { FilePath command = FilePath::fromSettings(s_settings->value(kTerminalCommandKey)); + // TODO Remove some time after Qt Creator 11 + // Work around Qt Creator <= 10 writing the default terminal to the settings. if (HostOsInfo::isMacHost() && command.endsWith("openTerminal.py")) command = FilePath::fromString("Terminal.app"); diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 2d7ec70c8eb..c93710ff580 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -63,6 +63,7 @@ #include #include #include +#include #include #include @@ -1228,6 +1229,14 @@ void MainWindow::saveSettings() EditorManagerPrivate::saveSettings(); m_leftNavigationWidget->saveSettings(settings); m_rightNavigationWidget->saveSettings(settings); + + // TODO Remove some time after Qt Creator 11 + // Work around Qt Creator <= 10 writing the default terminal to the settings. + // TerminalCommand writes the terminal to the settings when changing it, which usually is + // enough. But because of the bug in Qt Creator <= 10 we want to clean up the settings + // even if the user never touched the terminal setting. + if (HostOsInfo::isMacHost()) + TerminalCommand::setTerminalEmulator(TerminalCommand::terminalEmulator()); } void MainWindow::saveWindowSettings()