forked from qt-creator/qt-creator
Qnx: Code cosmetics
Change-Id: Ibc7dc07166c79d65005d88a297916c54d30168cb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -29,6 +29,8 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/persistentsettings.h>
|
#include <utils/persistentsettings.h>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -36,10 +38,9 @@ const QLatin1String QNXConfigDataKey("QNXConfiguration.");
|
|||||||
const QLatin1String QNXConfigCountKey("QNXConfiguration.Count");
|
const QLatin1String QNXConfigCountKey("QNXConfiguration.Count");
|
||||||
const QLatin1String QNXConfigsFileVersionKey("Version");
|
const QLatin1String QNXConfigsFileVersionKey("Version");
|
||||||
|
|
||||||
static Utils::FilePath qnxConfigSettingsFileName()
|
static FilePath qnxConfigSettingsFileName()
|
||||||
{
|
{
|
||||||
return Utils::FilePath::fromString(Core::ICore::userResourcePath() + QLatin1String("/qnx/")
|
return FilePath::fromString(Core::ICore::userResourcePath() + "/qnx/qnxconfigurations.xml");
|
||||||
+ QLatin1String(Constants::QNX_CONFIGS_FILENAME));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QnxConfigurationManager *m_instance = nullptr;
|
static QnxConfigurationManager *m_instance = nullptr;
|
||||||
@@ -47,8 +48,7 @@ static QnxConfigurationManager *m_instance = nullptr;
|
|||||||
QnxConfigurationManager::QnxConfigurationManager()
|
QnxConfigurationManager::QnxConfigurationManager()
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
m_writer = new Utils::PersistentSettingsWriter(qnxConfigSettingsFileName(),
|
m_writer = new PersistentSettingsWriter(qnxConfigSettingsFileName(), "QnxConfigurations");
|
||||||
QLatin1String("QnxConfigurations"));
|
|
||||||
restoreConfigurations();
|
restoreConfigurations();
|
||||||
connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested,
|
connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested,
|
||||||
this, &QnxConfigurationManager::saveConfigs);
|
this, &QnxConfigurationManager::saveConfigs);
|
||||||
@@ -84,7 +84,7 @@ bool QnxConfigurationManager::addConfiguration(QnxConfiguration *config)
|
|||||||
if (!config || !config->isValid())
|
if (!config || !config->isValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (QnxConfiguration *c, m_configurations) {
|
for (QnxConfiguration *c : qAsConst(m_configurations)) {
|
||||||
if (c->envFile() == config->envFile())
|
if (c->envFile() == config->envFile())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -94,9 +94,9 @@ bool QnxConfigurationManager::addConfiguration(QnxConfiguration *config)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QnxConfiguration *QnxConfigurationManager::configurationFromEnvFile(const Utils::FilePath &envFile) const
|
QnxConfiguration *QnxConfigurationManager::configurationFromEnvFile(const FilePath &envFile) const
|
||||||
{
|
{
|
||||||
foreach (QnxConfiguration *c, m_configurations) {
|
for (QnxConfiguration *c : m_configurations) {
|
||||||
if (c->envFile() == envFile)
|
if (c->envFile() == envFile)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ void QnxConfigurationManager::saveConfigs()
|
|||||||
QVariantMap data;
|
QVariantMap data;
|
||||||
data.insert(QLatin1String(QNXConfigsFileVersionKey), 1);
|
data.insert(QLatin1String(QNXConfigsFileVersionKey), 1);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (QnxConfiguration *config, m_configurations) {
|
for (QnxConfiguration *config : qAsConst(m_configurations)) {
|
||||||
QVariantMap tmp = config->toMap();
|
QVariantMap tmp = config->toMap();
|
||||||
if (tmp.isEmpty())
|
if (tmp.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
@@ -126,7 +126,7 @@ void QnxConfigurationManager::saveConfigs()
|
|||||||
|
|
||||||
void QnxConfigurationManager::restoreConfigurations()
|
void QnxConfigurationManager::restoreConfigurations()
|
||||||
{
|
{
|
||||||
Utils::PersistentSettingsReader reader;
|
PersistentSettingsReader reader;
|
||||||
if (!reader.load(qnxConfigSettingsFileName()))
|
if (!reader.load(qnxConfigSettingsFileName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -143,5 +143,5 @@ void QnxConfigurationManager::restoreConfigurations()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // Internal
|
||||||
}
|
} // Qnx
|
||||||
|
@@ -30,9 +30,6 @@
|
|||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
|
|
||||||
const char QNX_TARGET_KEY[] = "QNX_TARGET";
|
|
||||||
const char QNX_HOST_KEY[] = "QNX_HOST";
|
|
||||||
|
|
||||||
const char QNX_QNX_QT[] = "Qt4ProjectManager.QtVersion.QNX.QNX";
|
const char QNX_QNX_QT[] = "Qt4ProjectManager.QtVersion.QNX.QNX";
|
||||||
|
|
||||||
const char QNX_QNX_FEATURE[] = "QtSupport.Wizards.FeatureQNX";
|
const char QNX_QNX_FEATURE[] = "QtSupport.Wizards.FeatureQNX";
|
||||||
@@ -41,16 +38,7 @@ const char QNX_QNX_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.QNX.QNXDeployCo
|
|||||||
|
|
||||||
const char QNX_QNX_OS_TYPE[] = "QnxOsType"; // Also used for device type.
|
const char QNX_QNX_OS_TYPE[] = "QnxOsType"; // Also used for device type.
|
||||||
|
|
||||||
const char QNX_DEBUG_EXECUTABLE[] = "pdebug";
|
|
||||||
|
|
||||||
const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain";
|
const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain";
|
||||||
|
|
||||||
// QNX settings constants
|
|
||||||
const char QNX_SETTINGS_ID[] = "DD.Qnx Configuration";
|
|
||||||
|
|
||||||
const char QNX_CONFIGS_FILENAME[] = "qnxconfigurations.xml";
|
|
||||||
|
|
||||||
const char QNX_DEBUGGING_GROUP[] = "Debugger.Group.Qnx";
|
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace Qnx
|
} // namespace Qnx
|
||||||
|
@@ -71,6 +71,8 @@ using namespace Utils;
|
|||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
const char QNX_DEBUG_EXECUTABLE[] = "pdebug";
|
||||||
|
|
||||||
static QStringList searchPaths(Kit *kit)
|
static QStringList searchPaths(Kit *kit)
|
||||||
{
|
{
|
||||||
auto qtVersion = dynamic_cast<QnxQtVersion *>(QtSupport::QtKitAspect::qtVersion(kit));
|
auto qtVersion = dynamic_cast<QnxQtVersion *>(QtSupport::QtKitAspect::qtVersion(kit));
|
||||||
@@ -107,7 +109,7 @@ public:
|
|||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
if (portsGatherer->useGdbServer()) {
|
if (portsGatherer->useGdbServer()) {
|
||||||
int pdebugPort = portsGatherer->gdbServer().port();
|
int pdebugPort = portsGatherer->gdbServer().port();
|
||||||
r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE);
|
r.executable = FilePath::fromString(QNX_DEBUG_EXECUTABLE);
|
||||||
arguments.append(QString::number(pdebugPort));
|
arguments.append(QString::number(pdebugPort));
|
||||||
}
|
}
|
||||||
if (portsGatherer->useQmlServer()) {
|
if (portsGatherer->useQmlServer()) {
|
||||||
@@ -201,7 +203,7 @@ public:
|
|||||||
const int pdebugPort = portsGatherer->gdbServer().port();
|
const int pdebugPort = portsGatherer->gdbServer().port();
|
||||||
|
|
||||||
Runnable r;
|
Runnable r;
|
||||||
r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE);
|
r.executable = FilePath::fromString(QNX_DEBUG_EXECUTABLE);
|
||||||
r.commandLineArguments = QString::number(pdebugPort);
|
r.commandLineArguments = QString::number(pdebugPort);
|
||||||
doStart(r, runControl->device());
|
doStart(r, runControl->device());
|
||||||
});
|
});
|
||||||
|
@@ -170,14 +170,16 @@ void QnxPlugin::extensionsInitialized()
|
|||||||
connect(&dd->m_attachToQnxApplication, &QAction::triggered,
|
connect(&dd->m_attachToQnxApplication, &QAction::triggered,
|
||||||
this, [] { QnxAttachDebugSupport::showProcessesDialog(); });
|
this, [] { QnxAttachDebugSupport::showProcessesDialog(); });
|
||||||
|
|
||||||
|
const char QNX_DEBUGGING_GROUP[] = "Debugger.Group.Qnx";
|
||||||
|
|
||||||
Core::ActionContainer *mstart = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
|
Core::ActionContainer *mstart = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
|
||||||
mstart->appendGroup(Constants::QNX_DEBUGGING_GROUP);
|
mstart->appendGroup(QNX_DEBUGGING_GROUP);
|
||||||
mstart->addSeparator(Core::Context(Core::Constants::C_GLOBAL), Constants::QNX_DEBUGGING_GROUP,
|
mstart->addSeparator(Core::Context(Core::Constants::C_GLOBAL), QNX_DEBUGGING_GROUP,
|
||||||
&dd->m_debugSeparator);
|
&dd->m_debugSeparator);
|
||||||
|
|
||||||
Core::Command *cmd = Core::ActionManager::registerAction
|
Core::Command *cmd = Core::ActionManager::registerAction
|
||||||
(&dd->m_attachToQnxApplication, "Debugger.AttachToQnxApplication");
|
(&dd->m_attachToQnxApplication, "Debugger.AttachToQnxApplication");
|
||||||
mstart->addAction(cmd, Constants::QNX_DEBUGGING_GROUP);
|
mstart->addAction(cmd, QNX_DEBUGGING_GROUP);
|
||||||
|
|
||||||
connect(KitManager::instance(), &KitManager::kitsChanged,
|
connect(KitManager::instance(), &KitManager::kitsChanged,
|
||||||
this, [] { dd->updateDebuggerActions(); });
|
this, [] { dd->updateDebuggerActions(); });
|
||||||
|
@@ -38,11 +38,16 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static char SDP_PATH_KEY[] = "SDKPath";
|
const char SDP_PATH_KEY[] = "SDKPath";
|
||||||
|
|
||||||
|
const char QNX_TARGET_KEY[] = "QNX_TARGET";
|
||||||
|
const char QNX_HOST_KEY[] = "QNX_HOST";
|
||||||
|
const char QNX_QNX_FEATURE[] = "QtSupport.Wizards.FeatureQNX";
|
||||||
|
|
||||||
QnxQtVersion::QnxQtVersion() = default;
|
QnxQtVersion::QnxQtVersion() = default;
|
||||||
|
|
||||||
@@ -53,16 +58,16 @@ QString QnxQtVersion::description() const
|
|||||||
.arg(QnxUtils::cpuDirShortDescription(cpuDir()));
|
.arg(QnxUtils::cpuDirShortDescription(cpuDir()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<Utils::Id> QnxQtVersion::availableFeatures() const
|
QSet<Id> QnxQtVersion::availableFeatures() const
|
||||||
{
|
{
|
||||||
QSet<Utils::Id> features = QtSupport::BaseQtVersion::availableFeatures();
|
QSet<Id> features = QtSupport::BaseQtVersion::availableFeatures();
|
||||||
features.insert(Constants::QNX_QNX_FEATURE);
|
features.insert(QNX_QNX_FEATURE);
|
||||||
features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE);
|
features.remove(QtSupport::Constants::FEATURE_QT_CONSOLE);
|
||||||
features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT);
|
features.remove(QtSupport::Constants::FEATURE_QT_WEBKIT);
|
||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<Utils::Id> QnxQtVersion::targetDeviceTypes() const
|
QSet<Id> QnxQtVersion::targetDeviceTypes() const
|
||||||
{
|
{
|
||||||
return {Constants::QNX_QNX_OS_TYPE};
|
return {Constants::QNX_QNX_OS_TYPE};
|
||||||
}
|
}
|
||||||
@@ -72,25 +77,25 @@ QString QnxQtVersion::qnxHost() const
|
|||||||
if (!m_environmentUpToDate)
|
if (!m_environmentUpToDate)
|
||||||
updateEnvironment();
|
updateEnvironment();
|
||||||
|
|
||||||
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
|
for (const EnvironmentItem &item : m_qnxEnv) {
|
||||||
if (item.name == QLatin1String(Constants::QNX_HOST_KEY))
|
if (item.name == QLatin1String(QNX_HOST_KEY))
|
||||||
return item.value;
|
return item.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FilePath QnxQtVersion::qnxTarget() const
|
FilePath QnxQtVersion::qnxTarget() const
|
||||||
{
|
{
|
||||||
if (!m_environmentUpToDate)
|
if (!m_environmentUpToDate)
|
||||||
updateEnvironment();
|
updateEnvironment();
|
||||||
|
|
||||||
foreach (const Utils::EnvironmentItem &item, m_qnxEnv) {
|
for (EnvironmentItem &item : m_qnxEnv) {
|
||||||
if (item.name == QLatin1String(Constants::QNX_TARGET_KEY))
|
if (item.name == QNX_TARGET_KEY)
|
||||||
return Utils::FilePath::fromUserInput(item.value);
|
return FilePath::fromUserInput(item.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Utils::FilePath();
|
return FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QnxQtVersion::cpuDir() const
|
QString QnxQtVersion::cpuDir() const
|
||||||
@@ -114,13 +119,13 @@ void QnxQtVersion::fromMap(const QVariantMap &map)
|
|||||||
setSdpPath(QDir::fromNativeSeparators(map.value(QLatin1String(SDP_PATH_KEY)).toString()));
|
setSdpPath(QDir::fromNativeSeparators(map.value(QLatin1String(SDP_PATH_KEY)).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Abis QnxQtVersion::detectQtAbis() const
|
Abis QnxQtVersion::detectQtAbis() const
|
||||||
{
|
{
|
||||||
ensureMkSpecParsed();
|
ensureMkSpecParsed();
|
||||||
return QnxUtils::convertAbis(BaseQtVersion::detectQtAbis());
|
return QnxUtils::convertAbis(BaseQtVersion::detectQtAbis());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
|
void QnxQtVersion::addToEnvironment(const Kit *k, Environment &env) const
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion::addToEnvironment(k, env);
|
QtSupport::BaseQtVersion::addToEnvironment(k, env);
|
||||||
updateEnvironment();
|
updateEnvironment();
|
||||||
@@ -129,12 +134,12 @@ void QnxQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Enviro
|
|||||||
env.prependOrSetLibrarySearchPath(libraryPath().toString());
|
env.prependOrSetLibrarySearchPath(libraryPath().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Environment QnxQtVersion::qmakeRunEnvironment() const
|
Environment QnxQtVersion::qmakeRunEnvironment() const
|
||||||
{
|
{
|
||||||
if (!sdpPath().isEmpty())
|
if (!sdpPath().isEmpty())
|
||||||
updateEnvironment();
|
updateEnvironment();
|
||||||
|
|
||||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
Environment env = Environment::systemEnvironment();
|
||||||
env.modify(m_qnxEnv);
|
env.modify(m_qnxEnv);
|
||||||
|
|
||||||
return env;
|
return env;
|
||||||
@@ -180,7 +185,7 @@ void QnxQtVersion::updateEnvironment() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::EnvironmentItems QnxQtVersion::environment() const
|
EnvironmentItems QnxQtVersion::environment() const
|
||||||
{
|
{
|
||||||
return QnxUtils::qnxEnvironment(sdpPath());
|
return QnxUtils::qnxEnvironment(sdpPath());
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "qnxconstants.h"
|
#include "qnxconstants.h"
|
||||||
#include "qnxqtversion.h"
|
|
||||||
|
|
||||||
#include <qtsupport/baseqtversion.h>
|
#include <qtsupport/baseqtversion.h>
|
||||||
#include <qtsupport/qtversionfactory.h>
|
#include <qtsupport/qtversionfactory.h>
|
||||||
|
@@ -246,7 +246,7 @@ void QnxSettingsWidget::apply()
|
|||||||
|
|
||||||
QnxSettingsPage::QnxSettingsPage()
|
QnxSettingsPage::QnxSettingsPage()
|
||||||
{
|
{
|
||||||
setId(Constants::QNX_SETTINGS_ID);
|
setId("DD.Qnx Configuration");
|
||||||
setDisplayName(QnxSettingsWidget::tr("QNX"));
|
setDisplayName(QnxSettingsWidget::tr("QNX"));
|
||||||
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
|
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
|
||||||
setWidgetCreator([] { return new QnxSettingsWidget; });
|
setWidgetCreator([] { return new QnxSettingsWidget; });
|
||||||
|
Reference in New Issue
Block a user