2016-06-15 17:44:38 +08:00
|
|
|
#ifndef PLUGINSITEMINTERFACE_H
|
|
|
|
#define PLUGINSITEMINTERFACE_H
|
|
|
|
|
2016-06-24 11:32:25 +08:00
|
|
|
#include "pluginproxyinterface.h"
|
|
|
|
|
|
|
|
#include <QIcon>
|
2016-06-16 17:48:19 +08:00
|
|
|
#include <QtCore>
|
|
|
|
|
2016-06-15 17:44:38 +08:00
|
|
|
class PluginsItemInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~PluginsItemInterface() {}
|
2016-06-16 16:56:21 +08:00
|
|
|
|
2016-06-24 11:32:25 +08:00
|
|
|
// the unique plugin id
|
2016-06-28 14:23:30 +08:00
|
|
|
virtual const QString pluginName() const = 0;
|
2016-06-24 11:32:25 +08:00
|
|
|
// init plugins
|
|
|
|
virtual void init(PluginProxyInterface *proxyInter) = 0;
|
2016-07-13 17:16:22 +08:00
|
|
|
// plugin item widget
|
|
|
|
virtual QWidget *itemWidget(const QString &itemKey) = 0;
|
|
|
|
|
|
|
|
virtual QWidget *itemTipsWidget(const QString &itemKey) {Q_UNUSED(itemKey); return nullptr;}
|
|
|
|
virtual QWidget *itemPopupApplet(const QString &itemKey) {Q_UNUSED(itemKey); return nullptr;}
|
|
|
|
virtual const QString itemCommand(const QString &itemKey) {Q_UNUSED(itemKey); return QString();}
|
2016-06-24 11:32:25 +08:00
|
|
|
|
2016-06-24 14:59:56 +08:00
|
|
|
// item sort key
|
2016-06-28 10:06:04 +08:00
|
|
|
virtual int itemSortKey(const QString &itemKey) {Q_UNUSED(itemKey); return 0;}
|
2016-06-30 20:05:51 +08:00
|
|
|
// reset sort key when plugins order changed
|
|
|
|
virtual void setSortKey(const QString &itemKey, const int order) {Q_UNUSED(itemKey); Q_UNUSED(order);}
|
2016-06-24 14:59:56 +08:00
|
|
|
|
2016-08-15 14:11:19 +08:00
|
|
|
// item allow to move to container
|
|
|
|
virtual bool itemAllowContainer(const QString &itemKey) {Q_UNUSED(itemKey); return false;}
|
|
|
|
// item is in container
|
|
|
|
virtual bool itemIsInContainer(const QString &itemKey) {Q_UNUSED(itemKey); return false;}
|
|
|
|
// set item status
|
|
|
|
virtual void setItemIsInContainer(const QString &itemKey, const bool container) {Q_UNUSED(itemKey); Q_UNUSED(container);}
|
|
|
|
|
2016-07-13 17:16:22 +08:00
|
|
|
// dock display mode changed
|
|
|
|
virtual void displayModeChanged(const Dock::DisplayMode displayMode) {Q_UNUSED(displayMode);}
|
|
|
|
// dock position changed
|
|
|
|
virtual void positionChanged(const Dock::Position position) {Q_UNUSED(position);}
|
|
|
|
|
2016-06-24 11:32:25 +08:00
|
|
|
|
2016-06-28 10:06:04 +08:00
|
|
|
protected:
|
2016-08-15 14:11:19 +08:00
|
|
|
inline Dock::DisplayMode displayMode() const
|
2016-06-28 10:06:04 +08:00
|
|
|
{
|
|
|
|
return qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>();
|
|
|
|
}
|
|
|
|
|
2016-08-15 14:11:19 +08:00
|
|
|
inline Dock::Position position() const
|
2016-06-28 10:06:04 +08:00
|
|
|
{
|
|
|
|
return qApp->property(PROP_POSITION).value<Dock::Position>();
|
|
|
|
}
|
|
|
|
|
2016-06-24 11:32:25 +08:00
|
|
|
protected:
|
|
|
|
PluginProxyInterface *m_proxyInter;
|
2016-06-15 17:44:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
#define ModuleInterface_iid "com.deepin.dock.PluginsItemInterface"
|
|
|
|
|
|
|
|
Q_DECLARE_INTERFACE(PluginsItemInterface, ModuleInterface_iid)
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
#endif // PLUGINSITEMINTERFACE_H
|