forked from qt-creator/qt-creator
Utils: Use EnvironmentChange instead of Environment in several places
For path choosers this makes it easier to change the actual base retrospectively based on the device for the file path entered by the user. In other cases "end user code" only knows that something needs to be added to PATH to get a proper environment. This here lets this code to specify the change alone without bothering about the base environment this might be applied to. Change-Id: I726aaa2fd2feb0bee7158f601aac660b0ac6327b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -642,7 +642,7 @@ public:
|
||||
QString m_placeHolderText;
|
||||
QString m_historyCompleterKey;
|
||||
PathChooser::Kind m_expectedKind = PathChooser::File;
|
||||
Environment m_environment;
|
||||
EnvironmentChange m_environmentChange;
|
||||
QPointer<QLabel> m_labelDisplay;
|
||||
QPointer<FancyLineEdit> m_lineEditDisplay;
|
||||
QPointer<PathChooser> m_pathChooserDisplay;
|
||||
@@ -962,11 +962,11 @@ void StringAspect::setExpectedKind(const PathChooser::Kind expectedKind)
|
||||
d->m_pathChooserDisplay->setExpectedKind(expectedKind);
|
||||
}
|
||||
|
||||
void StringAspect::setEnvironment(const Environment &env)
|
||||
void StringAspect::setEnvironmentChange(const EnvironmentChange &change)
|
||||
{
|
||||
d->m_environment = env;
|
||||
d->m_environmentChange = change;
|
||||
if (d->m_pathChooserDisplay)
|
||||
d->m_pathChooserDisplay->setEnvironment(env);
|
||||
d->m_pathChooserDisplay->setEnvironmentChange(change);
|
||||
}
|
||||
|
||||
void StringAspect::setBaseFileName(const FilePath &baseFileName)
|
||||
@@ -1064,7 +1064,7 @@ void StringAspect::addToLayout(LayoutBuilder &builder)
|
||||
d->m_pathChooserDisplay->setHistoryCompleter(d->m_historyCompleterKey);
|
||||
if (d->m_validator)
|
||||
d->m_pathChooserDisplay->setValidationFunction(d->m_validator);
|
||||
d->m_pathChooserDisplay->setEnvironment(d->m_environment);
|
||||
d->m_pathChooserDisplay->setEnvironmentChange(d->m_environmentChange);
|
||||
d->m_pathChooserDisplay->setBaseDirectory(d->m_baseFileName);
|
||||
d->m_pathChooserDisplay->setOpenTerminalHandler(d->m_openTerminal);
|
||||
d->m_pathChooserDisplay->setFilePath(FilePath::fromString(displayedString));
|
||||
|
||||
Reference in New Issue
Block a user