Example #1
0
QString CliApplication::pluginDescription(Plugin *pPlugin) const
{
    // Retrieve and return the plugin's default description, stripped out of all
    // its HTML (should it have some)

    return plainString(pPlugin->info()->description());
}
Example #2
0
void CliApplication::plugins() const
{
    // Output some information about our CLI plugins, so first make sure that we
    // have at least one of them

    if (mLoadedCliPlugins.isEmpty()) {
        std::cout << "No CLI plugins could be found." << std::endl;

        return;
    }

    // First, we retrieve all the CLI plugins information

    QStringList pluginsInfo = QStringList();

    for (auto plugin : mLoadedCliPlugins) {
        // Retrieve the CLI plugin and its default description

        QString pluginInfo = plugin->name();
        QString pluginDesc = plainString(plugin->info()->description());

        if (!pluginDesc.isEmpty()) {
            pluginInfo += ": "+pluginDesc;
        }

        // Add the plugin information to our list

        pluginsInfo << pluginInfo;
    }

    // Now, we can output the plugin information in alphabetical order

    pluginsInfo.sort(Qt::CaseInsensitive);

    if (pluginsInfo.count() == 1) {
        std::cout << "The following CLI plugin is available:" << std::endl;
    } else {
        std::cout << "The following CLI plugins are available:" << std::endl;
    }

    for (const auto &pluginInfo : pluginsInfo) {
        std::cout << " - " << pluginInfo.toStdString() << std::endl;
    }
}