mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
add sound plugins
Change-Id: I73d041c5fad087e96a299b9ba185b877b6a7dce5
This commit is contained in:
parent
b16eb71984
commit
e07cc00500
Notes:
Deepin Code Review
2016-08-02 03:05:14 +00:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Tue, 02 Aug 2016 03:05:14 +0000 Reviewed-on: https://cr.deepin.io/14843 Project: dde/dde-dock Branch: refs/heads/master
@ -5,4 +5,5 @@ SUBDIRS = \
|
||||
system-tray \
|
||||
disk-mount \
|
||||
network \
|
||||
trash
|
||||
trash \
|
||||
sound
|
||||
|
2
plugins/sound/sound.json
Normal file
2
plugins/sound/sound.json
Normal file
@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
24
plugins/sound/sound.pro
Normal file
24
plugins/sound/sound.pro
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
include(../../interfaces/interfaces.pri)
|
||||
|
||||
QT += widgets svg
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin c++11 link_pkgconfig
|
||||
PKGCONFIG += dtkbase dtkwidget
|
||||
|
||||
TARGET = $$qtLibraryTarget(sound)
|
||||
DESTDIR = $$_PRO_FILE_PWD_/../
|
||||
DISTFILES += sound.json
|
||||
|
||||
HEADERS += \
|
||||
soundplugin.h \
|
||||
sounditem.h
|
||||
|
||||
SOURCES += \
|
||||
soundplugin.cpp \
|
||||
sounditem.cpp
|
||||
|
||||
target.path = $${PREFIX}/lib/dde-dock/plugins/
|
||||
INSTALLS += target
|
||||
|
||||
RESOURCES += \
|
22
plugins/sound/sounditem.cpp
Normal file
22
plugins/sound/sounditem.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "sounditem.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
SoundItem::SoundItem(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QSize SoundItem::sizeHint() const
|
||||
{
|
||||
return QSize(24, 24);
|
||||
}
|
||||
|
||||
void SoundItem::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
QWidget::paintEvent(e);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(rect(), Qt::red);
|
||||
}
|
18
plugins/sound/sounditem.h
Normal file
18
plugins/sound/sounditem.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef SOUNDITEM_H
|
||||
#define SOUNDITEM_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class SoundItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SoundItem(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const;
|
||||
void paintEvent(QPaintEvent *e);
|
||||
};
|
||||
|
||||
#endif // SOUNDITEM_H
|
28
plugins/sound/soundplugin.cpp
Normal file
28
plugins/sound/soundplugin.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "soundplugin.h"
|
||||
|
||||
SoundPlugin::SoundPlugin(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_soundItem(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const QString SoundPlugin::pluginName() const
|
||||
{
|
||||
return "sound";
|
||||
}
|
||||
|
||||
void SoundPlugin::init(PluginProxyInterface *proxyInter)
|
||||
{
|
||||
m_proxyInter = proxyInter;
|
||||
|
||||
m_soundItem = new SoundItem;
|
||||
// m_proxyInter->itemAdded(this, QString());
|
||||
}
|
||||
|
||||
QWidget *SoundPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_soundItem;
|
||||
}
|
27
plugins/sound/soundplugin.h
Normal file
27
plugins/sound/soundplugin.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef SOUNDPLUGIN_H
|
||||
#define SOUNDPLUGIN_H
|
||||
|
||||
#include "pluginsiteminterface.h"
|
||||
#include "sounditem.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class SoundPlugin : public QObject, PluginsItemInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginsItemInterface)
|
||||
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "sound.json")
|
||||
|
||||
public:
|
||||
explicit SoundPlugin(QObject *parent = 0);
|
||||
|
||||
const QString pluginName() const;
|
||||
void init(PluginProxyInterface *proxyInter);
|
||||
|
||||
QWidget *itemWidget(const QString &itemKey);
|
||||
|
||||
private:
|
||||
SoundItem *m_soundItem;
|
||||
};
|
||||
|
||||
#endif // SOUNDPLUGIN_H
|
@ -50,6 +50,9 @@ void PopupControlWidget::clearTrashFloder()
|
||||
{
|
||||
for (auto item : QDir(TrashDir).entryInfoList())
|
||||
{
|
||||
if (item.fileName() == "." || item.fileName() == "..")
|
||||
continue;
|
||||
|
||||
if (item.isFile())
|
||||
QFile(item.fileName()).remove();
|
||||
else if (item.isDir())
|
||||
|
Loading…
x
Reference in New Issue
Block a user