diff options
author | hjk <hjk121@nokiamail.com> | 2013-08-29 13:14:19 +0200 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2013-08-29 16:45:25 +0200 |
commit | e4b2947c6f8b42c0b62abbb01b1aec9e5362e556 (patch) | |
tree | 661aedd6f35bdd3d38a471bc6f5bcffc9608eee0 /src/plugins | |
parent | c10ae974eb6c6df7878b7a9b8cc58006e29ff192 (diff) | |
download | qt-creator-e4b2947c6f8b42c0b62abbb01b1aec9e5362e556.tar.gz |
ProjectExplorer et al: Code cosmetics
Apply static 'pattern' for ToolChainManager, de-noise using code.
Change-Id: I196dc6f39dc2c61b1783aecad3faa0b23849e00a
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins')
18 files changed, 392 insertions, 414 deletions
diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 15d25850e0..accb249fd2 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -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)) diff --git a/src/plugins/android/androidgdbserverkitinformation.cpp b/src/plugins/android/androidgdbserverkitinformation.cpp index 45929e522b..b6de6e8b3a 100644 --- a/src/plugins/android/androidgdbserverkitinformation.cpp +++ b/src/plugins/android/androidgdbserverkitinformation.cpp @@ -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 diff --git a/src/plugins/android/androidgdbserverkitinformation.h b/src/plugins/android/androidgdbserverkitinformation.h index 469cde707d..7173264c78 100644 --- a/src/plugins/android/androidgdbserverkitinformation.h +++ b/src/plugins/android/androidgdbserverkitinformation.h @@ -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 { diff --git a/src/plugins/android/androidsettingspage.cpp b/src/plugins/android/androidsettingspage.cpp index 28722c3e30..95cb4af425 100644 --- a/src/plugins/android/androidsettingspage.cpp +++ b/src/plugins/android/androidsettingspage.cpp @@ -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); } } diff --git a/src/plugins/debugger/debuggerkitconfigwidget.cpp b/src/plugins/debugger/debuggerkitconfigwidget.cpp index db1fbf5de8..649b99d9d8 100644 --- a/src/plugins/debugger/debuggerkitconfigwidget.cpp +++ b/src/plugins/debugger/debuggerkitconfigwidget.cpp @@ -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)); } diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp index 5c3e2f8a4d..364738a6a6 100644 --- a/src/plugins/projectexplorer/kitinformation.cpp +++ b/src/plugins/projectexplorer/kitinformation.cpp @@ -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() diff --git a/src/plugins/projectexplorer/kitinformationconfigwidget.cpp b/src/plugins/projectexplorer/kitinformationconfigwidget.cpp index baf9f71fa6..7eae10ae2c 100644 --- a/src/plugins/projectexplorer/kitinformationconfigwidget.cpp +++ b/src/plugins/projectexplorer/kitinformationconfigwidget.cpp @@ -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() diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 544e18b7cd..4b5bd7d558 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -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(); } diff --git a/src/plugins/projectexplorer/settingsaccessor.cpp b/src/plugins/projectexplorer/settingsaccessor.cpp index 4c5f76347d..2b4911d83e 100644 --- a/src/plugins/projectexplorer/settingsaccessor.cpp +++ b/src/plugins/projectexplorer/settingsaccessor.cpp @@ -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; diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index ec532b9df6..5ad6d777dc 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -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) diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp index 91bef09955..deef447278 100644 --- a/src/plugins/projectexplorer/toolchainmanager.cpp +++ b/src/plugins/projectexplorer/toolchainmanager.cpp @@ -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; QList<ToolChain *> m_toolChains; }; -ToolChainManagerPrivate::ToolChainManagerPrivate(ToolChainManager *parent) - : q(parent), m_writer(0) -{ } - ToolChainManagerPrivate::~ToolChainManagerPrivate() { qDeleteAll(m_toolChains); @@ -96,24 +87,25 @@ ToolChainManagerPrivate::~ToolChainManagerPrivate() delete m_writer; } +static ToolChainManager *m_instance = 0; +static ToolChainManagerPrivate *d; + } // namespace Internal +using namespace Internal; + // -------------------------------------------------------------------------- // ToolChainManager // -------------------------------------------------------------------------- -ToolChainManager *ToolChainManager::instance() -{ - return m_instance; -} - ToolChainManager::ToolChainManager(QObject *parent) : - QObject(parent), - d(new Internal::ToolChainManagerPrivate(this)) + QObject(parent) { Q_ASSERT(!m_instance); m_instance = this; + d = new ToolChainManagerPrivate; + connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveToolChains())); connect(this, SIGNAL(toolChainAdded(ProjectExplorer::ToolChain*)), @@ -124,11 +116,78 @@ ToolChainManager::ToolChainManager(QObject *parent) : this, SIGNAL(toolChainsChanged())); } +ToolChainManager::~ToolChainManager() +{ + delete d; + m_instance = 0; +} + +QObject *ToolChainManager::instance() +{ + return m_instance; +} + +static QList<ToolChain *> restoreFromFile(const FileName &fileName) +{ + QList<ToolChain *> result; + + PersistentSettingsReader reader; + if (!reader.load(fileName)) + return result; + QVariantMap data = reader.restoreValues(); + + // Check version: + int version = data.value(QLatin1String(TOOLCHAIN_FILE_VERSION_KEY), 0).toInt(); + if (version < 1) + return result; + + // Read default debugger settings (if any) + int count = data.value(QLatin1String(DEFAULT_DEBUGGER_COUNT_KEY)).toInt(); + for (int i = 0; i < count; ++i) { + const QString abiKey = QString::fromLatin1(DEFAULT_DEBUGGER_ABI_KEY) + QString::number(i); + if (!data.contains(abiKey)) + continue; + const QString pathKey = QString::fromLatin1(DEFAULT_DEBUGGER_PATH_KEY) + QString::number(i); + if (!data.contains(pathKey)) + continue; + d->m_abiToDebugger.insert(data.value(abiKey).toString(), + FileName::fromString(data.value(pathKey).toString())); + } + + QList<ToolChainFactory *> factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>(); + + count = data.value(QLatin1String(TOOLCHAIN_COUNT_KEY), 0).toInt(); + for (int i = 0; i < count; ++i) { + const QString key = QString::fromLatin1(TOOLCHAIN_DATA_KEY) + QString::number(i); + if (!data.contains(key)) + break; + + const QVariantMap tcMap = data.value(key).toMap(); + + bool restored = false; + foreach (ToolChainFactory *f, factories) { + if (f->canRestore(tcMap)) { + if (ToolChain *tc = f->restore(tcMap)) { + result.append(tc); + restored = true; + break; + } + } + } + if (!restored) + qWarning("Warning: Unable to restore compiler '%s' stored in %s.", + qPrintable(ToolChainFactory::idFromMap(tcMap)), + qPrintable(fileName.toUserOutput())); + } + + return result; +} + void ToolChainManager::restoreToolChains() { QTC_ASSERT(!d->m_writer, return); d->m_writer = - new Utils::PersistentSettingsWriter(settingsFileName(QLatin1String(TOOLCHAIN_FILENAME)), QLatin1String("QtCreatorToolChains")); + new PersistentSettingsWriter(settingsFileName(QLatin1String(TOOLCHAIN_FILENAME)), QLatin1String("QtCreatorToolChains")); QList<ToolChain *> tcsToRegister; QList<ToolChain *> tcsToCheck; @@ -136,7 +195,7 @@ void ToolChainManager::restoreToolChains() // read all tool chains from SDK QFileInfo systemSettingsFile(Core::ICore::settings(QSettings::SystemScope)->fileName()); QList<ToolChain *> readTcs = - restoreToolChains(Utils::FileName::fromString(systemSettingsFile.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME))); + restoreFromFile(FileName::fromString(systemSettingsFile.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME))); // make sure we mark these as autodetected! foreach (ToolChain *tc, readTcs) tc->setAutoDetected(true); @@ -146,10 +205,10 @@ void ToolChainManager::restoreToolChains() // read all tool chains from user file. // Read legacy settings once and keep them around... - Utils::FileName fileName = settingsFileName(QLatin1String(TOOLCHAIN_FILENAME)); + FileName fileName = settingsFileName(QLatin1String(TOOLCHAIN_FILENAME)); if (!fileName.toFileInfo().exists()) fileName = settingsFileName(QLatin1String(LEGACY_TOOLCHAIN_FILENAME)); - readTcs = restoreToolChains(fileName); + readTcs = restoreFromFile(fileName); foreach (ToolChain *tc, readTcs) { if (tc->isAutoDetected()) @@ -207,13 +266,7 @@ void ToolChainManager::restoreToolChains() foreach (ToolChain *tc, tcsToRegister) registerToolChain(tc); - emit toolChainsLoaded(); -} - -ToolChainManager::~ToolChainManager() -{ - delete d; - m_instance = 0; + emit m_instance->toolChainsLoaded(); } void ToolChainManager::saveToolChains() @@ -237,68 +290,12 @@ void ToolChainManager::saveToolChains() // Do not save default debuggers! Those are set by the SDK! } -QList<ToolChain *> ToolChainManager::restoreToolChains(const Utils::FileName &fileName) -{ - QList<ToolChain *> result; - - PersistentSettingsReader reader; - if (!reader.load(fileName)) - return result; - QVariantMap data = reader.restoreValues(); - - // Check version: - int version = data.value(QLatin1String(TOOLCHAIN_FILE_VERSION_KEY), 0).toInt(); - if (version < 1) - return result; - - // Read default debugger settings (if any) - int count = data.value(QLatin1String(DEFAULT_DEBUGGER_COUNT_KEY)).toInt(); - for (int i = 0; i < count; ++i) { - const QString abiKey = QString::fromLatin1(DEFAULT_DEBUGGER_ABI_KEY) + QString::number(i); - if (!data.contains(abiKey)) - continue; - const QString pathKey = QString::fromLatin1(DEFAULT_DEBUGGER_PATH_KEY) + QString::number(i); - if (!data.contains(pathKey)) - continue; - d->m_abiToDebugger.insert(data.value(abiKey).toString(), - Utils::FileName::fromString(data.value(pathKey).toString())); - } - - QList<ToolChainFactory *> factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>(); - - count = data.value(QLatin1String(TOOLCHAIN_COUNT_KEY), 0).toInt(); - for (int i = 0; i < count; ++i) { - const QString key = QString::fromLatin1(TOOLCHAIN_DATA_KEY) + QString::number(i); - if (!data.contains(key)) - break; - - const QVariantMap tcMap = data.value(key).toMap(); - - bool restored = false; - foreach (ToolChainFactory *f, factories) { - if (f->canRestore(tcMap)) { - if (ToolChain *tc = f->restore(tcMap)) { - result.append(tc); - restored = true; - break; - } - } - } - if (!restored) - qWarning("Warning: Unable to restore compiler '%s' stored in %s.", - qPrintable(ToolChainFactory::idFromMap(tcMap)), - qPrintable(fileName.toUserOutput())); - } - - return result; -} - -QList<ToolChain *> ToolChainManager::toolChains() const +QList<ToolChain *> ToolChainManager::toolChains() { return d->m_toolChains; } -QList<ToolChain *> ToolChainManager::findToolChains(const Abi &abi) const +QList<ToolChain *> ToolChainManager::findToolChains(const Abi &abi) { QList<ToolChain *> result; foreach (ToolChain *tc, d->m_toolChains) { @@ -309,7 +306,7 @@ QList<ToolChain *> ToolChainManager::findToolChains(const Abi &abi) const return result; } -ToolChain *ToolChainManager::findToolChain(const QString &id) const +ToolChain *ToolChainManager::findToolChain(const QString &id) { if (id.isEmpty()) return 0; @@ -321,21 +318,21 @@ ToolChain *ToolChainManager::findToolChain(const QString &id) const return 0; } -Utils::FileName ToolChainManager::defaultDebugger(const Abi &abi) const +FileName ToolChainManager::defaultDebugger(const Abi &abi) { return d->m_abiToDebugger.value(abi.toString()); } -bool ToolChainManager::isLoaded() const +bool ToolChainManager::isLoaded() { return d->m_writer; } -void ToolChainManager::notifyAboutUpdate(ProjectExplorer::ToolChain *tc) +void ToolChainManager::notifyAboutUpdate(ToolChain *tc) { if (!tc || !d->m_toolChains.contains(tc)) return; - emit toolChainUpdated(tc); + emit m_instance->toolChainUpdated(tc); } bool ToolChainManager::registerToolChain(ToolChain *tc) @@ -351,7 +348,7 @@ bool ToolChainManager::registerToolChain(ToolChain *tc) } d->m_toolChains.append(tc); - emit toolChainAdded(tc); + emit m_instance->toolChainAdded(tc); return true; } @@ -360,7 +357,7 @@ void ToolChainManager::deregisterToolChain(ToolChain *tc) if (!tc || !d->m_toolChains.contains(tc)) return; d->m_toolChains.removeOne(tc); - emit toolChainRemoved(tc); + emit m_instance->toolChainRemoved(tc); delete tc; } diff --git a/src/plugins/projectexplorer/toolchainmanager.h b/src/plugins/projectexplorer/toolchainmanager.h index 2202643aac..e9e1af70db 100644 --- a/src/plugins/projectexplorer/toolchainmanager.h +++ b/src/plugins/projectexplorer/toolchainmanager.h @@ -32,22 +32,18 @@ #include "projectexplorer_export.h" - #include <QList> #include <QObject> #include <QString> namespace Utils { class FileName; } + namespace ProjectExplorer { + class ProjectExplorerPlugin; class ToolChain; -class ToolChainFactory; class Abi; -namespace Internal { -class ToolChainManagerPrivate; -} - // -------------------------------------------------------------------------- // ToolChainManager // -------------------------------------------------------------------------- @@ -57,21 +53,21 @@ class PROJECTEXPLORER_EXPORT ToolChainManager : public QObject Q_OBJECT public: - static ToolChainManager *instance(); + static QObject *instance(); ~ToolChainManager(); - QList<ToolChain *> toolChains() const; - QList<ToolChain *> findToolChains(const Abi &abi) const; - ToolChain *findToolChain(const QString &id) const; + static QList<ToolChain *> toolChains(); + static QList<ToolChain *> findToolChains(const Abi &abi); + static ToolChain *findToolChain(const QString &id); - Utils::FileName defaultDebugger(const Abi &abi) const; + static Utils::FileName defaultDebugger(const Abi &abi); - bool isLoaded() const; + static bool isLoaded(); -public slots: - bool registerToolChain(ProjectExplorer::ToolChain *tc); - void deregisterToolChain(ProjectExplorer::ToolChain *tc); + static bool registerToolChain(ToolChain *tc); + static void deregisterToolChain(ToolChain *tc); +public slots: void saveToolChains(); signals: @@ -80,9 +76,9 @@ signals: void toolChainRemoved(ProjectExplorer::ToolChain *); // Tool chain was updated. void toolChainUpdated(ProjectExplorer::ToolChain *); - // Something changed: + // Something changed. void toolChainsChanged(); - + // void toolChainsLoaded(); private: @@ -90,16 +86,9 @@ private: // Make sure the this is only called after all // Tool chain Factories are registered! - void restoreToolChains(); - QList<ToolChain *> restoreToolChains(const Utils::FileName &fileName); - - void notifyAboutUpdate(ProjectExplorer::ToolChain *); - - Internal::ToolChainManagerPrivate *const d; - - static ToolChainManager *m_instance; + static void restoreToolChains(); + static void notifyAboutUpdate(ToolChain *); - friend class Internal::ToolChainManagerPrivate; // for the restoreToolChains methods friend class ProjectExplorerPlugin; // for constructor friend class ToolChain; }; diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp index 61219d7865..b8adc84943 100644 --- a/src/plugins/projectexplorer/toolchainoptionspage.cpp +++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp @@ -106,9 +106,8 @@ ToolChainModel::ToolChainModel(QObject *parent) : m_autoRoot = new ToolChainNode(m_root); m_manualRoot = new ToolChainNode(m_root); - foreach (ToolChain *tc, ToolChainManager::instance()->toolChains()) { + foreach (ToolChain *tc, ToolChainManager::toolChains()) addToolChain(tc); - } } ToolChainModel::~ToolChainModel() @@ -278,7 +277,7 @@ void ToolChainModel::apply() QList<ToolChainNode *> nodes = m_toRemoveList; foreach (ToolChainNode *n, nodes) { Q_ASSERT(!n->parent); - ToolChainManager::instance()->deregisterToolChain(n->toolChain); + ToolChainManager::deregisterToolChain(n->toolChain); } Q_ASSERT(m_toRemoveList.isEmpty()); @@ -299,7 +298,7 @@ void ToolChainModel::apply() QStringList removedTcs; nodes = m_toAddList; foreach (ToolChainNode *n, nodes) { - if (!ToolChainManager::instance()->registerToolChain(n->toolChain)) + if (!ToolChainManager::registerToolChain(n->toolChain)) removedTcs << n->toolChain->displayName(); } // diff --git a/src/plugins/qnx/blackberryconfiguration.cpp b/src/plugins/qnx/blackberryconfiguration.cpp index e19250008c..640fb648f3 100644 --- a/src/plugins/qnx/blackberryconfiguration.cpp +++ b/src/plugins/qnx/blackberryconfiguration.cpp @@ -51,10 +51,14 @@ #include <QDir> #include <QMessageBox> +using namespace ProjectExplorer; +using namespace QtSupport; +using namespace Utils; + namespace Qnx { namespace Internal { -BlackBerryConfiguration::BlackBerryConfiguration(const Utils::FileName &ndkEnvFile, bool isAutoDetected, +BlackBerryConfiguration::BlackBerryConfiguration(const FileName &ndkEnvFile, bool isAutoDetected, const QString &displayName) { Q_ASSERT(!QFileInfo(ndkEnvFile.toString()).isDir()); @@ -69,14 +73,14 @@ BlackBerryConfiguration::BlackBerryConfiguration(const Utils::FileName &ndkEnvFi m_targetName = ndkTarget.split(sep).first().split(QDir::separator()).last(); if (QDir(ndkTarget).exists()) - m_sysRoot = Utils::FileName::fromString(ndkTarget); + m_sysRoot = FileName::fromString(ndkTarget); QString qnxHost = m_qnxEnv.value(QLatin1String("QNX_HOST")); - Utils::FileName qmake4Path = QnxUtils::executableWithExtension(Utils::FileName::fromString(qnxHost + QLatin1String("/usr/bin/qmake"))); - Utils::FileName qmake5Path = QnxUtils::executableWithExtension(Utils::FileName::fromString(qnxHost + QLatin1String("/usr/bin/qt5/qmake"))); - Utils::FileName gccPath = QnxUtils::executableWithExtension(Utils::FileName::fromString(qnxHost + QLatin1String("/usr/bin/qcc"))); - Utils::FileName deviceGdbPath = QnxUtils::executableWithExtension(Utils::FileName::fromString(qnxHost + QLatin1String("/usr/bin/ntoarm-gdb"))); - Utils::FileName simulatorGdbPath = QnxUtils::executableWithExtension(Utils::FileName::fromString(qnxHost + QLatin1String("/usr/bin/ntox86-gdb"))); + FileName qmake4Path = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/qmake"))); + FileName qmake5Path = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/qt5/qmake"))); + FileName gccPath = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/qcc"))); + FileName deviceGdbPath = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/ntoarm-gdb"))); + FileName simulatorGdbPath = QnxUtils::executableWithExtension(FileName::fromString(qnxHost + QLatin1String("/usr/bin/ntox86-gdb"))); if (qmake4Path.toFileInfo().exists()) m_qmake4BinaryFile = qmake4Path; @@ -117,8 +121,8 @@ bool BlackBerryConfiguration::isAutoDetected() const bool BlackBerryConfiguration::isActive() const { - QtSupport::BaseQtVersion *qt4Version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(m_qmake4BinaryFile); - QtSupport::BaseQtVersion *qt5Version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(m_qmake5BinaryFile); + BaseQtVersion *qt4Version = QtVersionManager::instance()->qtVersionForQMakeBinary(m_qmake4BinaryFile); + BaseQtVersion *qt5Version = QtVersionManager::instance()->qtVersionForQMakeBinary(m_qmake5BinaryFile); return (qt4Version || qt5Version); } @@ -128,37 +132,37 @@ bool BlackBerryConfiguration::isValid() const || m_deviceDebuger.isEmpty() || m_simulatorDebuger.isEmpty()); } -Utils::FileName BlackBerryConfiguration::ndkEnvFile() const +FileName BlackBerryConfiguration::ndkEnvFile() const { return m_ndkEnvFile; } -Utils::FileName BlackBerryConfiguration::qmake4BinaryFile() const +FileName BlackBerryConfiguration::qmake4BinaryFile() const { return m_qmake4BinaryFile; } -Utils::FileName BlackBerryConfiguration::qmake5BinaryFile() const +FileName BlackBerryConfiguration::qmake5BinaryFile() const { return m_qmake5BinaryFile; } -Utils::FileName BlackBerryConfiguration::gccCompiler() const +FileName BlackBerryConfiguration::gccCompiler() const { return m_gccCompiler; } -Utils::FileName BlackBerryConfiguration::deviceDebuger() const +FileName BlackBerryConfiguration::deviceDebuger() const { return m_deviceDebuger; } -Utils::FileName BlackBerryConfiguration::simulatorDebuger() const +FileName BlackBerryConfiguration::simulatorDebuger() const { return m_simulatorDebuger; } -Utils::FileName BlackBerryConfiguration::sysRoot() const +FileName BlackBerryConfiguration::sysRoot() const { return m_sysRoot; } @@ -168,32 +172,32 @@ QMultiMap<QString, QString> BlackBerryConfiguration::qnxEnv() const return m_qnxEnv; } -void BlackBerryConfiguration::setupConfigurationPerQtVersion(const Utils::FileName &qmakePath, ProjectExplorer::GccToolChain *tc) +void BlackBerryConfiguration::setupConfigurationPerQtVersion(const FileName &qmakePath, GccToolChain *tc) { if (qmakePath.isEmpty() || !tc) return; - QtSupport::BaseQtVersion *qtVersion = createQtVersion(qmakePath); - ProjectExplorer::Kit *deviceKit = createKit(ArmLeV7, qtVersion, tc); - ProjectExplorer::Kit *simulatorKit = createKit(X86, qtVersion, tc); + BaseQtVersion *qtVersion = createQtVersion(qmakePath); + Kit *deviceKit = createKit(ArmLeV7, qtVersion, tc); + Kit *simulatorKit = createKit(X86, qtVersion, tc); if (qtVersion && tc && deviceKit && simulatorKit) { if (!qtVersion->qtAbis().isEmpty()) tc->setTargetAbi(qtVersion->qtAbis().first()); // register - QtSupport::QtVersionManager::instance()->addVersion(qtVersion); - ProjectExplorer::ToolChainManager::instance()->registerToolChain(tc); - ProjectExplorer::KitManager::registerKit(deviceKit); - ProjectExplorer::KitManager::registerKit(simulatorKit); + QtVersionManager::instance()->addVersion(qtVersion); + ToolChainManager::registerToolChain(tc); + KitManager::registerKit(deviceKit); + KitManager::registerKit(simulatorKit); } } -QtSupport::BaseQtVersion *BlackBerryConfiguration::createQtVersion(const Utils::FileName &qmakePath) +BaseQtVersion *BlackBerryConfiguration::createQtVersion(const FileName &qmakePath) { if (qmakePath.isEmpty()) return 0; QString cpuDir = m_qnxEnv.value(QLatin1String("CPUVARDIR")); - QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(qmakePath); + BaseQtVersion *version = QtVersionManager::instance()->qtVersionForQMakeBinary(qmakePath); if (version) { if (!m_isAutoDetected) QMessageBox::warning(0, QObject::tr("Qt Version Already Known"), @@ -213,38 +217,37 @@ QtSupport::BaseQtVersion *BlackBerryConfiguration::createQtVersion(const Utils:: return version; } -ProjectExplorer::GccToolChain *BlackBerryConfiguration::createGccToolChain() +GccToolChain *BlackBerryConfiguration::createGccToolChain() { if ((m_qmake4BinaryFile.isEmpty() && m_qmake5BinaryFile.isEmpty()) || m_gccCompiler.isEmpty()) return 0; - foreach (ProjectExplorer::ToolChain* tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) { + foreach (ToolChain *tc, ToolChainManager::toolChains()) { if (tc->compilerCommand() == m_gccCompiler) { if (!m_isAutoDetected) QMessageBox::warning(0, QObject::tr("Compiler Already Known"), QObject::tr("This compiler was already registered."), QMessageBox::Ok); - return dynamic_cast<ProjectExplorer::GccToolChain*>(tc); + return dynamic_cast<GccToolChain *>(tc); } } - ProjectExplorer::GccToolChain* tc = new ProjectExplorer::GccToolChain(QLatin1String(ProjectExplorer::Constants::GCC_TOOLCHAIN_ID), m_isAutoDetected); + GccToolChain* tc = new GccToolChain(QLatin1String(ProjectExplorer::Constants::GCC_TOOLCHAIN_ID), m_isAutoDetected); tc->setDisplayName(QString::fromLatin1("GCC BlackBerry 10 (%1)").arg(m_targetName)); tc->setCompilerCommand(m_gccCompiler); return tc; } -ProjectExplorer::Kit *BlackBerryConfiguration::createKit(QnxArchitecture arch, QtSupport::BaseQtVersion *qtVersion, ProjectExplorer::GccToolChain *tc) +Kit *BlackBerryConfiguration::createKit(QnxArchitecture arch, BaseQtVersion *qtVersion, GccToolChain *tc) { if (!qtVersion || !tc || m_targetName.isEmpty()) return 0; // Check if an identical kit already exists - foreach (ProjectExplorer::Kit *kit, ProjectExplorer::KitManager::kits()) - { - if (QtSupport::QtKitInformation::qtVersion(kit) == qtVersion && ProjectExplorer::ToolChainKitInformation::toolChain(kit) == tc - && ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(kit) == Constants::QNX_BB_OS_TYPE - && ProjectExplorer::SysRootKitInformation::sysRoot(kit) == m_sysRoot) { + foreach (Kit *kit, KitManager::kits()) { + if (QtKitInformation::qtVersion(kit) == qtVersion && ToolChainKitInformation::toolChain(kit) == tc + && DeviceTypeKitInformation::deviceTypeId(kit) == Constants::QNX_BB_OS_TYPE + && SysRootKitInformation::sysRoot(kit) == m_sysRoot) { if ((arch == X86 && Qt4ProjectManager::QmakeKitInformation::mkspec(kit).toString() == QString::fromLatin1("blackberry-x86-qcc") && Debugger::DebuggerKitInformation::debuggerCommand(kit) == m_simulatorDebuger) || (arch == ArmLeV7 && Debugger::DebuggerKitInformation::debuggerCommand(kit) == m_deviceDebuger)) { @@ -257,12 +260,12 @@ ProjectExplorer::Kit *BlackBerryConfiguration::createKit(QnxArchitecture arch, Q } } - ProjectExplorer::Kit *kit = new ProjectExplorer::Kit; - QtSupport::QtKitInformation::setQtVersion(kit, qtVersion); - ProjectExplorer::ToolChainKitInformation::setToolChain(kit, tc); + Kit *kit = new Kit; + QtKitInformation::setQtVersion(kit, qtVersion); + ToolChainKitInformation::setToolChain(kit, tc); if (arch == X86) { Debugger::DebuggerKitInformation::setDebuggerCommand(kit, m_simulatorDebuger); - Qt4ProjectManager::QmakeKitInformation::setMkspec(kit, Utils::FileName::fromString(QString::fromLatin1("blackberry-x86-qcc"))); + Qt4ProjectManager::QmakeKitInformation::setMkspec(kit, FileName::fromString(QString::fromLatin1("blackberry-x86-qcc"))); // TODO: Check if the name already exists(?) kit->setDisplayName(QObject::tr("BlackBerry 10 (%1 - %2) - Simulator").arg(qtVersion->qtVersionString(), m_targetName)); } else { @@ -272,20 +275,20 @@ ProjectExplorer::Kit *BlackBerryConfiguration::createKit(QnxArchitecture arch, Q kit->setAutoDetected(m_isAutoDetected); - kit->setIconPath(Utils::FileName::fromString(QLatin1String(Constants::QNX_BB_CATEGORY_ICON))); + kit->setIconPath(FileName::fromString(QLatin1String(Constants::QNX_BB_CATEGORY_ICON))); setSticky(kit); - ProjectExplorer::DeviceTypeKitInformation::setDeviceTypeId(kit, Constants::QNX_BB_OS_TYPE); - ProjectExplorer::SysRootKitInformation::setSysRoot(kit, m_sysRoot); + DeviceTypeKitInformation::setDeviceTypeId(kit, Constants::QNX_BB_OS_TYPE); + SysRootKitInformation::setSysRoot(kit, m_sysRoot); return kit; } -void BlackBerryConfiguration::setSticky(ProjectExplorer::Kit *kit) +void BlackBerryConfiguration::setSticky(Kit *kit) { - QtSupport::QtKitInformation::makeSticky(kit); - ProjectExplorer::ToolChainKitInformation::makeSticky(kit); - ProjectExplorer::DeviceTypeKitInformation::makeSticky(kit); - ProjectExplorer::SysRootKitInformation::makeSticky(kit); + QtKitInformation::makeSticky(kit); + ToolChainKitInformation::makeSticky(kit); + DeviceTypeKitInformation::makeSticky(kit); + SysRootKitInformation::makeSticky(kit); Debugger::DebuggerKitInformation::makeSticky(kit); Qt4ProjectManager::QmakeKitInformation::makeSticky(kit); } @@ -317,7 +320,7 @@ bool BlackBerryConfiguration::activate() if (isActive() && !m_isAutoDetected) return true; - ProjectExplorer::GccToolChain *tc = createGccToolChain(); + GccToolChain *tc = createGccToolChain(); if (!m_qmake4BinaryFile.isEmpty()) setupConfigurationPerQtVersion(m_qmake4BinaryFile, tc); @@ -329,29 +332,28 @@ bool BlackBerryConfiguration::activate() void BlackBerryConfiguration::deactivate() { - QtSupport::BaseQtVersion *qt4Version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(m_qmake4BinaryFile); - QtSupport::BaseQtVersion *qt5Version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(m_qmake5BinaryFile); + BaseQtVersion *qt4Version = QtVersionManager::instance()->qtVersionForQMakeBinary(m_qmake4BinaryFile); + BaseQtVersion *qt5Version = QtVersionManager::instance()->qtVersionForQMakeBinary(m_qmake5BinaryFile); if (qt4Version || qt5Version) { - foreach (ProjectExplorer::Kit *kit, ProjectExplorer::KitManager::kits()) { - if (qt4Version && qt4Version == QtSupport::QtKitInformation::qtVersion(kit)) - ProjectExplorer::KitManager::deregisterKit(kit); + foreach (Kit *kit, KitManager::kits()) { + if (qt4Version && qt4Version == QtKitInformation::qtVersion(kit)) + KitManager::deregisterKit(kit); - else if (qt5Version && qt5Version == QtSupport::QtKitInformation::qtVersion(kit)) - ProjectExplorer::KitManager::deregisterKit(kit); + else if (qt5Version && qt5Version == QtKitInformation::qtVersion(kit)) + KitManager::deregisterKit(kit); } if (qt4Version) - QtSupport::QtVersionManager::instance()->removeVersion(qt4Version); + QtVersionManager::instance()->removeVersion(qt4Version); if (qt5Version) - QtSupport::QtVersionManager::instance()->removeVersion(qt5Version); + QtVersionManager::instance()->removeVersion(qt5Version); } - foreach (ProjectExplorer::ToolChain* tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) { + foreach (ToolChain *tc, ToolChainManager::toolChains()) if (tc->compilerCommand() == m_gccCompiler) - ProjectExplorer::ToolChainManager::instance()->deregisterToolChain(tc); - } + ToolChainManager::deregisterToolChain(tc); } } // namespace Internal diff --git a/src/plugins/qnx/blackberryconfigurationmanager.cpp b/src/plugins/qnx/blackberryconfigurationmanager.cpp index 96a2246487..41fd445632 100644 --- a/src/plugins/qnx/blackberryconfigurationmanager.cpp +++ b/src/plugins/qnx/blackberryconfigurationmanager.cpp @@ -51,6 +51,8 @@ #include <QMessageBox> #include <QFileInfo> +using namespace ProjectExplorer; + namespace Qnx { namespace Internal { @@ -182,7 +184,7 @@ void BlackBerryConfigurationManager::saveManualConfigurations() void BlackBerryConfigurationManager::clearInvalidConfigurations() { QList<NdkInstallInformation> autoNdks = QnxUtils::installedNdks(); - foreach (ProjectExplorer::Kit *kit, ProjectExplorer::KitManager::kits()) { + foreach (Kit *kit, KitManager::kits()) { if (!kit->isAutoDetected()) continue; @@ -190,7 +192,7 @@ void BlackBerryConfigurationManager::clearInvalidConfigurations() // Check if related target is still installed bool isValid = false; foreach (const NdkInstallInformation &ndkInfo, autoNdks) { - if (ndkInfo.target == ProjectExplorer::SysRootKitInformation::sysRoot(kit).toString()) { + if (ndkInfo.target == SysRootKitInformation::sysRoot(kit).toString()) { isValid = true; break; } @@ -198,9 +200,8 @@ void BlackBerryConfigurationManager::clearInvalidConfigurations() if (!isValid) { QtSupport::QtVersionManager::instance()->removeVersion(QtSupport::QtKitInformation::qtVersion(kit)); - ProjectExplorer::ToolChainManager::instance()->deregisterToolChain( - ProjectExplorer::ToolChainKitInformation::toolChain(kit)); - ProjectExplorer::KitManager::deregisterKit(kit); + ToolChainManager::deregisterToolChain(ToolChainKitInformation::toolChain(kit)); + KitManager::deregisterKit(kit); } } } diff --git a/src/plugins/qt4projectmanager/qmakekitinformation.cpp b/src/plugins/qt4projectmanager/qmakekitinformation.cpp index 0e5a337ab6..ae52441f41 100644 --- a/src/plugins/qt4projectmanager/qmakekitinformation.cpp +++ b/src/plugins/qt4projectmanager/qmakekitinformation.cpp @@ -37,117 +37,110 @@ #include <qtsupport/qtkitinformation.h> +using namespace ProjectExplorer; +using namespace Utils; + namespace Qt4ProjectManager { -namespace Internal { + const char MKSPEC_INFORMATION[] = "QtPM4.mkSpecInformation"; -} // namespace Internal QmakeKitInformation::QmakeKitInformation() { setObjectName(QLatin1String("QmakeKitInformation")); - setDataId(Internal::MKSPEC_INFORMATION); + setDataId(MKSPEC_INFORMATION); setPriority(24000); } -QVariant QmakeKitInformation::defaultValue(ProjectExplorer::Kit *k) const +QVariant QmakeKitInformation::defaultValue(Kit *k) const { Q_UNUSED(k); return QString(); } -QList<ProjectExplorer::Task> QmakeKitInformation::validate(const ProjectExplorer::Kit *k) const +QList<Task> QmakeKitInformation::validate(const Kit *k) const { - QList<ProjectExplorer::Task> result; + QList<Task> result; QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k); - Utils::FileName mkspec = QmakeKitInformation::mkspec(k); + FileName mkspec = QmakeKitInformation::mkspec(k); if (!version && !mkspec.isEmpty()) - result << ProjectExplorer::Task(ProjectExplorer::Task::Warning, - tr("No Qt version set, so mkspec is ignored."), - Utils::FileName(), -1, - Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); + result << Task(Task::Warning, tr("No Qt version set, so mkspec is ignored."), + FileName(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM); if (version && !version->hasMkspec(mkspec)) - result << ProjectExplorer::Task(ProjectExplorer::Task::Error, - tr("Mkspec not found for Qt version."), - Utils::FileName(), -1, - Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); + result << Task(Task::Error, tr("Mkspec not found for Qt version."), + FileName(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM); return result; } -void QmakeKitInformation::setup(ProjectExplorer::Kit *k) +void QmakeKitInformation::setup(Kit *k) { QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k); if (!version) return; - Utils::FileName spec = QmakeKitInformation::mkspec(k); + FileName spec = QmakeKitInformation::mkspec(k); if (spec.isEmpty()) spec = version->mkspec(); - ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k); + ToolChain *tc = ToolChainKitInformation::toolChain(k); if (!tc || (!tc->suggestedMkspecList().empty() && !tc->suggestedMkspecList().contains(spec))) { - QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains(); - ProjectExplorer::ToolChain *possibleTc = 0; - foreach (ProjectExplorer::ToolChain *current, tcList) { + ToolChain *possibleTc = 0; + foreach (ToolChain *current, ToolChainManager::toolChains()) { if (version->qtAbis().contains(current->targetAbi())) { possibleTc = current; if (current->suggestedMkspecList().contains(spec)) break; } } - ProjectExplorer::ToolChainKitInformation::setToolChain(k, possibleTc); + ToolChainKitInformation::setToolChain(k, possibleTc); } } -ProjectExplorer::KitConfigWidget * -QmakeKitInformation::createConfigWidget(ProjectExplorer::Kit *k) const +KitConfigWidget *QmakeKitInformation::createConfigWidget(Kit *k) const { return new Internal::QmakeKitConfigWidget(k, isSticky(k)); } -ProjectExplorer::KitInformation::ItemList QmakeKitInformation::toUserOutput(const ProjectExplorer::Kit *k) const +KitInformation::ItemList QmakeKitInformation::toUserOutput(const Kit *k) const { return ItemList() << qMakePair(tr("mkspec"), mkspec(k).toUserOutput()); } -Utils::FileName QmakeKitInformation::mkspec(const ProjectExplorer::Kit *k) +FileName QmakeKitInformation::mkspec(const Kit *k) { if (!k) - return Utils::FileName(); - return Utils::FileName::fromString(k->value(Core::Id(Internal::MKSPEC_INFORMATION)).toString()); + return FileName(); + return FileName::fromString(k->value(MKSPEC_INFORMATION).toString()); } -Utils::FileName QmakeKitInformation::effectiveMkspec(const ProjectExplorer::Kit *k) +FileName QmakeKitInformation::effectiveMkspec(const Kit *k) { if (!k) - return Utils::FileName(); - Utils::FileName spec = mkspec(k); + return FileName(); + FileName spec = mkspec(k); if (spec.isEmpty()) return defaultMkspec(k); return spec; } -void QmakeKitInformation::setMkspec(ProjectExplorer::Kit *k, const Utils::FileName &fn) +void QmakeKitInformation::setMkspec(Kit *k, const FileName &fn) { - if (fn == defaultMkspec(k)) - k->setValue(Core::Id(Internal::MKSPEC_INFORMATION), QString()); - else - k->setValue(Core::Id(Internal::MKSPEC_INFORMATION), fn.toString()); + k->setValue(MKSPEC_INFORMATION, fn == defaultMkspec(k) ? QString() : fn.toString()); } -Utils::FileName QmakeKitInformation::defaultMkspec(const ProjectExplorer::Kit *k) +FileName QmakeKitInformation::defaultMkspec(const Kit *k) { QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k); if (!version) // No version, so no qmake - return Utils::FileName(); + return FileName(); - return version->mkspecFor(ProjectExplorer::ToolChainKitInformation::toolChain(k)); + return version->mkspecFor(ToolChainKitInformation::toolChain(k)); } -void QmakeKitInformation::makeSticky(ProjectExplorer::Kit *k) +void QmakeKitInformation::makeSticky(Kit *k) { - k->makeSticky(Internal::MKSPEC_INFORMATION); + k->makeSticky(MKSPEC_INFORMATION); } } // namespace Qt4ProjectManager diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 6555f030bf..dce3c37f6c 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -61,6 +61,7 @@ using namespace QtSupport; using namespace QtSupport::Internal; +using namespace ProjectExplorer; using namespace Utils; static const char QTVERSIONAUTODETECTED[] = "isAutodetected"; @@ -267,25 +268,25 @@ bool BaseQtVersion::supportsPlatform(const QString &platform) const return platform == platformName(); } -QList<ProjectExplorer::Task> BaseQtVersion::validateKit(const ProjectExplorer::Kit *k) +QList<Task> BaseQtVersion::validateKit(const Kit *k) { - QList<ProjectExplorer::Task> result; + QList<Task> result; BaseQtVersion *version = QtKitInformation::qtVersion(k); Q_ASSERT(version == this); - const QList<ProjectExplorer::Abi> qtAbis = version->qtAbis(); + const QList<Abi> qtAbis = version->qtAbis(); if (qtAbis.isEmpty()) // No need to test if Qt does not know anyway... return result; - ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k); + ToolChain *tc = ToolChainKitInformation::toolChain(k); if (tc) { - ProjectExplorer::Abi targetAbi = tc->targetAbi(); + Abi targetAbi = tc->targetAbi(); bool fuzzyMatch = false; bool fullMatch = false; QString qtAbiString; - foreach (const ProjectExplorer::Abi &qtAbi, qtAbis) { + foreach (const Abi &qtAbi, qtAbis) { if (!qtAbiString.isEmpty()) qtAbiString.append(QLatin1Char(' ')); qtAbiString.append(qtAbi.toString()); @@ -306,9 +307,8 @@ QList<ProjectExplorer::Task> BaseQtVersion::validateKit(const ProjectExplorer::K "The compiler '%1' (%2) may not produce code compatible with the Qt version '%3' (%4)."); message = message.arg(tc->displayName(), targetAbi.toString(), version->displayName(), qtAbiString); - result << ProjectExplorer::Task(fuzzyMatch ? ProjectExplorer::Task::Warning : ProjectExplorer::Task::Error, - message, FileName(), -1, - Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); + result << Task(fuzzyMatch ? Task::Warning : Task::Error, message, FileName(), -1, + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM); } } return result; @@ -316,34 +316,34 @@ QList<ProjectExplorer::Task> BaseQtVersion::validateKit(const ProjectExplorer::K FileName BaseQtVersion::headerPath() const { - return Utils::FileName::fromUserInput(qmakeProperty("QT_INSTALL_HEADERS")); + return FileName::fromUserInput(qmakeProperty("QT_INSTALL_HEADERS")); } FileName BaseQtVersion::docsPath() const { - return Utils::FileName::fromUserInput(qmakeProperty("QT_INSTALL_DOCS")); + return FileName::fromUserInput(qmakeProperty("QT_INSTALL_DOCS")); } FileName BaseQtVersion::libraryPath() const { - return Utils::FileName::fromUserInput(qmakeProperty("QT_INSTALL_LIBS")); + return FileName::fromUserInput(qmakeProperty("QT_INSTALL_LIBS")); } FileName BaseQtVersion::pluginPath() const { - return Utils::FileName::fromUserInput(qmakeProperty("QT_INSTALL_PLUGINS")); + return FileName::fromUserInput(qmakeProperty("QT_INSTALL_PLUGINS")); } FileName BaseQtVersion::binPath() const { - return Utils::FileName::fromUserInput(qmakeProperty("QT_HOST_BINS")); + return FileName::fromUserInput(qmakeProperty("QT_HOST_BINS")); } -Utils::FileName BaseQtVersion::mkspecsPath() const +FileName BaseQtVersion::mkspecsPath() const { - Utils::FileName result = Utils::FileName::fromUserInput(qmakeProperty("QT_HOST_DATA")); + FileName result = FileName::fromUserInput(qmakeProperty("QT_HOST_DATA")); if (result.isEmpty()) - result = Utils::FileName::fromUserInput(qmakeProperty("QMAKE_MKSPECS")); + result = FileName::fromUserInput(qmakeProperty("QMAKE_MKSPECS")); else result.appendPath(QLatin1String("mkspecs")); return result; @@ -461,12 +461,11 @@ QStringList BaseQtVersion::warningReason() const return ret; } -ProjectExplorer::ToolChain *BaseQtVersion::preferredToolChain(const FileName &ms) const +ToolChain *BaseQtVersion::preferredToolChain(const FileName &ms) const { const FileName spec = ms.isEmpty() ? mkspec() : ms; - QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains(); - ProjectExplorer::ToolChain *possibleTc = 0; - foreach (ProjectExplorer::ToolChain *tc, tcList) { + ToolChain *possibleTc = 0; + foreach (ToolChain *tc, ToolChainManager::toolChains()) { if (!qtAbis().contains(tc->targetAbi())) continue; if (tc->suggestedMkspecList().contains(spec)) @@ -482,7 +481,7 @@ FileName BaseQtVersion::qmakeCommand() const return m_qmakeCommand; } -QList<ProjectExplorer::Abi> BaseQtVersion::qtAbis() const +QList<Abi> BaseQtVersion::qtAbis() const { if (!m_hasQtAbis) { m_qtAbis = detectQtAbis(); @@ -547,9 +546,9 @@ QString BaseQtVersion::toHtml(bool verbose) const } else { str << "<tr><td><b>" << QCoreApplication::translate("BaseQtVersion", "ABI:") << "</b></td>"; - const QList<ProjectExplorer::Abi> abis = qtAbis(); + const QList<Abi> abis = qtAbis(); if (abis.isEmpty()) { - str << "<td>" << ProjectExplorer::Abi().toString() << "</td></tr>"; + str << "<td>" << Abi().toString() << "</td></tr>"; } else { for (int i = 0; i < abis.size(); ++i) { if (i) @@ -842,9 +841,9 @@ FileName BaseQtVersion::mkspec() const return m_mkspec; } -FileName BaseQtVersion::mkspecFor(ProjectExplorer::ToolChain *tc) const +FileName BaseQtVersion::mkspecFor(ToolChain *tc) const { - Utils::FileName versionSpec = mkspec(); + FileName versionSpec = mkspec(); if (!tc) return versionSpec; @@ -1046,15 +1045,15 @@ QString BaseQtVersion::examplesPath() const return qmakeProperty("QT_INSTALL_EXAMPLES"); } -QList<ProjectExplorer::HeaderPath> BaseQtVersion::systemHeaderPathes(const ProjectExplorer::Kit *k) const +QList<HeaderPath> BaseQtVersion::systemHeaderPathes(const Kit *k) const { Q_UNUSED(k); - QList<ProjectExplorer::HeaderPath> result; - result.append(ProjectExplorer::HeaderPath(mkspecPath().toString(), ProjectExplorer::HeaderPath::GlobalHeaderPath)); + QList<HeaderPath> result; + result.append(HeaderPath(mkspecPath().toString(), HeaderPath::GlobalHeaderPath)); return result; } -void BaseQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Environment &env) const +void BaseQtVersion::addToEnvironment(const Kit *k, Environment &env) const { Q_UNUSED(k); env.set(QLatin1String("QTDIR"), QDir::toNativeSeparators(qmakeProperty("QT_HOST_DATA"))); @@ -1066,9 +1065,9 @@ void BaseQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Environment // One such example is Blackberry which for some reason decided to always use the same // qmake and use environment variables embedded in their mkspecs to make that point to // the different Qt installations. -Utils::Environment BaseQtVersion::qmakeRunEnvironment() const +Environment BaseQtVersion::qmakeRunEnvironment() const { - return Utils::Environment::systemEnvironment(); + return Environment::systemEnvironment(); } bool BaseQtVersion::hasGdbDebuggingHelper() const @@ -1125,8 +1124,7 @@ Environment BaseQtVersion::qmlToolsEnvironment() const // add preferred tool chain, as that is how the tools are built, compare QtVersion::buildDebuggingHelperLibrary if (!qtAbis().isEmpty()) { - QList<ProjectExplorer::ToolChain *> alltc = - ProjectExplorer::ToolChainManager::instance()->findToolChains(qtAbis().at(0)); + QList<ToolChain *> alltc = ToolChainManager::findToolChains(qtAbis().at(0)); if (!alltc.isEmpty()) alltc.first()->addToEnvironment(environment); } @@ -1193,9 +1191,9 @@ bool BaseQtVersion::supportsShadowBuilds() const return true; } -QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proFile, const QString &buildDir) const +QList<Task> BaseQtVersion::reportIssuesImpl(const QString &proFile, const QString &buildDir) const { - QList<ProjectExplorer::Task> results; + QList<Task> results; QString tmpBuildDir = QDir(buildDir).absolutePath(); if (!tmpBuildDir.endsWith(QLatin1Char('/'))) @@ -1204,8 +1202,8 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF if (!isValid()) { //: %1: Reason for being invalid const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "The Qt version is invalid: %1").arg(invalidReason()); - results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, FileName(), -1, - Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); + results.append(Task(Task::Error, msg, FileName(), -1, + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); } QFileInfo qmakeInfo = qmakeCommand().toFileInfo(); @@ -1214,8 +1212,8 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF //: %1: Path to qmake executable const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "The qmake command \"%1\" was not found or is not executable.").arg(qmakeCommand().toUserOutput()); - results.append(ProjectExplorer::Task(ProjectExplorer::Task::Error, msg, FileName(), -1, - Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); + results.append(Task(Task::Error, msg, FileName(), -1, + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); } QString sourcePath = QFileInfo(proFile).absolutePath(); @@ -1225,23 +1223,22 @@ QList<ProjectExplorer::Task> BaseQtVersion::reportIssuesImpl(const QString &proF if ((tmpBuildDir.startsWith(sourcePath)) && (tmpBuildDir != sourcePath)) { const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "Qmake does not support build directories below the source directory."); - results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, FileName(), -1, - Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); + results.append(Task(Task::Warning, msg, FileName(), -1, + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); } else if (tmpBuildDir.count(slash) != sourcePath.count(slash) && qtVersion() < QtVersionNumber(4,8, 0)) { const QString msg = QCoreApplication::translate("Qt4ProjectManager::QtVersion", "The build directory needs to be at the same level as the source directory."); - results.append(ProjectExplorer::Task(ProjectExplorer::Task::Warning, msg, FileName(), -1, - Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM))); + results.append(Task(Task::Warning, msg, FileName(), -1, + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); } return results; } -QList<ProjectExplorer::Task> -BaseQtVersion::reportIssues(const QString &proFile, const QString &buildDir) const +QList<Task> BaseQtVersion::reportIssues(const QString &proFile, const QString &buildDir) const { - QList<ProjectExplorer::Task> results = reportIssuesImpl(proFile, buildDir); + QList<Task> results = reportIssuesImpl(proFile, buildDir); qSort(results); return results; } @@ -1302,9 +1299,9 @@ bool BaseQtVersion::queryQMakeVariables(const FileName &binary, const Environmen // Try running qmake with all kinds of tool chains set up in the environment. // This is required to make non-static qmakes work on windows where every tool chain // tries to be incompatible with any other. - QList<ProjectExplorer::Abi> abiList = ProjectExplorer::Abi::abisOfBinary(binary); - QList<ProjectExplorer::ToolChain *> tcList = ProjectExplorer::ToolChainManager::instance()->toolChains(); - foreach (ProjectExplorer::ToolChain *tc, tcList) { + QList<Abi> abiList = Abi::abisOfBinary(binary); + QList<ToolChain *> tcList = ToolChainManager::toolChains(); + foreach (ToolChain *tc, tcList) { if (!abiList.contains(tc->targetAbi())) continue; Environment realEnv = env; @@ -1451,7 +1448,7 @@ FileName BaseQtVersion::sourcePath(const QHash<QString, QString> &versionInfo) return FileName::fromUserInput(sourcePath); } -bool BaseQtVersion::isQmlDebuggingSupported(ProjectExplorer::Kit *k, QString *reason) +bool BaseQtVersion::isQmlDebuggingSupported(Kit *k, QString *reason) { QTC_ASSERT(k, return false); BaseQtVersion *version = QtKitInformation::qtVersion(k); @@ -1469,8 +1466,8 @@ bool BaseQtVersion::isQmlDebuggingSupported(QString *reason) const return true; if (!qtAbis().isEmpty()) { - ProjectExplorer::Abi abi = qtAbis().first(); - if (abi.osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor) { + Abi abi = qtAbis().first(); + if (abi.osFlavor() == Abi::MaemoLinuxFlavor) { if (reason) reason->clear(); // *reason = QCoreApplication::translate("BaseQtVersion", "Qml debugging on device not yet supported."); @@ -1496,17 +1493,17 @@ bool BaseQtVersion::isQmlDebuggingSupported(QString *reason) const return false; } -void BaseQtVersion::buildDebuggingHelper(ProjectExplorer::Kit *k, int tools) +void BaseQtVersion::buildDebuggingHelper(Kit *k, int tools) { BaseQtVersion *version = QtKitInformation::qtVersion(k); - ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k); + ToolChain *tc = ToolChainKitInformation::toolChain(k); if (!k || !version || !tc) return; version->buildDebuggingHelper(tc, tools); } -void BaseQtVersion::buildDebuggingHelper(ProjectExplorer::ToolChain *tc, int tools) +void BaseQtVersion::buildDebuggingHelper(ToolChain *tc, int tools) { QTC_ASSERT(tc, return); DebuggingHelperBuildTask *buildTask = @@ -1566,7 +1563,7 @@ FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, co return FileName(); } -QList<ProjectExplorer::Abi> BaseQtVersion::qtAbisFromLibrary(const FileName &coreLibrary) +QList<Abi> BaseQtVersion::qtAbisFromLibrary(const FileName &coreLibrary) { - return ProjectExplorer::Abi::abisOfBinary(coreLibrary); + return Abi::abisOfBinary(coreLibrary); } diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index e72dab656c..ffd926aef7 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -42,11 +42,11 @@ #include <coreplugin/icore.h> #include <coreplugin/progressmanager/progressmanager.h> -#include <utils/qtcassert.h> -#include <utils/pathchooser.h> #include <projectexplorer/toolchainmanager.h> #include <projectexplorer/projectexplorerconstants.h> #include <utils/hostosinfo.h> +#include <utils/pathchooser.h> +#include <utils/qtcassert.h> #include <utils/runextensions.h> #include <QDir> @@ -55,12 +55,14 @@ #include <QTextBrowser> #include <QDesktopServices> -enum ModelRoles { VersionIdRole = Qt::UserRole, ToolChainIdRole, BuildLogRole, BuildRunningRole}; - -using namespace QtSupport; -using namespace QtSupport::Internal; +using namespace ProjectExplorer; using namespace Utils; +namespace QtSupport { +namespace Internal { + +enum ModelRoles { VersionIdRole = Qt::UserRole, ToolChainIdRole, BuildLogRole, BuildRunningRole}; + /// // QtOptionsPage /// @@ -116,7 +118,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent) { QWidget *versionInfoWidget = new QWidget(); m_versionUi->setupUi(versionInfoWidget); - m_versionUi->editPathPushButton->setText(QCoreApplication::translate("Utils::PathChooser", Utils::PathChooser::browseButtonLabel)); + m_versionUi->editPathPushButton->setText(QCoreApplication::translate("Utils::PathChooser", PathChooser::browseButtonLabel)); QWidget *debuggingHelperDetailsWidget = new QWidget(); m_debuggingHelperUi->setupUi(debuggingHelperDetailsWidget); @@ -131,7 +133,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent) this, SLOT(setInfoWidgetVisibility())); m_ui->versionInfoWidget->setWidget(versionInfoWidget); - m_ui->versionInfoWidget->setState(Utils::DetailsWidget::NoSummary); + m_ui->versionInfoWidget->setState(DetailsWidget::NoSummary); m_ui->debuggingHelperWidget->setWidget(debuggingHelperDetailsWidget); connect(m_ui->debuggingHelperWidget, SIGNAL(expanded(bool)), @@ -319,7 +321,7 @@ void QtOptionsPageWidget::selectedToolChainChanged(int comboIndex) item->setData(0, ToolChainIdRole, toolChainId); } -void QtOptionsPageWidget::qtVersionsDumpUpdated(const Utils::FileName &qmakeCommand) +void QtOptionsPageWidget::qtVersionsDumpUpdated(const FileName &qmakeCommand) { foreach (BaseQtVersion *version, m_versions) { if (version->qmakeCommand() == qmakeCommand) @@ -364,9 +366,9 @@ QtOptionsPageWidget::ValidityInfo QtOptionsPageWidget::validInformation(const Ba // Do we have tool chain issues? QStringList missingToolChains; int abiCount = 0; - foreach (const ProjectExplorer::Abi &a, version->qtAbis()) { - if (ProjectExplorer::ToolChainManager::instance()->findToolChains(a).isEmpty()) - missingToolChains.append(a.toString()); + foreach (const Abi &abi, version->qtAbis()) { + if (ToolChainManager::findToolChains(abi).isEmpty()) + missingToolChains.append(abi.toString()); ++abiCount; } @@ -398,25 +400,22 @@ QtOptionsPageWidget::ValidityInfo QtOptionsPageWidget::validInformation(const Ba return info; } -QList<ProjectExplorer::ToolChain*> QtOptionsPageWidget::toolChains(const BaseQtVersion *version) +QList<ToolChain*> QtOptionsPageWidget::toolChains(const BaseQtVersion *version) { - QHash<QString,ProjectExplorer::ToolChain*> toolChains; + QHash<QString,ToolChain*> toolChains; if (!version) return toolChains.values(); - foreach (const ProjectExplorer::Abi &a, version->qtAbis()) { - foreach (ProjectExplorer::ToolChain *tc, - ProjectExplorer::ToolChainManager::instance()->findToolChains(a)) { + foreach (const Abi &a, version->qtAbis()) + foreach (ToolChain *tc, ToolChainManager::findToolChains(a)) toolChains.insert(tc->id(), tc); - } - } return toolChains.values(); } QString QtOptionsPageWidget::defaultToolChainId(const BaseQtVersion *version) { - QList<ProjectExplorer::ToolChain*> possibleToolChains = toolChains(version); + QList<ToolChain*> possibleToolChains = toolChains(version); if (!possibleToolChains.isEmpty()) return possibleToolChains.first()->id(); return QString(); @@ -448,8 +447,7 @@ void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools t // Run a debugging helper build task in the background. QString toolChainId = m_debuggingHelperUi->toolChainComboBox->itemData( m_debuggingHelperUi->toolChainComboBox->currentIndex()).toString(); - ProjectExplorer::ToolChainManager *tcMgr = ProjectExplorer::ToolChainManager::instance(); - ProjectExplorer::ToolChain *toolChain = tcMgr->findToolChain(toolChainId); + ToolChain *toolChain = ToolChainManager::findToolChain(toolChainId); if (!toolChain) return; @@ -607,15 +605,15 @@ QtOptionsPageWidget::~QtOptionsPageWidget() static QString filterForQmakeFileDialog() { QString filter = QLatin1String("qmake ("); - const QStringList commands = Utils::BuildableHelperLibrary::possibleQMakeCommands(); + const QStringList commands = BuildableHelperLibrary::possibleQMakeCommands(); for (int i = 0; i < commands.size(); ++i) { if (i) filter += QLatin1Char(' '); - if (Utils::HostOsInfo::isMacHost()) + if (HostOsInfo::isMacHost()) // work around QTBUG-7739 that prohibits filters that don't start with * filter += QLatin1Char('*'); filter += commands.at(i); - if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost()) + if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) // kde bug, we need at least one wildcard character // see QTCREATORBUG-7771 filter += QLatin1Char('*'); @@ -626,7 +624,7 @@ static QString filterForQmakeFileDialog() void QtOptionsPageWidget::addQtDir() { - Utils::FileName qtVersion = Utils::FileName::fromString( + FileName qtVersion = FileName::fromString( QFileDialog::getOpenFileName(this, tr("Select a qmake Executable"), QString(), @@ -639,7 +637,7 @@ void QtOptionsPageWidget::addQtDir() QFileInfo fi(qtVersion.toString()); // should add all qt versions here ? if (BuildableHelperLibrary::isQtChooser(fi)) - qtVersion = Utils::FileName::fromString(BuildableHelperLibrary::qtChooserToQmakePath(fi.symLinkTarget())); + qtVersion = FileName::fromString(BuildableHelperLibrary::qtChooserToQmakePath(fi.symLinkTarget())); BaseQtVersion *version = 0; foreach (BaseQtVersion *v, m_versions) { @@ -697,7 +695,7 @@ void QtOptionsPageWidget::editPath() { BaseQtVersion *current = currentVersion(); QString dir = currentVersion()->qmakeCommand().toFileInfo().absolutePath(); - Utils::FileName qtVersion = Utils::FileName::fromString( + FileName qtVersion = FileName::fromString( QFileDialog::getOpenFileName(this, tr("Select a qmake executable"), dir, @@ -740,7 +738,7 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() BaseQtVersion *version = currentVersion(); const QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem(); - QList<ProjectExplorer::ToolChain*> toolchains = toolChains(currentVersion()); + QList<ToolChain*> toolchains = toolChains(currentVersion()); if (!version || !version->isValid() || toolchains.isEmpty()) { m_ui->debuggingHelperWidget->setVisible(false); @@ -890,7 +888,7 @@ void QtOptionsPageWidget::updateDebuggingHelperUi() m_debuggingHelperUi->qmlObserverBuildButton->setEnabled(canBuildQmlObserver & !isBuildingQmlObserver); - QList<ProjectExplorer::ToolChain*> toolchains = toolChains(currentVersion()); + QList<ToolChain*> toolchains = toolChains(currentVersion()); QString selectedToolChainId = currentItem->data(0, ToolChainIdRole).toString(); m_debuggingHelperUi->toolChainComboBox->clear(); for (int i = 0; i < toolchains.size(); ++i) { @@ -1126,3 +1124,6 @@ QString QtOptionsPageWidget::searchKeywords() const rc.remove(QLatin1Char('&')); return rc; } + +} // namespace Internal +} // namespace QtSupport |