dde-dock/plugins/sound/soundplugin.h
donghualin 13988c0b2a feat: 声音插件滚轮调节音量
适配插件接口的eventHandler事件,响应对滚轮的处理,让其来调节音量

Log:
Influence: 将鼠标放在任务栏声音图标上,滚动滚轮,观察音量大小是否调节
Bug: https://pms.uniontech.com/bug-view-172417.html
Change-Id: I82cf58f652568f4152083973ba8328a39f496656
2022-12-05 10:25:18 +08:00

69 lines
2.4 KiB
C++

/*
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw <sbw@sbw.so>
*
* Maintainer: sbw <sbw@sbw.so>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOUNDPLUGIN_H
#define SOUNDPLUGIN_H
#include "pluginsiteminterface.h"
#include "sounditem.h"
class SoundWidget;
class SoundDevicesWidget;
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 override;
const QString pluginDisplayName() const override;
void init(PluginProxyInterface *proxyInter) override;
void pluginStateSwitched() override;
bool pluginIsAllowDisable() override { return true; }
bool pluginIsDisable() override;
QWidget *itemWidget(const QString &itemKey) override;
QWidget *itemTipsWidget(const QString &itemKey) override;
QWidget *itemPopupApplet(const QString &itemKey) override;
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
int itemSortKey(const QString &itemKey) override;
void setSortKey(const QString &itemKey, const int order) override;
void refreshIcon(const QString &itemKey) override;
void pluginSettingsChanged() override;
QIcon icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType) override;
PluginMode status() const override;
PluginFlags flags() const override;
bool eventHandler(QEvent *event) override;
private:
void refreshPluginItemsVisible();
private:
QScopedPointer<SoundItem> m_soundItem;
QScopedPointer<SoundWidget> m_soundWidget;
QScopedPointer<SoundDevicesWidget> m_soundDeviceWidget;
};
#endif // SOUNDPLUGIN_H