forked from qt-creator/qt-creator
BuildEnvironmentWidget: Override 'Open Terminal' func to open build dir
If the user is opening a terminal in the build environment then probably the intention is to do something in the build dir rather than in the home dir. Also, most shells/terminals have a shortcut to go to the home dir but they have no idea about the build dir so it is much harder to get there. Change-Id: Ia259def7a4915fe86370fc183fb1e38ef6644c4d Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "toolchain.h"
|
#include "toolchain.h"
|
||||||
|
|
||||||
|
#include <coreplugin/fileutils.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
|
|
||||||
@@ -93,6 +94,12 @@ public:
|
|||||||
envWidget->setBaseEnvironmentText(bc->baseEnvironmentText());
|
envWidget->setBaseEnvironmentText(bc->baseEnvironmentText());
|
||||||
envWidget->setUserChanges(bc->userEnvironmentChanges());
|
envWidget->setUserChanges(bc->userEnvironmentChanges());
|
||||||
|
|
||||||
|
const EnvironmentWidget::OpenTerminalFunc openTerminalFunc
|
||||||
|
= [bc](const Utils::Environment &env) {
|
||||||
|
Core::FileUtils::openTerminal(bc->buildDirectory(), env);
|
||||||
|
};
|
||||||
|
envWidget->setOpenTerminalFunc(openTerminalFunc);
|
||||||
|
|
||||||
connect(envWidget, &EnvironmentWidget::userChangesChanged, this, [bc, envWidget] {
|
connect(envWidget, &EnvironmentWidget::userChangesChanged, this, [bc, envWidget] {
|
||||||
bc->setUserEnvironmentChanges(envWidget->userChanges());
|
bc->setUserEnvironmentChanges(envWidget->userChanges());
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user