mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fall back to show title if there's no applet
This commit is contained in:
parent
146019a0aa
commit
8f9122e9b5
@ -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);
|
||||
|
@ -14,11 +14,11 @@ public:
|
||||
virtual void init(DockPluginProxyInterface *proxy) = 0;
|
||||
|
||||
virtual QString name() = 0;
|
||||
virtual QString title() = 0;
|
||||
|
||||
virtual QStringList uuids() = 0;
|
||||
virtual QString getTitle(QString uuid) = 0;
|
||||
virtual QWidget * getItem(QString uuid) = 0;
|
||||
virtual QWidget * getApplets(QString uuid) = 0;
|
||||
virtual QWidget * getApplet(QString uuid) = 0;
|
||||
virtual void changeMode(Dock::DockMode newMode, Dock::DockMode oldMode) = 0;
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ PluginItemWrapper::PluginItemWrapper(DockPluginInterface *plugin,
|
||||
|
||||
if (m_plugin) {
|
||||
QWidget * item = m_plugin->getItem(uuid);
|
||||
m_pluginItemContents = m_plugin->getApplets(uuid);
|
||||
m_pluginItemContents = m_plugin->getApplet(uuid);
|
||||
|
||||
if (item) {
|
||||
setFixedSize(item->size());
|
||||
@ -24,9 +24,14 @@ PluginItemWrapper::PluginItemWrapper(DockPluginInterface *plugin,
|
||||
}
|
||||
}
|
||||
|
||||
QWidget * PluginItemWrapper::getContents()
|
||||
QString PluginItemWrapper::getTitle()
|
||||
{
|
||||
return m_plugin->getApplets(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