summaryrefslogtreecommitdiff
path: root/src/libs/utils/consoleprocess_unix.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-04-09 20:09:10 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-04-14 11:41:23 +0200
commit894ee04ee0618df6684d4fcb0b4eb2aebb9f4a4c (patch)
tree55a42657968fb720a454282222bc022d970c6763 /src/libs/utils/consoleprocess_unix.cpp
parentc8c183f6b4327baf3ba8fa5c28a04fc4777b8082 (diff)
downloadqt-creator-894ee04ee0618df6684d4fcb0b4eb2aebb9f4a4c.tar.gz
make terminal emulator configurable centrally
this includes changing the runInTerminal.command command line. the terminal setting mock from the debugger plugin is gone again.
Diffstat (limited to 'src/libs/utils/consoleprocess_unix.cpp')
-rw-r--r--src/libs/utils/consoleprocess_unix.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp
index 276d6c77f2..a43264b59d 100644
--- a/src/libs/utils/consoleprocess_unix.cpp
+++ b/src/libs/utils/consoleprocess_unix.cpp
@@ -30,6 +30,8 @@
#include "consoleprocess.h"
#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+#include <QtCore/QSettings>
#include <QtCore/QTemporaryFile>
#include <QtNetwork/QLocalSocket>
@@ -48,6 +50,7 @@ ConsoleProcess::ConsoleProcess(QObject *parent)
m_debug = false;
m_appPid = 0;
m_stubSocket = 0;
+ m_settings = 0;
connect(&m_stubServer, SIGNAL(newConnection()), SLOT(stubConnectionAvailable()));
@@ -88,8 +91,8 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
m_tempFile->flush();
}
- QStringList xtermArgs;
- xtermArgs << "-e"
+ QStringList xtermArgs = terminalEmulator(m_settings).split(QLatin1Char(' ')); // FIXME: quoting
+ xtermArgs
#ifdef Q_OS_MAC
<< (QCoreApplication::applicationDirPath() + "/../Resources/qtcreator_process_stub")
#else
@@ -102,10 +105,11 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
<< (m_tempFile ? m_tempFile->fileName() : 0)
<< program << args;
- m_process.start(QLatin1String("xterm"), xtermArgs);
+ QString xterm = xtermArgs.takeFirst();
+ m_process.start(xterm, xtermArgs);
if (!m_process.waitForStarted()) {
stubServerShutdown();
- emit processError(tr("Cannot start console emulator xterm."));
+ emit processError(tr("Cannot start terminal emulator %1.").arg(xterm));
delete m_tempFile;
m_tempFile = 0;
return false;
@@ -232,3 +236,27 @@ void ConsoleProcess::stubExited()
}
emit wrapperStopped();
}
+
+QString ConsoleProcess::defaultTerminalEmulator()
+{
+// FIXME: enable this once runInTerminal works nicely
+#if 0 //def Q_OS_MAC
+ return QDir::cleanPath(QCoreApplication::applicationDirPath()
+ + QLatin1String("/../Resources/runInTerminal.command"));
+#else
+ return QLatin1String("xterm");
+#endif
+}
+
+QString ConsoleProcess::terminalEmulator(const QSettings *settings)
+{
+ QString dflt = defaultTerminalEmulator() + QLatin1String(" -e");
+ if (!settings)
+ return dflt;
+ return settings->value(QLatin1String("General/TerminalEmulator"), dflt).toString();
+}
+
+void ConsoleProcess::setTerminalEmulator(QSettings *settings, const QString &term)
+{
+ return settings->setValue(QLatin1String("General/TerminalEmulator"), term);
+}