diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-08-24 10:56:13 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-09-03 12:29:21 +0000 |
commit | 4c88c1808cddc2f134203e62b276f2f413e455c6 (patch) | |
tree | a249bcf8e618ef6e292ac3ff7dbd05ff1cce37e1 /src/libs/utils/consoleprocess.h | |
parent | f13a7fc988cc88086fd93386fcced533404d81db (diff) |
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>
Diffstat (limited to 'src/libs/utils/consoleprocess.h')
-rw-r--r-- | src/libs/utils/consoleprocess.h | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h index 7c58c55cc69..87ba28e5e31 100644 --- a/src/libs/utils/consoleprocess.h +++ b/src/libs/utils/consoleprocess.h @@ -28,6 +28,7 @@ #include "utils_global.h" #include <QProcess> +#include <QVector> QT_BEGIN_NAMESPACE class QSettings; @@ -37,6 +38,20 @@ namespace Utils { class Environment; struct ConsoleProcessPrivate; +class QTCREATOR_UTILS_EXPORT TerminalCommand +{ +public: + TerminalCommand() = default; + TerminalCommand(const QString &command, const QString &openArgs, const QString &executeArgs); + + bool operator==(const TerminalCommand &other) const; + bool operator<(const TerminalCommand &other) const; + + QString command; + QString openArgs; + QString executeArgs; +}; + class QTCREATOR_UTILS_EXPORT ConsoleProcess : public QObject { Q_OBJECT @@ -88,17 +103,17 @@ public: #ifndef Q_OS_WIN void setSettings(QSettings *settings); - static QString defaultTerminalEmulator(); - static QStringList availableTerminalEmulators(); - static QString terminalEmulator(const QSettings *settings, bool nonEmpty = true); - static void setTerminalEmulator(QSettings *settings, const QString &term); + static TerminalCommand defaultTerminalEmulator(); + static QVector<TerminalCommand> availableTerminalEmulators(); + static TerminalCommand terminalEmulator(const QSettings *settings); + static void setTerminalEmulator(QSettings *settings, const TerminalCommand &term); #else void setSettings(QSettings *) {} - static QString defaultTerminalEmulator() { return QString(); } - static QStringList availableTerminalEmulators() { return QStringList(); } - static QString terminalEmulator(const QSettings *, bool = true) { return QString(); } - static void setTerminalEmulator(QSettings *, const QString &) {} + static TerminalCommand defaultTerminalEmulator() { return TerminalCommand(); } + static QVector<TerminalCommand> availableTerminalEmulators() { return {}; } + static TerminalCommand terminalEmulator(const QSettings *) { return TerminalCommand(); } + static void setTerminalEmulator(QSettings *, const TerminalCommand &) {} #endif static bool startTerminalEmulator(QSettings *settings, const QString &workingDir); @@ -144,3 +159,5 @@ private: }; } //namespace Utils + +Q_DECLARE_METATYPE(Utils::TerminalCommand) |