forked from qt-creator/qt-creator
Make DeviceKitInformation available to macro expander
Change-Id: I49344683f2a5d80d6191e996161d70cd9fe5e2dd Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -40,7 +40,10 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <ssh/sshconnection.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
@@ -418,6 +421,30 @@ KitInformation::ItemList DeviceKitInformation::toUserOutput(const Kit *k) const
|
||||
return ItemList() << qMakePair(tr("Device"), dev.isNull() ? tr("Unconfigured") : dev->displayName());
|
||||
}
|
||||
|
||||
void DeviceKitInformation::addToMacroExpander(Kit *kit, Utils::MacroExpander *expander) const
|
||||
{
|
||||
expander->registerVariable("Device:HostAddress", tr("Host address"),
|
||||
[kit]() -> QString {
|
||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||
return device ? device->sshParameters().host : QString();
|
||||
});
|
||||
expander->registerVariable("Device:SshPort", tr("SSH port"),
|
||||
[kit]() -> QString {
|
||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||
return device ? QString::number(device->sshParameters().port) : QString();
|
||||
});
|
||||
expander->registerVariable("Device:UserName", tr("User name"),
|
||||
[kit]() -> QString {
|
||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||
return device ? device->sshParameters().userName : QString();
|
||||
});
|
||||
expander->registerVariable("Device:KeyFile", tr("Private key file"),
|
||||
[kit]() -> QString {
|
||||
const IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||
return device ? device->sshParameters().privateKeyFile : QString();
|
||||
});
|
||||
}
|
||||
|
||||
Core::Id DeviceKitInformation::id()
|
||||
{
|
||||
return "PE.Profile.Device";
|
||||
|
@@ -158,6 +158,8 @@ public:
|
||||
|
||||
ItemList toUserOutput(const Kit *k) const;
|
||||
|
||||
virtual void addToMacroExpander(ProjectExplorer::Kit *kit, Utils::MacroExpander *expander) const;
|
||||
|
||||
static Core::Id id();
|
||||
static IDevice::ConstPtr device(const Kit *k);
|
||||
static Core::Id deviceId(const Kit *k);
|
||||
|
Reference in New Issue
Block a user