• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KUtils

kpluginselector_p.h

Go to the documentation of this file.
00001 
00021 #ifndef KPLUGINSELECTOR_P_H
00022 #define KPLUGINSELECTOR_P_H
00023 
00024 #include <QtCore/QAbstractListModel>
00025 #include <QtGui/QAbstractItemDelegate>
00026 
00027 #include <kconfiggroup.h>
00028 #include <kplugininfo.h>
00029 #include <kwidgetitemdelegate.h>
00030 #include <kcategorizedsortfilterproxymodel.h>
00031 
00032 class QLabel;
00033 class QCheckBox;
00034 class QPushButton;
00035 class QAbstractItemView;
00036 
00037 class KLineEdit;
00038 class KCategorizedView;
00039 class KCModuleProxy;
00040 class KCategoryDrawer;
00041 
00042 class PluginEntry;
00043 
00044 class KPluginSelector::Private
00045     : public QObject
00046 {
00047     Q_OBJECT
00048 
00049 public:
00050     enum ExtraRoles
00051     {
00052         PluginEntryRole   = 0x09386561,
00053         ServicesCountRole = 0x1422E2AA,
00054         NameRole          = 0x0CBBBB00,
00055         CommentRole       = 0x19FC6DE2,
00056         AuthorRole        = 0x30861E10,
00057         EmailRole         = 0x02BE3775,
00058         WebsiteRole       = 0x13095A34,
00059         VersionRole       = 0x0A0CB450,
00060         LicenseRole       = 0x001F308A,
00061         DependenciesRole  = 0x04CAB650,
00062         IsCheckableRole   = 0x0AC2AFF8
00063     };
00064 
00065     Private(KPluginSelector *parent);
00066     ~Private();
00067 
00068     void updateDependencies(PluginEntry *pluginEntry, bool added);
00069     int dependantLayoutValue(int value, int width, int totalWidth) const;
00070 
00071 public:
00072     class PluginModel;
00073     class ProxyModel;
00074     class PluginDelegate;
00075     class DependenciesWidget;
00076     KPluginSelector *parent;
00077     KLineEdit *lineEdit;
00078     KCategorizedView *listView;
00079     KCategoryDrawer *categoryDrawer;
00080     PluginModel *pluginModel;
00081     ProxyModel *proxyModel;
00082     PluginDelegate *pluginDelegate;
00083     DependenciesWidget *dependenciesWidget;
00084     bool showIcons;
00085 };
00086 
00087 class PluginEntry
00088 {
00089 public:
00090     QString category;
00091     KPluginInfo pluginInfo;
00092     bool checked;
00093     bool manuallyAdded;
00094     KConfigGroup cfgGroup;
00095     KPluginSelector::PluginLoadMethod pluginLoadMethod;
00096     bool isCheckable;
00097 
00098     bool operator==(const PluginEntry &pe) const
00099     {
00100         return pluginInfo.entryPath() == pe.pluginInfo.entryPath();
00101     }
00102 };
00103 
00104 Q_DECLARE_METATYPE(PluginEntry*)
00105 
00106 
00107 
00111 class KPluginSelector::Private::DependenciesWidget
00112     : public QWidget
00113 {
00114     Q_OBJECT
00115 
00116 public:
00117     DependenciesWidget(QWidget *parent = 0);
00118     ~DependenciesWidget();
00119 
00120     void addDependency(const QString &dependency, const QString &pluginCausant, bool added);
00121     void userOverrideDependency(const QString &dependency);
00122 
00123     void clearDependencies();
00124 
00125 private Q_SLOTS:
00126     void showDependencyDetails();
00127 
00128 private:
00129     struct FurtherInfo
00130     {
00131         bool added;
00132         QString pluginCausant;
00133     };
00134 
00135     void updateDetails();
00136 
00137     QLabel *details;
00138     QMap<QString, struct FurtherInfo> dependencyMap;
00139     int addedByDependencies;
00140     int removedByDependencies;
00141 };
00142 
00143 
00144 class KPluginSelector::Private::PluginModel
00145     : public QAbstractListModel
00146 {
00147 public:
00148     PluginModel(KPluginSelector::Private *pluginSelector_d, QObject *parent = 0);
00149     ~PluginModel();
00150 
00151     void addPlugins(const QList<KPluginInfo> &pluginList, const QString &categoryName, const QString &categoryKey, const KConfigGroup &cfgGroup, PluginLoadMethod pluginLoadMethod = ReadConfigFile, bool manuallyAdded = false);
00152     QList<KService::Ptr> pluginServices(const QModelIndex &index) const;
00153 
00154     virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
00155     virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
00156     virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
00157     virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
00158 
00159 public:
00160     QList<PluginEntry> pluginEntryList;
00161 
00162 private:
00163     KPluginSelector::Private *pluginSelector_d;
00164 };
00165 
00166 class KPluginSelector::Private::ProxyModel
00167     : public KCategorizedSortFilterProxyModel
00168 {
00169 public:
00170     ProxyModel(KPluginSelector::Private *pluginSelector_d, QObject *parent = 0);
00171     ~ProxyModel();
00172 
00173 protected:
00174     virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
00175     virtual bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const;
00176 
00177 private:
00178     KPluginSelector::Private *pluginSelector_d;
00179 };
00180 
00181 
00182 class KPluginSelector::Private::PluginDelegate
00183     : public KWidgetItemDelegate
00184 {
00185     Q_OBJECT
00186 
00187 public:
00188     PluginDelegate(KPluginSelector::Private *pluginSelector_d, QObject *parent = 0);
00189     ~PluginDelegate();
00190 
00191     void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
00192     QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
00193 
00194 Q_SIGNALS:
00195     void changed(bool hasChanged);
00196     void configCommitted(const QByteArray &componentName);
00197 
00198 protected:
00199     virtual QList<QWidget*> createItemWidgets() const;
00200     virtual void updateItemWidgets(const QList<QWidget*> widgets,
00201                                    const QStyleOptionViewItem &option,
00202                                    const QPersistentModelIndex &index) const;
00203 
00204 private Q_SLOTS:
00205     void slotStateChanged(bool state);
00206     void emitChanged();
00207     void slotAboutClicked();
00208     void slotConfigureClicked();
00209     void slotDefaultClicked();
00210 
00211 private:
00212     QFont titleFont(const QFont &baseFont) const;
00213 
00214     QCheckBox *checkBox;
00215     QPushButton *pushButton;
00216     QList<KCModuleProxy*> moduleProxyList;
00217 
00218     KPluginSelector::Private *pluginSelector_d;
00219 };
00220 
00221 #endif // KPLUGINSELECTOR_P_H

KUtils

Skip menu "KUtils"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal