Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
DDE-Dock入门
社区开发
5003
views ·
9
replies ·
To
floor
Go
海天鹰
deepin
2016-10-29 18:12
Author
本帖最后由 sonichy 于 2016-10-30 16:12 编辑
在 linux0208 的指导下,我终于做成了DDE-Dock!
他写了个教程,但是不愿意公开,我觉得开发文档很重要,分享给大家。
应用商店安装QtCreator,终端 sudo apt install qt5-default 安装Qt5开发包。
到
https://github.com/linuxdeepin/dde-dock
下载DDE-Dock开发包,解压后改名为dde-dock。
到
https://pan.baidu.com/s/1cwxlhG
下载最简范例,解压到dde-dock同级目录。
部分源码:
myplugin.cpp
#include
"myplugin.h"
#include
#define
MYPLUGIN_KEY
"myplugin"
MyPlugin
::
MyPlugin
(
QObject
*
parent
)
:
QObject
(
parent
),
m_mainWidget
(
new
QLabel
(
"
color=white>Dock
"
)),
m_tipsLabel
(
new
QLabel
)
{
}
//插件名
const
QString
MyPlugin
::
pluginName
()
const
{
return
"myplugin"
;
}
//插件初始化
void
MyPlugin
::
init
(
PluginProxyInterface
*
proxyInter
)
{
m_proxyInter
=
proxyInter
;
m_proxyInter
->
itemAdded
(
this
,
MYPLUGIN_KEY
);
}
//插件的Widget
QWidget
*
MyPlugin
::
itemWidget
(
const
QString
&
itemKey
)
{
if
(
itemKey
==
MYPLUGIN_KEY
)
return
m_mainWidget
;
return
nullptr
;
}
QWidget
*
MyPlugin
::
itemTipsWidget
(
const
QString
&
itemKey
)
{
if
(
itemKey
==
MYPLUGIN_KEY
)
{
m_tipsLabel
->
setText
(
"
color=white>提示
"
);
return
m_tipsLabel
;
}
return
nullptr
;
}
我的问题:
1.dock拖不动。
2.如何动态修改Dock文字?
我的终极目标:
设置编译目录:
安装文件:
install.sh
#!/bin/bash
sudo cp `dirname $0`/libMyPlugin.so /usr/lib/dde-dock/plugins/libMyPlugin.so
killall dde-dock
卸载文件:
uninstall.sh
#!/bin/bash
sudo rm /usr/lib/dde-dock/plugins/libMyPlugin.so
killall dde-dock
下面来说说我踩过的坑:
1.安装Qt4编译,(IID
"com.deepin.dock.PluginsItemInterface"
FILE
"MyPlugin.json"
) 报错。必须要安装Qt5!
选择编译版本
2.dde-dock和自己开发的插件目录必须是同级目录,不然找不到头文件。
Reply
Like 0
Favorite
View the author
All Replies
jingle
deepin
2016-10-29 18:30
#1
Reply
Like 0
View the author
fuyao
deepin
2016-10-29 18:46
#2
不错,文档真的很重要,可以让后人少走自己走过的坑。坑多了大家就不愿意往前走了。
Reply
Like 0
View the author
山西姚一
deepin
2016-10-30 06:07
#3
为楼主的精神赞一个!
Reply
Like 0
View the author
catbb49294929
deepin
2016-10-30 16:59
#4
赞一个,收藏了。
Reply
Like 0
View the author
hsia1979
deepin
2018-05-27 01:10
#5
Mark一下
Reply
Like 0
View the author
srwth
deepin
2018-06-01 19:58
#6
mark一下
Reply
Like 0
View the author
130******12
deepin
2018-06-07 06:22
#7
没看懂→_→
Reply
Like 0
View the author
许自强
deepin
2018-06-07 18:44
#8
https://bbs.deepin.org/post/45022
没看懂→_→
这个解释得还是比较清楚的:
https://www.deepin.org/developer-community/dock-plugin/
Reply
Like 0
View the author
海天鹰
deepin
2018-06-15 16:29
#9
https://bbs.deepin.org/post/45022
没看懂→_→
别看了,dock经常更新,clone官方插件源码,直接改,出错几率大幅下降。
Reply
Like 0
View the author
Please
sign
in first
Featured Collection
Change
Nuntia - Modern IMAP/SMTP mail client for Deepin (Beta tester wanted!)
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
Adding a Dancing Spectrum Bar to the Deepin Taskbar | deepin-spectrum
Popular Events
More
在 linux0208 的指导下,我终于做成了DDE-Dock!
他写了个教程,但是不愿意公开,我觉得开发文档很重要,分享给大家。
应用商店安装QtCreator,终端 sudo apt install qt5-default 安装Qt5开发包。
到https://github.com/linuxdeepin/dde-dock下载DDE-Dock开发包,解压后改名为dde-dock。
到https://pan.baidu.com/s/1cwxlhG下载最简范例,解压到dde-dock同级目录。
部分源码:
myplugin.cpp
#include "myplugin.h"#include
#define MYPLUGIN_KEY "myplugin"
MyPlugin::MyPlugin(QObject *parent) :
QObject(parent),
m_mainWidget(new QLabel(" color=white>Dock")),
m_tipsLabel(new QLabel)
{
}
//插件名
const QString MyPlugin::pluginName() const
{
return "myplugin";
}
//插件初始化
void MyPlugin::init(PluginProxyInterface *proxyInter)
{
m_proxyInter = proxyInter;
m_proxyInter->itemAdded(this, MYPLUGIN_KEY);
}
//插件的Widget
QWidget *MyPlugin::itemWidget(const QString &itemKey)
{
if (itemKey == MYPLUGIN_KEY)
return m_mainWidget;
return nullptr;
}
QWidget *MyPlugin::itemTipsWidget(const QString &itemKey)
{
if (itemKey == MYPLUGIN_KEY)
{ m_tipsLabel->setText(" color=white>提示");
return m_tipsLabel;
}
return nullptr;
}
我的问题:
1.dock拖不动。
2.如何动态修改Dock文字?
我的终极目标:
设置编译目录:
安装文件:
install.sh
#!/bin/bash
sudo cp `dirname $0`/libMyPlugin.so /usr/lib/dde-dock/plugins/libMyPlugin.so
killall dde-dock
卸载文件:
uninstall.sh
#!/bin/bash
sudo rm /usr/lib/dde-dock/plugins/libMyPlugin.so
killall dde-dock
下面来说说我踩过的坑:
1.安装Qt4编译,(IID "com.deepin.dock.PluginsItemInterface" FILE "MyPlugin.json") 报错。必须要安装Qt5!
2.dde-dock和自己开发的插件目录必须是同级目录,不然找不到头文件。