mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Merge branch 'dde-dock' of gitcafe.com:Hualet/dde-workspace-2015 into dde-dock
This commit is contained in:
commit
f730c2fca8
@ -85,4 +85,4 @@ headers.files += src/dockconstants.h \
|
||||
src/dockpluginproxyinterface.h
|
||||
headers.path = /usr/include/dock
|
||||
|
||||
INSTALLS += target headers
|
||||
INSTALLS += headers
|
||||
|
@ -13,7 +13,7 @@ AppItem::AppItem(QWidget *parent) :
|
||||
initMenu();
|
||||
}
|
||||
|
||||
QWidget *AppItem::getContents()
|
||||
QWidget *AppItem::getApplet()
|
||||
{
|
||||
AppPreviews *preview = new AppPreviews();
|
||||
connect(preview,&AppPreviews::mouseEntered,this,&AppItem::cancelHide);
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
AppItem(QWidget *parent = 0);
|
||||
~AppItem();
|
||||
|
||||
QWidget *getContents();
|
||||
QWidget *getApplet();
|
||||
void setEntryProxyer(DBusEntryProxyer *entryProxyer);
|
||||
void destroyItem(const QString &id);
|
||||
QString itemId() const;
|
||||
|
@ -15,7 +15,8 @@ public:
|
||||
QFrame(parent) {}
|
||||
virtual ~AbstractDockItem() {}
|
||||
|
||||
virtual QWidget * getContents() { return NULL; }
|
||||
virtual QString getTitle() { return ""; }
|
||||
virtual QWidget * getApplet() { return NULL; }
|
||||
|
||||
virtual bool moveable() { return m_moveable; }
|
||||
virtual bool actived() { return m_isActived; }
|
||||
@ -43,7 +44,15 @@ public:
|
||||
m_previewAR->resizeWithContent();
|
||||
return;
|
||||
}
|
||||
QWidget *tmpContent = getContents();
|
||||
QWidget *tmpContent = getApplet();
|
||||
if (tmpContent == NULL) {
|
||||
QString title = getTitle();
|
||||
// TODO: memory management
|
||||
tmpContent = new QLabel(title);
|
||||
tmpContent->setStyleSheet("QLabel { color: white }");
|
||||
tmpContent->setFixedSize(100, 20);
|
||||
}
|
||||
|
||||
m_previewAR->setArrorDirection(ArrowRectangle::ArrowBottom);
|
||||
m_previewAR->setContent(tmpContent);
|
||||
m_previewAR->showAtBottom(globalX() + width() / 2,globalY() - 5);
|
||||
|
@ -13,12 +13,13 @@ public:
|
||||
virtual ~DockPluginInterface() {}
|
||||
virtual void init(DockPluginProxyInterface *proxy) = 0;
|
||||
|
||||
virtual QStringList uuids() = 0;
|
||||
virtual QWidget * getItem(QString uuid) = 0;
|
||||
virtual QWidget * getContents(QString uuid) = 0;
|
||||
virtual void changeMode(Dock::DockMode newMode, Dock::DockMode oldMode) = 0;
|
||||
|
||||
virtual QString name() = 0;
|
||||
|
||||
virtual QStringList uuids() = 0;
|
||||
virtual QString getTitle(QString uuid) = 0;
|
||||
virtual QWidget * getItem(QString uuid) = 0;
|
||||
virtual QWidget * getApplet(QString uuid) = 0;
|
||||
virtual void changeMode(Dock::DockMode newMode, Dock::DockMode oldMode) = 0;
|
||||
};
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "dockpluginproxy.h"
|
||||
#include "pluginitemwrapper.h"
|
||||
#include "Controller/dockmodedata.h"
|
||||
|
||||
DockPluginProxy::DockPluginProxy(DockPluginInterface * plugin, QObject * parent) :
|
||||
QObject(parent),
|
||||
@ -12,6 +13,11 @@ DockPluginInterface * DockPluginProxy::plugin()
|
||||
return m_plugin;
|
||||
}
|
||||
|
||||
Dock::DockMode DockPluginProxy::dockMode()
|
||||
{
|
||||
return DockModeData::instance()->getDockMode();
|
||||
}
|
||||
|
||||
void DockPluginProxy::itemAddedEvent(QString uuid)
|
||||
{
|
||||
qDebug() << "Item added on plugin " << m_plugin->name() << uuid;
|
||||
|
@ -13,6 +13,8 @@ public:
|
||||
|
||||
DockPluginInterface * plugin();
|
||||
|
||||
Dock::DockMode dockMode() Q_DECL_OVERRIDE;
|
||||
|
||||
void itemAddedEvent(QString uuid) Q_DECL_OVERRIDE;
|
||||
void itemRemovedEvent(QString uuid) Q_DECL_OVERRIDE;
|
||||
void itemSizeChangedEvent(QString uuid) Q_DECL_OVERRIDE;
|
||||
|
@ -3,9 +3,13 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "dockconstants.h"
|
||||
|
||||
class DockPluginProxyInterface
|
||||
{
|
||||
public:
|
||||
virtual Dock::DockMode dockMode() = 0;
|
||||
|
||||
virtual void itemAddedEvent(QString uuid) = 0;
|
||||
virtual void itemRemovedEvent(QString uuid) = 0;
|
||||
|
||||
|
@ -12,8 +12,7 @@ PluginItemWrapper::PluginItemWrapper(DockPluginInterface *plugin,
|
||||
|
||||
if (m_plugin) {
|
||||
QWidget * item = m_plugin->getItem(uuid);
|
||||
m_pluginItemContents = m_plugin->getContents(uuid);
|
||||
// setFixedSize(item->size());
|
||||
m_pluginItemContents = m_plugin->getApplet(uuid);
|
||||
|
||||
if (item) {
|
||||
setFixedSize(item->size());
|
||||
@ -25,9 +24,14 @@ PluginItemWrapper::PluginItemWrapper(DockPluginInterface *plugin,
|
||||
}
|
||||
}
|
||||
|
||||
QWidget * PluginItemWrapper::getContents()
|
||||
QString PluginItemWrapper::getTitle()
|
||||
{
|
||||
return m_plugin->getContents(m_uuid);
|
||||
return m_plugin->getTitle(m_uuid);
|
||||
}
|
||||
|
||||
QWidget * PluginItemWrapper::getApplet()
|
||||
{
|
||||
return m_plugin->getApplet(m_uuid);
|
||||
}
|
||||
|
||||
void PluginItemWrapper::enterEvent(QEvent *)
|
||||
|
@ -11,9 +11,11 @@ public:
|
||||
PluginItemWrapper(DockPluginInterface *plugin, QString uuid, QWidget * parent = 0);
|
||||
virtual ~PluginItemWrapper();
|
||||
|
||||
QWidget * getContents();
|
||||
QString uuid() const;
|
||||
|
||||
QString getTitle();
|
||||
QWidget * getApplet();
|
||||
|
||||
protected:
|
||||
void enterEvent(QEvent * event);
|
||||
void leaveEvent(QEvent * event);
|
||||
|
Loading…
x
Reference in New Issue
Block a user