[Qt-creator] Plugin development - Anubis language support

JeremY Larrieu adrenalinedj at gmail.com
Sun May 28 18:45:09 CEST 2017


Hello,

Did you have some time to take a look to the code I sent ?

Thanks in advance.

Jeremy

2017-05-03 18:37 GMT+02:00 JeremY Larrieu <adrenalinedj at gmail.com>:

> Hello,
>
> As you can see in the new screenshot attached, the Anubis compiler is auto
> detected.
>
> Here is the code to "auto-detect" kits based on the "auto detected Anubis
> toolchains" (it's based on what i found in the android plugin):
>
>      const QList<ProjectExplorer::Kit*> existingKits = Utils::filtered(
> ProjectExplorer::KitManager::kits(), [](const ProjectExplorer::Kit *k) {
>          return k->isAutoDetected();
>       });
>       QList<ProjectExplorer::Kit*> newKits;
>       const QList<ProjectExplorer::ToolChain *> filteredToolchains =
> ProjectExplorer::ToolChainManager::toolChains([](const
> ProjectExplorer::ToolChain *tc) {
>          return tc->isAutoDetected()
>                && tc->isValid()
>                && tc->typeId() == Constants::AnubisToolchainId;
>       });
>       const QList<AnubisToolChain*> toolchains = Utils::transform(filteredToolchains,
> [](ProjectExplorer::ToolChain *tc) {
>             return static_cast<AnubisToolChain *>(tc);
>       });
>
>       for (AnubisToolChain *tc : toolchains) {
>          ProjectExplorer::Kit *newKit = new ProjectExplorer::Kit;
>          newKit->setAutoDetected(true);
>          newKit->setAutoDetectionSource("PyramIDEConfiguration");
>
>          auto findExistingKit = [newKit](const ProjectExplorer::Kit *k) {
> return matchKits(newKit, k); };
>          ProjectExplorer::Kit *existingKit = Utils::findOrDefault(existingKits,
> findExistingKit);
>          if (existingKit) {
>             ProjectExplorer::KitManager::deleteKit(newKit);
>             newKit = existingKit;
>          }
>
>          auto keys = newKit->allKeys();
>          for (Core::Id key : keys) {
>             qDebug("key => " + key.toString().toLatin1() + " | value => "
> + newKit->value(key).toString().toLatin1());
>          }
>
>          auto toto = newKit->toHtml();
>          qDebug("html:\n" + toto.toLatin1() + "\n");
>
>          newKit->makeSticky();
>          newKit->setUnexpandedDisplayName(QObject::tr("Anubis
> %1").arg(tc->compilerVersion()));
>
>          if (!existingKit)
>          {
>             ProjectExplorer::KitManager::registerKit(newKit);
>          }
>       }
>
> It's triggered in the plugin entry point (initialize method) on the
> "kitsLoaded" signal of KitManager:
>      connect(KitManager::instance(), &KitManager::kitsLoaded, this,
> &PyramIDEPlugin::kitsRestored);
>
>     void PyramIDEPlugin::kitsRestored()
>     {
>        PyramIDEConfigurations::updateAutomaticKitList();
>        disconnect(KitManager::instance(), &KitManager::kitsChanged, this,
> &PyramIDEPlugin::kitsRestored);
>     }
>
> Thanks for your help.
>
> Jeremy
>
> 2017-05-03 15:14 GMT+02:00 Tobias Hunger <Tobias.Hunger at qt.io>:
>
>> Hi JeremY,
>>
>> Based on your screenshot: My guess is that Qt Creator does not have any
>> compiler defined for your language.
>>
>> What does the Tool chains tab show? Is there an anubis compiler listed
>> there?
>>
>> Best Regards,
>> Tobias
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20170528/4c85fd23/attachment.html>


More information about the Qt-creator mailing list