src/pluginswindow.cpp
// Populate the data model with our different plugins
Populate the data model with our different plugins
Populate the data model with our different plugins
foreach (Plugin *plugin, plugins) {
        QStandardItem *pluginItem = new QStandardItem((plugin->status() == Plugin::Loaded)?
                                                          QIcon(":/oxygen/actions/dialog-ok-apply.png"):
                                                          QIcon(":/oxygen/actions/edit-delete.png"),
                                                      plugin->name());
        PluginInfo *pluginInfo = plugin->info();
        if (pluginInfo) {
            pluginItem->setCheckable(pluginInfo->isSelectable());
            if (pluginItem->isCheckable()) {
                pluginItem->setCheckState((Plugin::load(plugin->name()))?
                                              Qt::Checked:
                                              Qt::Unchecked);
                mSelectablePluginItems << pluginItem;
            } else {
                mUnselectablePluginItems << pluginItem;
            }
            mPluginCategories.value(pluginInfo->category())->appendRow(pluginItem);
        } else {
            mUnselectablePluginItems << pluginItem;
            mPluginCategories.value(PluginInfo::Miscellaneous)->appendRow(pluginItem);
        }
    }
foreach ( Plugin * plugin , plugins ) { QStandardItem * pluginItem = new QStandardItem ( ( plugin -> status ( ) == Plugin :: Loaded ) ? QIcon ( " " ) : QIcon ( " " ) , plugin -> name ( ) ) ; PluginInfo * pluginInfo = plugin -> info ( ) ; if ( pluginInfo ) { pluginItem -> setCheckable ( pluginInfo -> isSelectable ( ) ) ; if ( pluginItem -> isCheckable ( ) ) { pluginItem -> setCheckState ( ( Plugin :: load ( plugin -> name ( ) ) ) ? Qt :: Checked : Qt :: Unchecked ) ; mSelectablePluginItems << pluginItem ; } else { mUnselectablePluginItems << pluginItem ; } mPluginCategories . value ( pluginInfo -> category ( ) ) -> appendRow ( pluginItem ) ; } else { mUnselectablePluginItems << pluginItem ; mPluginCategories . value ( PluginInfo :: Miscellaneous ) -> appendRow ( pluginItem ) ; } }
Populate the data model with our different plugins
Populate the data model with our different plugins
// Create the item corresponding to the current plugin // Only selectable plugins and plugins that are of the right type are // checkable // Retrieve the loading state of the plugin // We are dealing with a selectable plugin, so add it to our // list of selectable plugins // We are dealing with an unselectable plugin, so add it to our // list of unselectable plugins // Add the plugin to the right category // We are not actually dealing with a plugin, so add it to the // Miscellaneous category