Commit e4b2947c authored by hjk's avatar hjk

ProjectExplorer et al: Code cosmetics

Apply static 'pattern' for ToolChainManager, de-noise using code.

Change-Id: I196dc6f39dc2c61b1783aecad3faa0b23849e00a
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent c10ae974
......@@ -739,7 +739,7 @@ void AndroidConfigurations::updateAutomaticKitList()
if (AndroidConfigurations::instance().config().automaticKitCreation) {
// having a empty toolchains list will remove all autodetected kits for android
// exactly what we want in that case
foreach (ToolChain *tc, ToolChainManager::instance()->toolChains()) {
foreach (ToolChain *tc, ToolChainManager::toolChains()) {
if (!tc->isAutoDetected())
continue;
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
......
......@@ -45,8 +45,11 @@
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
using namespace Android;
using namespace Android::Internal;
using namespace ProjectExplorer;
using namespace Utils;
namespace Android {
namespace Internal {
static const char ANDROID_GDBSERVER_INFORMATION[] = "Android.GdbServer.Information";
......@@ -56,31 +59,31 @@ AndroidGdbServerKitInformation::AndroidGdbServerKitInformation()
setPriority(27999); // Just one less than Debugger!
}
QVariant AndroidGdbServerKitInformation::defaultValue(ProjectExplorer::Kit *kit) const
QVariant AndroidGdbServerKitInformation::defaultValue(Kit *kit) const
{
return autoDetect(kit).toString();
}
QList<ProjectExplorer::Task> AndroidGdbServerKitInformation::validate(const ProjectExplorer::Kit *) const
QList<Task> AndroidGdbServerKitInformation::validate(const Kit *) const
{
return QList<ProjectExplorer::Task>();
return QList<Task>();
}
ProjectExplorer::KitInformation::ItemList AndroidGdbServerKitInformation::toUserOutput(const ProjectExplorer::Kit *kit) const
KitInformation::ItemList AndroidGdbServerKitInformation::toUserOutput(const Kit *kit) const
{
return ProjectExplorer::KitInformation::ItemList()
return KitInformation::ItemList()
<< qMakePair(tr("GDB server"), AndroidGdbServerKitInformation::gdbServer(kit).toUserOutput());
}
ProjectExplorer::KitConfigWidget *AndroidGdbServerKitInformation::createConfigWidget(ProjectExplorer::Kit *kit) const
KitConfigWidget *AndroidGdbServerKitInformation::createConfigWidget(Kit *kit) const
{
return new AndroidGdbServerKitInformationWidget(kit, isSticky(kit));
}
bool AndroidGdbServerKitInformation::isAndroidKit(const ProjectExplorer::Kit *kit)
bool AndroidGdbServerKitInformation::isAndroidKit(const Kit *kit)
{
QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(kit);
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(kit);
ToolChain *tc = ToolChainKitInformation::toolChain(kit);
if (qt && tc)
return qt->type() == QLatin1String(Android::Constants::ANDROIDQT)
&& tc->type() == QLatin1String(Android::Constants::ANDROID_TOOLCHAIN_TYPE);
......@@ -88,27 +91,26 @@ bool AndroidGdbServerKitInformation::isAndroidKit(const ProjectExplorer::Kit *ki
}
Utils::FileName AndroidGdbServerKitInformation::gdbServer(const ProjectExplorer::Kit *kit)
FileName AndroidGdbServerKitInformation::gdbServer(const Kit *kit)
{
return Utils::FileName::fromString(kit->value(Core::Id(ANDROID_GDBSERVER_INFORMATION)).toString());
return FileName::fromString(kit->value(ANDROID_GDBSERVER_INFORMATION).toString());
}
void AndroidGdbServerKitInformation::setGdbSever(ProjectExplorer::Kit *kit, const Utils::FileName &gdbServerCommand)
void AndroidGdbServerKitInformation::setGdbSever(Kit *kit, const FileName &gdbServerCommand)
{
kit->setValue(Core::Id(ANDROID_GDBSERVER_INFORMATION),
gdbServerCommand.toString());
kit->setValue(ANDROID_GDBSERVER_INFORMATION, gdbServerCommand.toString());
}
Utils::FileName AndroidGdbServerKitInformation::autoDetect(ProjectExplorer::Kit *kit)
FileName AndroidGdbServerKitInformation::autoDetect(Kit *kit)
{
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(kit);
ToolChain *tc = ToolChainKitInformation::toolChain(kit);
if (!tc || tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
return Utils::FileName();
return FileName();
AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
return atc->suggestedGdbServer();
}
void AndroidGdbServerKitInformation::makeSticky(ProjectExplorer::Kit *k)
void AndroidGdbServerKitInformation::makeSticky(Kit *k)
{
k->makeSticky(ANDROID_GDBSERVER_INFORMATION);
}
......@@ -118,9 +120,9 @@ void AndroidGdbServerKitInformation::makeSticky(ProjectExplorer::Kit *k)
///////////////
AndroidGdbServerKitInformationWidget::AndroidGdbServerKitInformationWidget(ProjectExplorer::Kit *kit, bool sticky)
: ProjectExplorer::KitConfigWidget(kit, sticky),
m_label(new Utils::ElidingLabel),
AndroidGdbServerKitInformationWidget::AndroidGdbServerKitInformationWidget(Kit *kit, bool sticky)
: KitConfigWidget(kit, sticky),
m_label(new ElidingLabel),
m_button(new QPushButton(tr("Manage...")))
{
// ToolButton with Menu, defaulting to 'Autodetect'.
......@@ -156,7 +158,7 @@ void AndroidGdbServerKitInformationWidget::refresh()
bool AndroidGdbServerKitInformationWidget::visibleInKit()
{
return ProjectExplorer::DeviceKitInformation::deviceId(m_kit) == Core::Id(Constants::ANDROID_DEVICE_ID);
return DeviceKitInformation::deviceId(m_kit) == Constants::ANDROID_DEVICE_ID;
}
QWidget *AndroidGdbServerKitInformationWidget::mainWidget() const
......@@ -182,8 +184,8 @@ void AndroidGdbServerKitInformationWidget::showDialog()
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
QLabel *binaryLabel = new QLabel(tr("&Binary:"));
Utils::PathChooser *chooser = new Utils::PathChooser;
chooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
PathChooser *chooser = new PathChooser;
chooser->setExpectedKind(PathChooser::ExistingCommand);
chooser->setPath(AndroidGdbServerKitInformation::gdbServer(m_kit).toString());
binaryLabel->setBuddy(chooser);
formLayout->addRow(binaryLabel, chooser);
......@@ -199,3 +201,6 @@ void AndroidGdbServerKitInformationWidget::showDialog()
if (dialog.exec() == QDialog::Accepted)
AndroidGdbServerKitInformation::setGdbSever(m_kit, chooser->fileName());
}
} // namespace Internal
} // namespace Android
......@@ -33,11 +33,10 @@
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/kitconfigwidget.h>
QT_FORWARD_DECLARE_CLASS(QLabel);
QT_FORWARD_DECLARE_CLASS(QPushButton);
namespace ProjectExplorer {
}
QT_BEGIN_NAMESPACE
class QLabel;
class QPushButton;
QT_END_NAMESPACE
namespace Android {
namespace Internal {
......
......@@ -36,6 +36,8 @@
#include <QCoreApplication>
using namespace ProjectExplorer;
namespace Android {
namespace Internal {
......@@ -67,9 +69,9 @@ void AndroidSettingsPage::apply()
{
m_widget->saveSettings();
QList<ProjectExplorer::ToolChain *> existingToolChains = ProjectExplorer::ToolChainManager::instance()->toolChains();
QList<ProjectExplorer::ToolChain *> toolchains = AndroidToolChainFactory::createToolChainsForNdk(AndroidConfigurations::instance().config().ndkLocation);
foreach (ProjectExplorer::ToolChain *tc, toolchains) {
QList<ToolChain *> existingToolChains = ToolChainManager::toolChains();
QList<ToolChain *> toolchains = AndroidToolChainFactory::createToolChainsForNdk(AndroidConfigurations::instance().config().ndkLocation);
foreach (ToolChain *tc, toolchains) {
bool found = false;
for (int i = 0; i < existingToolChains.count(); ++i) {
if (*(existingToolChains.at(i)) == *tc) {
......@@ -80,15 +82,13 @@ void AndroidSettingsPage::apply()
if (found)
delete tc;
else
ProjectExplorer::ToolChainManager::instance()->registerToolChain(tc);
ToolChainManager::registerToolChain(tc);
}
for (int i = 0; i < existingToolChains.count(); ++i) {
ProjectExplorer::ToolChain *tc = existingToolChains.at(i);
foreach (ToolChain *tc, existingToolChains) {
if (tc->type() == QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE)) {
if (!tc->isValid()) {
ProjectExplorer::ToolChainManager::instance()->deregisterToolChain(tc);
}
if (!tc->isValid())
ToolChainManager::deregisterToolChain(tc);
}
}
......
......@@ -246,7 +246,6 @@ QVariant DebuggerKitInformation::defaultValue(Kit *k) const
void DebuggerKitInformation::setup(Kit *k)
{
QTC_ASSERT(ToolChainManager::instance()->isLoaded(), return);
k->setValue(DEBUGGER_INFORMATION, defaultValue(k));
}
......
......@@ -128,11 +128,11 @@ ToolChainKitInformation::ToolChainKitInformation()
QVariant ToolChainKitInformation::defaultValue(Kit *k) const
{
Q_UNUSED(k);
QList<ToolChain *> tcList = ToolChainManager::instance()->toolChains();
QList<ToolChain *> tcList = ToolChainManager::toolChains();
if (tcList.isEmpty())
return QString();
ProjectExplorer::Abi abi = ProjectExplorer::Abi::hostAbi();
Abi abi = Abi::hostAbi();
foreach (ToolChain *tc, tcList) {
if (tc->targetAbi() == abi)
......@@ -158,7 +158,7 @@ QList<Task> ToolChainKitInformation::validate(const Kit *k) const
void ToolChainKitInformation::fix(Kit *k)
{
QTC_ASSERT(ToolChainManager::instance()->isLoaded(), return);
QTC_ASSERT(ToolChainManager::isLoaded(), return);
if (toolChain(k))
return;
......@@ -169,17 +169,17 @@ void ToolChainKitInformation::fix(Kit *k)
void ToolChainKitInformation::setup(Kit *k)
{
QTC_ASSERT(ToolChainManager::instance()->isLoaded(), return);
const QString id = k->value(Core::Id(TOOLCHAIN_INFORMATION)).toString();
QTC_ASSERT(ToolChainManager::isLoaded(), return);
const QString id = k->value(TOOLCHAIN_INFORMATION).toString();
if (id.isEmpty())
return;
ToolChain *tc = ToolChainManager::instance()->findToolChain(id);
ToolChain *tc = ToolChainManager::findToolChain(id);
if (tc)
return;
// ID is not found: Might be an ABI string...
foreach (ToolChain *current, ToolChainManager::instance()->toolChains()) {
foreach (ToolChain *current, ToolChainManager::toolChains()) {
if (current->targetAbi().toString() == id)
return setToolChain(k, current);
}
......@@ -219,16 +219,15 @@ IOutputParser *ToolChainKitInformation::createOutputParser(const Kit *k) const
ToolChain *ToolChainKitInformation::toolChain(const Kit *k)
{
QTC_ASSERT(ToolChainManager::instance()->isLoaded(), return 0);
QTC_ASSERT(ToolChainManager::isLoaded(), return 0);
if (!k)
return 0;
return ToolChainManager::instance()
->findToolChain(k->value(Core::Id(TOOLCHAIN_INFORMATION)).toString());
return ToolChainManager::findToolChain(k->value(TOOLCHAIN_INFORMATION).toString());
}
void ToolChainKitInformation::setToolChain(Kit *k, ToolChain *tc)
{
k->setValue(Core::Id(TOOLCHAIN_INFORMATION), tc ? tc->id() : QString());
k->setValue(TOOLCHAIN_INFORMATION, tc ? tc->id() : QString());
}
QString ToolChainKitInformation::msgNoToolChainInTarget()
......
......@@ -116,13 +116,11 @@ void SysRootInformationConfigWidget::pathWasChanged()
ToolChainInformationConfigWidget::ToolChainInformationConfigWidget(Kit *k, bool sticky) :
KitConfigWidget(k, sticky), m_isReadOnly(false)
{
ToolChainManager *tcm = ToolChainManager::instance();
m_comboBox = new QComboBox;
m_comboBox->setEnabled(false);
m_comboBox->setToolTip(toolTip());
foreach (ToolChain *tc, tcm->toolChains())
foreach (ToolChain *tc, ToolChainManager::toolChains())
toolChainAdded(tc);
updateComboBox();
......@@ -134,6 +132,7 @@ ToolChainInformationConfigWidget::ToolChainInformationConfigWidget(Kit *k, bool
m_manageButton->setContentsMargins(0, 0, 0, 0);
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageToolChains()));
QObject *tcm = ToolChainManager::instance();
connect(tcm, SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)),
this, SLOT(toolChainAdded(ProjectExplorer::ToolChain*)));
connect(tcm, SIGNAL(toolChainRemoved(ProjectExplorer::ToolChain*)),
......@@ -211,8 +210,7 @@ void ToolChainInformationConfigWidget::manageToolChains()
void ToolChainInformationConfigWidget::currentToolChainChanged(int idx)
{
const QString id = m_comboBox->itemData(idx).toString();
ToolChain *tc = ToolChainManager::instance()->findToolChain(id);
ToolChainKitInformation::setToolChain(m_kit, tc);
ToolChainKitInformation::setToolChain(m_kit, ToolChainManager::findToolChain(id));
}
void ToolChainInformationConfigWidget::updateComboBox()
......
......@@ -1108,7 +1108,7 @@ void ProjectExplorerPlugin::extensionsInitialized()
DeviceManager::instance()->addDevice(IDevice::Ptr(new DesktopDevice));
DeviceManager::instance()->load();
d->m_toolChainManager->restoreToolChains();
ToolChainManager::restoreToolChains();
d->m_kitManager->restoreKits();
}
......
......@@ -52,6 +52,8 @@
#include <QFile>
#include <QMessageBox>
using namespace Utils;
namespace ProjectExplorer {
namespace Internal {
......@@ -111,11 +113,8 @@ QVariantMap UserFileVersionHandler::renameKeys(const QList<Change> &changes, QVa
} // Internal
} // ProjectExplorer
using namespace ProjectExplorer;
using namespace Internal;
using Utils::PersistentSettingsReader;
using Utils::PersistentSettingsWriter;
namespace {
......@@ -669,7 +668,7 @@ bool SettingsAccessor::saveSettings(const QVariantMap &map) const
backupUserFile();
SettingsData settings(map);
settings.m_fileName = Utils::FileName::fromString(defaultFileName(m_userFileAcessor.suffix()));
settings.m_fileName = FileName::fromString(defaultFileName(m_userFileAcessor.suffix()));
const QVariant &shared = m_project->property(SHARED_SETTINGS);
if (shared.isValid())
trackUserStickySettings(settings.m_map, shared.toMap());
......@@ -746,7 +745,7 @@ int SettingsAccessor::currentVersion() const
void SettingsAccessor::backupUserFile() const
{
SettingsData oldSettings;
oldSettings.m_fileName = Utils::FileName::fromString(defaultFileName(m_userFileAcessor.suffix()));
oldSettings.m_fileName = FileName::fromString(defaultFileName(m_userFileAcessor.suffix()));
if (!m_userFileAcessor.readFile(&oldSettings))
return;
......@@ -839,7 +838,7 @@ SettingsAccessor::SettingsData SettingsAccessor::readSharedSettings() const
{
SettingsData sharedSettings;
QString fn = project()->projectFilePath() + m_sharedFileAcessor.suffix();
sharedSettings.m_fileName = Utils::FileName::fromString(fn);
sharedSettings.m_fileName = FileName::fromString(fn);
if (!m_sharedFileAcessor.readFile(&sharedSettings))
return sharedSettings;
......@@ -879,7 +878,7 @@ SettingsAccessor::SettingsData SettingsAccessor::findBestSettings(const QStringL
foreach (const QString &file, candidates) {
tmp.clear();
tmp.m_fileName = Utils::FileName::fromString(file);
tmp.m_fileName = FileName::fromString(file);
if (!m_userFileAcessor.readFile(&tmp))
continue;
......@@ -1026,7 +1025,7 @@ bool SettingsAccessor::FileAccessor::writeFile(const SettingsData *settings) con
{
if (!m_writer || m_writer->fileName() != settings->fileName()) {
delete m_writer;
m_writer = new Utils::PersistentSettingsWriter(settings->fileName(), QLatin1String("QtCreatorProject"));
m_writer = new PersistentSettingsWriter(settings->fileName(), QLatin1String("QtCreatorProject"));
}
QVariantMap data;
......@@ -2011,7 +2010,7 @@ static QVariant version8ArgNodeHandler(const QVariant &var)
{
QString ret;
foreach (const QVariant &svar, var.toList()) {
if (Utils::HostOsInfo::isAnyUnixHost()) {
if (HostOsInfo::isAnyUnixHost()) {
// We don't just addArg, so we don't disarm existing env expansions.
// This is a bit fuzzy logic ...
QString s = svar.toString();
......@@ -2020,10 +2019,10 @@ static QVariant version8ArgNodeHandler(const QVariant &var)
s.replace(QLatin1Char('`'), QLatin1String("\\`"));
if (s != svar.toString() || hasSpecialChars(s))
s.prepend(QLatin1Char('"')).append(QLatin1Char('"'));
Utils::QtcProcess::addArgs(&ret, s);
QtcProcess::addArgs(&ret, s);
} else {
// Under windows, env expansions cannot be quoted anyway.
Utils::QtcProcess::addArg(&ret, svar.toString());
QtcProcess::addArg(&ret, svar.toString());
}
}
return QVariant(ret);
......@@ -2034,7 +2033,7 @@ static QVariant version8LameArgNodeHandler(const QVariant &var)
{
QString ret;
foreach (const QVariant &svar, var.toList())
Utils::QtcProcess::addArgs(&ret, svar.toString());
QtcProcess::addArgs(&ret, svar.toString());
return QVariant(ret);
}
......@@ -2079,7 +2078,7 @@ static const char * const envExpandedKeys[] = {
static QString version8NewVar(const QString &old)
{
QString ret = old;
if (Utils::HostOsInfo::isAnyUnixHost()) {
if (HostOsInfo::isAnyUnixHost()) {
ret.prepend(QLatin1String("${"));
ret.append(QLatin1Char('}'));
} else {
......@@ -2099,7 +2098,7 @@ static QVariant version8EnvNodeTransform(const QVariant &var)
QLatin1String("%{sourceDir}"));
result.replace(QRegExp(QLatin1String("%BUILDDIR%|\\$(BUILDDIR\\b|\\{BUILDDIR\\})")),
QLatin1String("%{buildDir}"));
if (Utils::HostOsInfo::isAnyUnixHost()) {
if (HostOsInfo::isAnyUnixHost()) {
for (int vStart = -1, i = 0; i < result.length(); ) {
QChar c = result.at(i++);
if (c == QLatin1Char('%')) {
......@@ -2414,35 +2413,35 @@ QVariantMap Version11Handler::update(Project *project, const QVariantMap &map)
Kit *tmpKit = rawKit;
if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.AndroidDeviceTarget")) {
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/android/images/QtAndroid.png")));
tmpKit->setIconPath(FileName::fromString(QLatin1String(":/android/images/QtAndroid.png")));
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("Desktop"));
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString());
} else if (oldTargetId == QLatin1String("RemoteLinux.EmbeddedLinuxTarget")) {
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":///DESKTOP///")));
tmpKit->setIconPath(FileName::fromString(QLatin1String(":///DESKTOP///")));
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("GenericLinuxOsType"));
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString());
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.HarmattanDeviceTarget")) {
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/projectexplorer/images/MaemoDevice.png")));
tmpKit->setIconPath(FileName::fromString(QLatin1String(":/projectexplorer/images/MaemoDevice.png")));
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("HarmattanOsType"));
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString());
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.MaemoDeviceTarget")) {
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/projectexplorer/images/MaemoDevice.png")));
tmpKit->setIconPath(FileName::fromString(QLatin1String(":/projectexplorer/images/MaemoDevice.png")));
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("Maemo5OsType"));
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString());
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.MeegoDeviceTarget")) {
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/projectexplorer/images/MaemoDevice.png")));
tmpKit->setIconPath(FileName::fromString(QLatin1String(":/projectexplorer/images/MaemoDevice.png")));
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("MeegoOsType"));
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString());
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.S60DeviceTarget")) {
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/projectexplorer/images/SymbianDevice.png")));
tmpKit->setIconPath(FileName::fromString(QLatin1String(":/projectexplorer/images/SymbianDevice.png")));
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("Qt4ProjectManager.SymbianDevice"));
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString::fromLatin1("Symbian Device"));
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.QtSimulatorTarget")) {
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":/projectexplorer/images/Simulator.png")));
tmpKit->setIconPath(FileName::fromString(QLatin1String(":/projectexplorer/images/Simulator.png")));
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("Desktop"));
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString::fromLatin1("Desktop Device"));
} else {
tmpKit->setIconPath(Utils::FileName::fromString(QLatin1String(":///DESKTOP///")));
tmpKit->setIconPath(FileName::fromString(QLatin1String(":///DESKTOP///")));
tmpKit->setValue(Core::Id("PE.Profile.DeviceType"), QString::fromLatin1("Desktop"));
tmpKit->setValue(Core::Id("PE.Profile.Device"), QString::fromLatin1("Desktop Device"));
}
......@@ -2474,8 +2473,8 @@ QVariantMap Version11Handler::update(Project *project, const QVariantMap &map)
for (int j = i + 2; j < split.count(); ++j)
debuggerPath = debuggerPath + QLatin1Char('.') + split.at(j);
foreach (ToolChain *tc, ToolChainManager::instance()->toolChains()) {
if ((tc->compilerCommand() == Utils::FileName::fromString(compilerPath))
foreach (ToolChain *tc, ToolChainManager::toolChains()) {
if ((tc->compilerCommand() == FileName::fromString(compilerPath))
&& (tc->targetAbi() == compilerAbi)) {
tcId = tc->id();
break;
......@@ -2494,7 +2493,7 @@ QVariantMap Version11Handler::update(Project *project, const QVariantMap &map)
if (m_toolChainExtras.contains(origTcId)) {
debuggerPath = m_toolChainExtras.value(origTcId).m_debugger;
if (!debuggerPath.isEmpty() && !QFileInfo(debuggerPath).isAbsolute())
debuggerPath = Utils::Environment::systemEnvironment().searchInPath(debuggerPath);
debuggerPath = Environment::systemEnvironment().searchInPath(debuggerPath);
if (debuggerPath.contains(QLatin1String("cdb")))
debuggerEngine = 4; // CDB
mkspec = m_toolChainExtras.value(origTcId).m_mkspec;
......@@ -2650,7 +2649,7 @@ void Version11Handler::addRunConfigurations(Kit *k,
if (!proFile.isEmpty()) {
QString newId = rcData.value(QLatin1String("ProjectExplorer.ProjectConfiguration.Id")).toString();
newId.append(QLatin1Char(':'));
Utils::FileName fn = Utils::FileName::fromString(projectDir);
FileName fn = FileName::fromString(projectDir);
fn.appendPath(proFile);
newId.append(fn.toString());
rcData.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"), newId);
......@@ -2665,7 +2664,7 @@ void Version11Handler::addRunConfigurations(Kit *k,
static QString targetRoot(const QString &qmakePath)
{
return QDir::cleanPath(qmakePath).remove(QLatin1String("/bin/qmake" QTC_HOST_EXE_SUFFIX),
Utils::HostOsInfo::fileNameCaseSensitivity());
HostOsInfo::fileNameCaseSensitivity());
}
static QString maddeRoot(const QString &qmakePath)
......@@ -2678,8 +2677,8 @@ static QString maddeRoot(const QString &qmakePath)
void Version11Handler::parseQtversionFile()
{
QFileInfo settingsLocation(Core::ICore::settings()->fileName());
Utils::FileName fileName = Utils::FileName::fromString(settingsLocation.absolutePath() + QLatin1String("/qtversion.xml"));
Utils::PersistentSettingsReader reader;
FileName fileName = FileName::fromString(settingsLocation.absolutePath() + QLatin1String("/qtversion.xml"));
PersistentSettingsReader reader;
if (!reader.load(fileName)) {
qWarning("Failed to open legacy qtversions.xml file.");
return;
......@@ -2721,8 +2720,8 @@ void Version11Handler::parseQtversionFile()
void Version11Handler::parseToolChainFile()
{
QFileInfo settingsLocation(Core::ICore::settings()->fileName());
Utils::FileName fileName = Utils::FileName::fromString(settingsLocation.absolutePath() + QLatin1String("/toolChains.xml"));
Utils::PersistentSettingsReader reader;
FileName fileName = FileName::fromString(settingsLocation.absolutePath() + QLatin1String("/toolChains.xml"));
PersistentSettingsReader reader;
if (!reader.load(fileName)) {
qWarning("Failed to open legacy toolChains.xml file.");
return;
......
......@@ -131,7 +131,7 @@ QList<Utils::FileName> ToolChain::suggestedMkspecList() const
Utils::FileName ToolChain::suggestedDebugger() const
{
return ToolChainManager::instance()->defaultDebugger(targetAbi());
return ToolChainManager::defaultDebugger(targetAbi());
}
bool ToolChain::canClone() const
......@@ -169,7 +169,7 @@ QVariantMap ToolChain::toMap() const
void ToolChain::toolChainUpdated()
{
ToolChainManager::instance()->notifyAboutUpdate(this);
ToolChainManager::notifyAboutUpdate(this);
}
void ToolChain::setAutoDetected(bool autodetect)
......
......@@ -53,19 +53,15 @@ static const char DEFAULT_DEBUGGER_PATH_KEY[] = "DefaultDebugger.Path.";
static const char TOOLCHAIN_FILENAME[] = "/qtcreator/toolchains.xml";
static const char LEGACY_TOOLCHAIN_FILENAME[] = "/toolChains.xml";
using Utils::PersistentSettingsWriter;
using Utils::PersistentSettingsReader;
using namespace Utils;
static Utils::FileName settingsFileName(const QString &path)
static FileName settingsFileName(const QString &path)
{
QFileInfo settingsLocation(Core::ICore::settings()->fileName());
return Utils::FileName::fromString(settingsLocation.absolutePath() + path);
return FileName::fromString(settingsLocation.absolutePath() + path);
}
namespace ProjectExplorer {
ToolChainManager *ToolChainManager::m_instance = 0;
namespace Internal {
// --------------------------------------------------------------------------
......@@ -75,20 +71,15 @@ namespace Internal {
class ToolChainManagerPrivate
{
public:
ToolChainManagerPrivate(ToolChainManager *parent);
ToolChainManagerPrivate() : m_writer(0) {}
~ToolChainManagerPrivate();
ToolChainManager *q;
QMap<QString, Utils::FileName> m_abiToDebugger;
Utils::PersistentSettingsWriter *m_writer;
QMap<QString, FileName> m_abiToDebugger;
PersistentSettingsWriter *m_writer;