Changeset View
Changeset View
Standalone View
Standalone View
shell/loadedpluginsdialog.cpp
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | 125 | { | |||
---|---|---|---|---|---|
126 | pushButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-information"))); // only for getting size matters | 126 | pushButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-information"))); // only for getting size matters | ||
127 | } | 127 | } | ||
128 | 128 | | |||
129 | ~LoadedPluginsDelegate() override | 129 | ~LoadedPluginsDelegate() override | ||
130 | { | 130 | { | ||
131 | delete pushButton; | 131 | delete pushButton; | ||
132 | } | 132 | } | ||
133 | 133 | | |||
134 | QList<QWidget *> createItemWidgets(const QModelIndex &/*index*/) const override | | |||
135 | { | | |||
136 | return QList<QWidget *>(); | | |||
137 | } | | |||
138 | | ||||
139 | QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override | 134 | QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override | ||
140 | { | 135 | { | ||
141 | int i = 5; | 136 | int i = 5; | ||
142 | int j = 1; | 137 | int j = 1; | ||
143 | 138 | | |||
144 | QFont font = titleFont(option.font); | 139 | QFont font = titleFont(option.font); | ||
145 | QFontMetrics fmTitle(font); | 140 | QFontMetrics fmTitle(font); | ||
146 | 141 | | |||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 151 | { | |||
189 | painter->restore(); | 184 | painter->restore(); | ||
190 | 185 | | |||
191 | painter->drawText(contentsRect, Qt::AlignLeft | Qt::AlignBottom, option.fontMetrics.elidedText(index.model()->data(index, PluginsModel::DescriptionRole).toString(), Qt::ElideRight, contentsRect.width())); | 186 | painter->drawText(contentsRect, Qt::AlignLeft | Qt::AlignBottom, option.fontMetrics.elidedText(index.model()->data(index, PluginsModel::DescriptionRole).toString(), Qt::ElideRight, contentsRect.width())); | ||
192 | 187 | | |||
193 | painter->restore(); | 188 | painter->restore(); | ||
194 | painter->restore(); | 189 | painter->restore(); | ||
195 | } | 190 | } | ||
196 | 191 | | |||
197 | QList<QWidget*> createItemWidgets() const | 192 | QList<QWidget *> createItemWidgets(const QModelIndex &index) const override | ||
198 | { | 193 | { | ||
194 | Q_UNUSED(index); | ||||
195 | | ||||
199 | QPushButton *button = new QPushButton(); | 196 | QPushButton *button = new QPushButton(); | ||
200 | button->setIcon(QIcon::fromTheme(QStringLiteral("dialog-information"))); | 197 | button->setIcon(QIcon::fromTheme(QStringLiteral("dialog-information"))); | ||
201 | setBlockedEventTypes(button, QList<QEvent::Type>() << QEvent::MouseButtonPress | 198 | setBlockedEventTypes(button, QList<QEvent::Type>() << QEvent::MouseButtonPress | ||
202 | << QEvent::MouseButtonRelease << QEvent::MouseButtonDblClick); | 199 | << QEvent::MouseButtonRelease << QEvent::MouseButtonDblClick); | ||
203 | 200 | | |||
204 | connect(button, &QPushButton::clicked, this, &LoadedPluginsDelegate::info); | 201 | connect(button, &QPushButton::clicked, this, &LoadedPluginsDelegate::info); | ||
205 | return QList<QWidget*>() | 202 | return QList<QWidget*>() | ||
206 | << button; | 203 | << button; | ||
Show All 30 Lines | |||||
237 | } | 234 | } | ||
238 | 235 | | |||
239 | private Q_SLOTS: | 236 | private Q_SLOTS: | ||
240 | void info() | 237 | void info() | ||
241 | { | 238 | { | ||
242 | PluginsModel *m = static_cast<PluginsModel*>(itemView()->model()); | 239 | PluginsModel *m = static_cast<PluginsModel*>(itemView()->model()); | ||
243 | KDevelop::IPlugin *p = m->pluginForIndex(focusedIndex()); | 240 | KDevelop::IPlugin *p = m->pluginForIndex(focusedIndex()); | ||
244 | if (p) { | 241 | if (p) { | ||
245 | // TODO KF5: Port | 242 | KAboutData aboutData = KAboutData::fromPluginMetaData(pluginInfo(p)); | ||
246 | // const K4AboutData *aboutData = p->componentData().aboutData(); | 243 | if (!aboutData.componentName().isEmpty()) { // Be sure the about data is not completely empty | ||
247 | // if (!aboutData->programName().isEmpty()) { // Be sure the about data is not completely empty | 244 | KAboutApplicationDialog aboutPlugin(aboutData, itemView()); | ||
248 | // KAboutApplicationDialog aboutPlugin(aboutData, itemView()); | 245 | aboutPlugin.exec(); | ||
249 | // aboutPlugin.exec(); | 246 | return; | ||
250 | // return; | 247 | } | ||
251 | // } | | |||
252 | } | 248 | } | ||
253 | } | 249 | } | ||
254 | private: | 250 | private: | ||
255 | QPushButton *pushButton; | 251 | QPushButton *pushButton; | ||
256 | }; | 252 | }; | ||
257 | 253 | | |||
258 | class PluginsView : public QListView | 254 | class PluginsView : public QListView | ||
259 | { | 255 | { | ||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |