forked from qt-creator/qt-creator
Device support: Provide SSH connection parameters in internal variables.
Example use case: User is developing for embedded Linux system without an SFTP server. Now deployment can be done via a custom process step using scp without the need to duplicate all the connection data. Change-Id: Ib1f71080d106864e5f5345fd36f7cc226a515916 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -76,20 +76,28 @@
|
|||||||
|
|
||||||
\li In the \gui {The device's host name or IP address} field,
|
\li In the \gui {The device's host name or IP address} field,
|
||||||
enter the host name or IP address of the device.
|
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,
|
\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
|
enter the user name to log into the device and run the
|
||||||
application as.
|
application as.
|
||||||
|
This value will be available in the variable \c %{CurrentDevice:UserName}.
|
||||||
|
|
||||||
\li In the \gui {The authentication type} field, select whether
|
\li In the \gui {The authentication type} field, select whether
|
||||||
to use \gui Password or \gui Key authentication, and enter
|
to use \gui Password or \gui Key authentication, and enter
|
||||||
the user's password or the file that contains the user's
|
the user's password or the file that contains the user's
|
||||||
private key.
|
private key.
|
||||||
|
The latter will be available in the variable \c %{CurrentDevice:PrivateKeyFile}.
|
||||||
|
|
||||||
\li Click \gui {Next} to create the connection.
|
\li Click \gui {Next} to create the connection.
|
||||||
|
|
||||||
\endlist
|
\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
|
\li Select \gui Tools > \gui Options > \gui {Build & Run} > \gui Kits
|
||||||
> \gui Add to add a kit for building for the device. Select the
|
> \gui Add to add a kit for building for the device. Select the
|
||||||
Qt version, compiler, and device that you added above, and choose
|
Qt version, compiler, and device that you added above, and choose
|
||||||
|
|||||||
@@ -1011,6 +1011,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
VariableManager::registerVariable(Constants::VAR_CURRENTKIT_FILESYSTEMNAME,
|
VariableManager::registerVariable(Constants::VAR_CURRENTKIT_FILESYSTEMNAME,
|
||||||
tr("The currently active kit's name in a filesystem friendly version."));
|
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_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_NAME, tr("The currently active build configuration's name."));
|
||||||
VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_TYPE, tr("The currently active build configuration's type."));
|
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."));
|
VariableManager::registerFileVariables(Constants::VAR_CURRENTSESSION_PREFIX, tr("File where current session is saved."));
|
||||||
|
|||||||
@@ -245,6 +245,10 @@ const char VAR_CURRENTBUILD_NAME[] = "CurrentBuild:Name";
|
|||||||
const char VAR_CURRENTBUILD_TYPE[] = "CurrentBuild:Type";
|
const char VAR_CURRENTBUILD_TYPE[] = "CurrentBuild:Type";
|
||||||
const char VAR_CURRENTSESSION_PREFIX[] = "CurrentSession";
|
const char VAR_CURRENTSESSION_PREFIX[] = "CurrentSession";
|
||||||
const char VAR_CURRENTSESSION_NAME[] = "CurrentSession:Name";
|
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_SETTING[] = "GenericProject/FileFilter";
|
||||||
const char HIDE_FILE_FILTER_DEFAULT[] = "Makefile*; *.o; *.obj; *~; *.files; *.config; *.creator; *.user; *.includes; *.autosave";
|
const char HIDE_FILE_FILTER_DEFAULT[] = "Makefile*; *.o; *.obj; *~; *.files; *.config; *.creator; *.user; *.includes; *.autosave";
|
||||||
|
|||||||
@@ -29,9 +29,11 @@
|
|||||||
|
|
||||||
#include "projectmacroexpander.h"
|
#include "projectmacroexpander.h"
|
||||||
#include "kit.h"
|
#include "kit.h"
|
||||||
|
#include "kitinformation.h"
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/variablemanager.h>
|
#include <coreplugin/variablemanager.h>
|
||||||
|
#include <ssh/sshconnection.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
@@ -69,6 +71,30 @@ bool ProjectMacroExpander::resolveProjectMacro(const QString &name, QString *ret
|
|||||||
} else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTBUILD_NAME)) {
|
} else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTBUILD_NAME)) {
|
||||||
result = m_bcName;
|
result = m_bcName;
|
||||||
found = true;
|
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)
|
if (ret)
|
||||||
*ret = result;
|
*ret = result;
|
||||||
|
|||||||
Reference in New Issue
Block a user