Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Classes | Public Slots | Public Member Functions | Protected Attributes | Private Attributes
PluginManagerPrefsGui Class Reference

#include <pluginmanagerprefsgui.h>

List of all members.


struct  PluginSettings
 Stores current settings for each plugin. More...

Public Slots

void updateSettings (QListViewItem *item, const QPoint &, int column)
 Set selected item(=plugin) un/loadable.
void apply ()
 Apply changes to each plugin's PluginSettings.

Public Member Functions

 PluginManagerPrefsGui (QWidget *parent)
 ~PluginManagerPrefsGui ()

Protected Attributes

QVBoxLayout * pluginMainLayout
QGroupBox * plugGroupBox
QGridLayout * plugGroupBoxLayout
QVBoxLayout * plugLayout1
QListView * pluginsList
QLabel * pluginWarning
QMap< QCString, PluginSettingspluginSettings
 Store current settings about each plug-in.

Private Attributes

QPixmap checkOn
QPixmap checkOff

Detailed Description

Definition at line 22 of file pluginmanagerprefsgui.h.

Class Documentation

struct PluginManagerPrefsGui::PluginSettings

Stores current settings for each plugin.

enableOnStartup- Load the plug-in on startup?

Definition at line 56 of file pluginmanagerprefsgui.h.

Class Members
bool enableOnStartup

Constructor & Destructor Documentation

Definition at line 21 of file pluginmanagerprefsgui.cpp.

       : PrefsPanel(parent, "pluginManagerPrefsWidget")
       PluginManager& pluginManager(PluginManager::instance());
       pluginMainLayout = new QVBoxLayout( this, 0, 5, "pluginMainLayout");
       pluginMainLayout->setAlignment( Qt::AlignTop );
       plugGroupBox = new QGroupBox( tr("Plugin Manager"), this, "plugGroupBox");
       plugGroupBox->setColumnLayout(0, Qt::Vertical);
       plugGroupBoxLayout = new QGridLayout( plugGroupBox->layout() );
       plugLayout1 = new QVBoxLayout( 0, 0, 6, "plugLayout1");
       pluginsList = new QListView(plugGroupBox, "pluginsList");
       pluginsList->addColumn( tr("Plugin"));
       pluginsList->setColumnWidthMode(0, QListView::Maximum);
       pluginsList->addColumn( tr("How to run"));
       pluginsList->setColumnWidthMode(1, QListView::Maximum);
       pluginsList->addColumn( tr("Type"));
       pluginsList->setColumnWidthMode(2, QListView::Maximum);
       pluginsList->addColumn( tr("Load it?"));
       pluginsList->setColumnWidthMode(3, QListView::Maximum);
       pluginsList->addColumn( tr("Plugin ID"));
       pluginsList->setColumnWidthMode(4, QListView::Maximum);
       pluginsList->addColumn( tr("File"));
       pluginsList->setColumnWidthMode(5, QListView::Maximum);

       checkOn = getQCheckBoxPixmap(true, pluginsList->paletteBackgroundColor());
       checkOff = getQCheckBoxPixmap(false, pluginsList->paletteBackgroundColor());
       // Get a list of all internal plugin names, including those of disabled
       // plugins, then loop over them and add each one to the plugin list.
       QValueList<QCString> pluginNames(pluginManager.pluginNames(true));
       for (QValueList<QCString>::Iterator it = pluginNames.begin(); it != pluginNames.end(); ++it)
              QListViewItem *plugItem = new QListViewItem(pluginsList);
              // Get the plugin, even if it's loaded but disabled
              ScPlugin* plugin = pluginManager.getPlugin(*it, true);
              Q_ASSERT(plugin); // all the returned names should represent loaded plugins
              plugItem->setText(0, plugin->fullTrName());
              if (plugin->inherits("ScActionPlugin"))
                     ScActionPlugin* ixplug = dynamic_cast<ScActionPlugin*>(plugin);
                     ScActionPlugin::ActionInfo ai(ixplug->actionInfo());
                     plugItem->setText(1, QString("%1 %2").arg(; // menu path
                     // Resident plug-ins don't have predefined actions
                     plugItem->setText(1, QString(""));
              plugItem->setText(2, plugin->pluginTypeName());
              // load at start?
              bool onstart = pluginManager.enableOnStartup(*it);
              plugItem->setPixmap(3, onstart ? checkOn : checkOff);
              plugItem->setText(3, onstart ? CommonStrings::trYes : CommonStrings::trNo);
              plugItem->setText(4, QString("%1").arg(*it)); // plugname for developers
              plugItem->setText(5, pluginManager.getPluginPath(*it)); // file path for developers
              // Populate the working settings info for the plug-in
              pluginSettings[*it].enableOnStartup = onstart;
       pluginWarning = new QLabel(plugGroupBox);
       pluginWarning->setText("<qt>" + tr("You need to restart the application to apply the changes.") + "</qt>");
       plugGroupBoxLayout->addLayout(plugLayout1, 0, 0);

       connect(pluginsList, SIGNAL(clicked(QListViewItem *, const QPoint &, int)),
                     this, SLOT(updateSettings(QListViewItem *, const QPoint &, int)));

Here is the call graph for this function:

Definition at line 95 of file pluginmanagerprefsgui.cpp.


Member Function Documentation

Apply changes to each plugin's PluginSettings.

Definition at line 123 of file pluginmanagerprefsgui.cpp.

       PluginManager& pluginManager(PluginManager::instance());
       // For each plugin:
       QMap<QCString,PluginSettings>::Iterator itEnd(pluginSettings.end());
       for ( QMap<QCString,PluginSettings>::Iterator it(pluginSettings.begin()) ; it != itEnd ; ++it )
              // Save any changes from our working info to the plugin manager
              pluginManager.enableOnStartup(it.key()) =;
void PluginManagerPrefsGui::updateSettings ( QListViewItem *  item,
const QPoint &  ,
int  column 
) [slot]

Set selected item(=plugin) un/loadable.

Petr Vanek
itematual item
columnid of the column clicked 0=1st

Definition at line 99 of file pluginmanagerprefsgui.cpp.

       if (column != 3)
              // Only the plugin enable/disabled checkbox is editable
       PluginSettings& settings = pluginSettings[item->text(4).latin1()];
       bool onstartup;
       if (item->text(3) == CommonStrings::trYes)
              item->setPixmap(3, checkOff);
              item->setText(3, CommonStrings::trNo);
              // Update our stored settings with the new flag
              onstartup = false;
              item->setPixmap(3, checkOn);
              item->setText(3, CommonStrings::trYes);
              onstartup = true;
       // Store changed setting(s) into working setting info
       settings.enableOnStartup = onstartup;

Here is the caller graph for this function:

Member Data Documentation

Definition at line 43 of file pluginmanagerprefsgui.h.

QPixmap PluginManagerPrefsGui::checkOn [private]

Definition at line 42 of file pluginmanagerprefsgui.h.

QGroupBox* PluginManagerPrefsGui::plugGroupBox [protected]

Definition at line 47 of file pluginmanagerprefsgui.h.

Definition at line 48 of file pluginmanagerprefsgui.h.

QVBoxLayout* PluginManagerPrefsGui::pluginMainLayout [protected]

Definition at line 46 of file pluginmanagerprefsgui.h.

Store current settings about each plug-in.

Definition at line 62 of file pluginmanagerprefsgui.h.

QListView* PluginManagerPrefsGui::pluginsList [protected]

Definition at line 50 of file pluginmanagerprefsgui.h.

Definition at line 51 of file pluginmanagerprefsgui.h.

QVBoxLayout* PluginManagerPrefsGui::plugLayout1 [protected]

Definition at line 49 of file pluginmanagerprefsgui.h.

The documentation for this class was generated from the following files: