Make terminal settings more flexible

Currently "Open Terminal Here" and such expect the terminal
command without any arguments to be behaving correctly for this.
That is not the case for Konsole at least, since it just opens another
window in a running instance, with the same working directory, when
not convinced to do otherwise with additional command line parameters

Separate options for "Open Terminal Here" and "Run in terminal" in the
options.

Task-number: QTCREATORBUG-20900
Change-Id: I598d1f7f0bf22b5c21dc1c60333397bdf9fab1b4
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Eike Ziller
2018-08-24 10:56:13 +02:00
parent f13a7fc988
commit 4c88c1808c
6 changed files with 379 additions and 269 deletions

View File

@@ -69,14 +69,22 @@ QWidget *SystemSettings::widget()
m_page->reloadBehavior->setCurrentIndex(EditorManager::reloadSetting());
if (HostOsInfo::isAnyUnixHost()) {
const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators();
const QString currentTerminal = ConsoleProcess::terminalEmulator(ICore::settings(), false);
m_page->terminalComboBox->addItems(availableTerminals);
m_page->terminalComboBox->lineEdit()->setText(currentTerminal);
m_page->terminalComboBox->lineEdit()->setPlaceholderText(ConsoleProcess::defaultTerminalEmulator());
const QVector<TerminalCommand> availableTerminals = ConsoleProcess::availableTerminalEmulators();
for (const TerminalCommand &term : availableTerminals)
m_page->terminalComboBox->addItem(term.command, qVariantFromValue(term));
updateTerminalUi(ConsoleProcess::terminalEmulator(ICore::settings()));
connect(m_page->terminalComboBox,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
[this](int index) {
updateTerminalUi(
m_page->terminalComboBox->itemData(index).value<TerminalCommand>());
});
} else {
m_page->terminalLabel->hide();
m_page->terminalComboBox->hide();
m_page->terminalOpenArgs->hide();
m_page->terminalExecuteArgs->hide();
m_page->resetTerminalButton->hide();
}
@@ -156,7 +164,9 @@ void SystemSettings::apply()
EditorManager::setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex()));
if (HostOsInfo::isAnyUnixHost()) {
ConsoleProcess::setTerminalEmulator(ICore::settings(),
m_page->terminalComboBox->lineEdit()->text());
{m_page->terminalComboBox->lineEdit()->text(),
m_page->terminalOpenArgs->text(),
m_page->terminalExecuteArgs->text()});
if (!HostOsInfo::isMacHost()) {
UnixUtils::setFileBrowser(ICore::settings(),
m_page->externalFileBrowserEdit->text());
@@ -193,7 +203,14 @@ void SystemSettings::finish()
void SystemSettings::resetTerminal()
{
if (HostOsInfo::isAnyUnixHost())
m_page->terminalComboBox->lineEdit()->clear();
m_page->terminalComboBox->setCurrentIndex(0);
}
void SystemSettings::updateTerminalUi(const TerminalCommand &term)
{
m_page->terminalComboBox->lineEdit()->setText(term.command);
m_page->terminalOpenArgs->setText(term.openArgs);
m_page->terminalExecuteArgs->setText(term.executeArgs);
}
void SystemSettings::resetFileBrowser()