diff --git a/doc/src/linux-mobile/linuxdev.qdoc b/doc/src/linux-mobile/linuxdev.qdoc index 24bf4a1f8cc..7aeb8ce6c81 100644 --- a/doc/src/linux-mobile/linuxdev.qdoc +++ b/doc/src/linux-mobile/linuxdev.qdoc @@ -76,20 +76,28 @@ \li In the \gui {The device's host name or IP address} field, enter the host name or IP address of the device. + This value will be available in the variable \c %{CurrentDevice:HostAddress}. \li In the \gui {The user name to log into the device} field, enter the user name to log into the device and run the application as. + This value will be available in the variable \c %{CurrentDevice:UserName}. \li In the \gui {The authentication type} field, select whether to use \gui Password or \gui Key authentication, and enter the user's password or the file that contains the user's private key. + The latter will be available in the variable \c %{CurrentDevice:PrivateKeyFile}. \li Click \gui {Next} to create the connection. \endlist + All of these parameters can be edited later, as well as additional ones that the + wizard does not show because there are sensible default values. One of these is + the SSH port number, which is available in the variable \c %{CurrentDevice:SshPort}. + + \li Select \gui Tools > \gui Options > \gui {Build & Run} > \gui Kits > \gui Add to add a kit for building for the device. Select the Qt version, compiler, and device that you added above, and choose diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 1ef525d6797..6aa93292066 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1011,6 +1011,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er VariableManager::registerVariable(Constants::VAR_CURRENTKIT_FILESYSTEMNAME, tr("The currently active kit's name in a filesystem friendly version.")); VariableManager::registerVariable(Constants::VAR_CURRENTKIT_ID, tr("The currently active kit's id.")); + VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_HOSTADDRESS, + tr("The host address of the device in the currently active kit.")); + VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_SSHPORT, + tr("The SSH port of the device in the currently active kit.")); + VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_USERNAME, + tr("The user name with which to log into the device in the currently active kit.")); + VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE, + tr("The private key file with which to authenticate when logging into the device " + "in the currently active kit.")); VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_NAME, tr("The currently active build configuration's name.")); VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_TYPE, tr("The currently active build configuration's type.")); VariableManager::registerFileVariables(Constants::VAR_CURRENTSESSION_PREFIX, tr("File where current session is saved.")); diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index 0b1f8fc9f34..749232d17df 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -245,6 +245,10 @@ const char VAR_CURRENTBUILD_NAME[] = "CurrentBuild:Name"; const char VAR_CURRENTBUILD_TYPE[] = "CurrentBuild:Type"; const char VAR_CURRENTSESSION_PREFIX[] = "CurrentSession"; const char VAR_CURRENTSESSION_NAME[] = "CurrentSession:Name"; +const char VAR_CURRENTDEVICE_HOSTADDRESS[] = "CurrentDevice:HostAddress"; +const char VAR_CURRENTDEVICE_SSHPORT[] = "CurrentDevice:SshPort"; +const char VAR_CURRENTDEVICE_USERNAME[] = "CurrentDevice:UserName"; +const char VAR_CURRENTDEVICE_PRIVATEKEYFILE[] = "CurrentDevice:PrivateKeyFile"; const char HIDE_FILE_FILTER_SETTING[] = "GenericProject/FileFilter"; const char HIDE_FILE_FILTER_DEFAULT[] = "Makefile*; *.o; *.obj; *~; *.files; *.config; *.creator; *.user; *.includes; *.autosave"; diff --git a/src/plugins/projectexplorer/projectmacroexpander.cpp b/src/plugins/projectexplorer/projectmacroexpander.cpp index 1446a5d8e72..4ce2f4086fc 100644 --- a/src/plugins/projectexplorer/projectmacroexpander.cpp +++ b/src/plugins/projectexplorer/projectmacroexpander.cpp @@ -29,9 +29,11 @@ #include "projectmacroexpander.h" #include "kit.h" +#include "kitinformation.h" #include "projectexplorerconstants.h" #include +#include using namespace ProjectExplorer; @@ -69,6 +71,30 @@ bool ProjectMacroExpander::resolveProjectMacro(const QString &name, QString *ret } else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTBUILD_NAME)) { result = m_bcName; found = true; + } else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTDEVICE_HOSTADDRESS)) { + const IDevice::ConstPtr device = DeviceKitInformation::device(m_kit); + if (device) { + result = device->sshParameters().host; + found = true; + } + } else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTDEVICE_SSHPORT)) { + const IDevice::ConstPtr device = DeviceKitInformation::device(m_kit); + if (device) { + result = QString::number(device->sshParameters().port); + found = true; + } + } else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTDEVICE_USERNAME)) { + const IDevice::ConstPtr device = DeviceKitInformation::device(m_kit); + if (device) { + result = device->sshParameters().userName; + found = true; + } + } else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE)) { + const IDevice::ConstPtr device = DeviceKitInformation::device(m_kit); + if (device) { + result = device->sshParameters().privateKeyFile; + found = true; + } } if (ret) *ret = result;