2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 BlackBerry Limited. All rights reserved.
|
2012-06-29 07:23:13 +02:00
|
|
|
** Contact: KDAB (info@kdab.com)
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2012-06-29 07:23:13 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-06-29 07:23:13 +02:00
|
|
|
|
|
|
|
|
#include "qnxrunconfiguration.h"
|
|
|
|
|
#include "qnxconstants.h"
|
|
|
|
|
|
2016-01-26 15:53:26 +01:00
|
|
|
#include <projectexplorer/runnables.h>
|
2017-11-14 14:38:56 +01:00
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
|
|
|
|
|
#include <qmakeprojectmanager/qmakeproject.h>
|
|
|
|
|
#include <qmakeprojectmanager/qmakenodes.h>
|
|
|
|
|
|
2012-06-29 07:23:13 +02:00
|
|
|
#include <remotelinux/remotelinuxrunconfigurationwidget.h>
|
2017-11-14 14:38:56 +01:00
|
|
|
|
2013-08-08 14:05:11 +02:00
|
|
|
#include <utils/environment.h>
|
2012-06-29 07:23:13 +02:00
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
|
2016-01-21 17:38:03 +01:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace RemoteLinux;
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2016-01-21 17:38:03 +01:00
|
|
|
namespace Qnx {
|
|
|
|
|
namespace Internal {
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2016-01-21 17:38:03 +01:00
|
|
|
const char QtLibPathKey[] = "Qt4ProjectManager.QnxRunConfiguration.QtLibPath";
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2017-09-01 13:23:02 +02:00
|
|
|
QnxRunConfiguration::QnxRunConfiguration(Target *target)
|
|
|
|
|
: RemoteLinuxRunConfiguration(target)
|
|
|
|
|
{}
|
|
|
|
|
|
2017-11-14 14:38:56 +01:00
|
|
|
void QnxRunConfiguration::initialize(Core::Id id)
|
|
|
|
|
{
|
|
|
|
|
const QString projectFilePath = id.suffixAfter(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX);
|
|
|
|
|
auto project = qobject_cast<QmakeProjectManager::QmakeProject *>(target()->project());
|
|
|
|
|
QTC_ASSERT(project, return);
|
|
|
|
|
for (const QmakeProjectManager::QmakeProFile *file : project->applicationProFiles()) {
|
|
|
|
|
if (file->filePath().toString() == projectFilePath) {
|
2017-11-14 15:04:52 +01:00
|
|
|
// Circumvent RemoteLinux's initialize() FIXME: Ugly.
|
|
|
|
|
RunConfiguration::initialize(id);
|
|
|
|
|
setTargetName(file->targetInformation().target);
|
2017-11-14 14:38:56 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-11-14 15:04:52 +01:00
|
|
|
RemoteLinuxRunConfiguration::initialize(id);
|
2017-11-14 14:38:56 +01:00
|
|
|
}
|
|
|
|
|
|
2016-01-26 15:53:26 +01:00
|
|
|
Runnable QnxRunConfiguration::runnable() const
|
2012-06-29 07:23:13 +02:00
|
|
|
{
|
2016-01-26 15:53:26 +01:00
|
|
|
auto r = RemoteLinuxRunConfiguration::runnable().as<StandardRunnable>();
|
2013-08-08 14:05:11 +02:00
|
|
|
if (!m_qtLibPath.isEmpty()) {
|
2016-01-26 15:53:26 +01:00
|
|
|
r.environment.appendOrSet(QLatin1String("LD_LIBRARY_PATH"),
|
2014-05-02 11:21:42 +02:00
|
|
|
m_qtLibPath + QLatin1String("/lib:$LD_LIBRARY_PATH"));
|
2016-01-26 15:53:26 +01:00
|
|
|
r.environment.appendOrSet(QLatin1String("QML_IMPORT_PATH"),
|
2014-05-02 11:21:42 +02:00
|
|
|
m_qtLibPath + QLatin1String("/imports:$QML_IMPORT_PATH"));
|
2016-01-26 15:53:26 +01:00
|
|
|
r.environment.appendOrSet(QLatin1String("QML2_IMPORT_PATH"),
|
2014-05-02 11:21:42 +02:00
|
|
|
m_qtLibPath + QLatin1String("/qml:$QML2_IMPORT_PATH"));
|
2016-01-26 15:53:26 +01:00
|
|
|
r.environment.appendOrSet(QLatin1String("QT_PLUGIN_PATH"),
|
2014-05-02 11:21:42 +02:00
|
|
|
m_qtLibPath + QLatin1String("/plugins:$QT_PLUGIN_PATH"));
|
2016-01-26 15:53:26 +01:00
|
|
|
r.environment.set(QLatin1String("QT_QPA_FONTDIR"),
|
2014-05-19 16:00:23 +02:00
|
|
|
m_qtLibPath + QLatin1String("/lib/fonts"));
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
2016-01-26 15:53:26 +01:00
|
|
|
return r;
|
2012-06-29 07:23:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget *QnxRunConfiguration::createConfigurationWidget()
|
|
|
|
|
{
|
2016-01-21 17:38:03 +01:00
|
|
|
auto rcWidget = qobject_cast<RemoteLinuxRunConfigurationWidget *>
|
|
|
|
|
(RemoteLinuxRunConfiguration::createConfigurationWidget());
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2016-01-21 17:38:03 +01:00
|
|
|
auto label = new QLabel(tr("Path to Qt libraries on device:"));
|
|
|
|
|
auto lineEdit = new QLineEdit(m_qtLibPath);
|
2012-06-29 07:23:13 +02:00
|
|
|
|
2016-01-21 17:38:03 +01:00
|
|
|
connect(lineEdit, &QLineEdit::textChanged,
|
|
|
|
|
this, [this](const QString &path) { m_qtLibPath = path; });
|
2012-06-29 07:23:13 +02:00
|
|
|
|
|
|
|
|
rcWidget->addFormLayoutRow(label, lineEdit);
|
|
|
|
|
|
|
|
|
|
return rcWidget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariantMap QnxRunConfiguration::toMap() const
|
|
|
|
|
{
|
2016-01-21 17:38:03 +01:00
|
|
|
QVariantMap map(RemoteLinuxRunConfiguration::toMap());
|
2012-06-29 07:23:13 +02:00
|
|
|
map.insert(QLatin1String(QtLibPathKey), m_qtLibPath);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool QnxRunConfiguration::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
2016-01-21 17:38:03 +01:00
|
|
|
if (!RemoteLinuxRunConfiguration::fromMap(map))
|
2012-06-29 07:23:13 +02:00
|
|
|
return false;
|
|
|
|
|
|
2016-01-21 17:38:03 +01:00
|
|
|
m_qtLibPath = map.value(QLatin1String(QtLibPathKey)).toString();
|
2012-06-29 07:23:13 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2016-01-21 17:38:03 +01:00
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qnx
|