mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix(cppcheck): cppcheck检查
静态代码检查,按照提示修改了所有合理的警告内容,部分内容为cppcheck误报,不处理 Log: 按照静态代码检查工具给出的结果进行修改
This commit is contained in:
parent
5b2ef91059
commit
ee83bb1cba
@ -45,12 +45,12 @@ public:
|
|||||||
explicit DockPluginsController(QObject *parent = 0);
|
explicit DockPluginsController(QObject *parent = 0);
|
||||||
|
|
||||||
// implements PluginProxyInterface
|
// implements PluginProxyInterface
|
||||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||||
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) Q_DECL_OVERRIDE;
|
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) override;
|
||||||
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||||
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) Q_DECL_OVERRIDE;
|
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) override;
|
||||||
|
|
||||||
void startLoader();
|
void startLoader();
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class AppItem : public DockItem
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AppItem(const QDBusObjectPath &entry, QWidget *parent = nullptr);
|
explicit AppItem(const QDBusObjectPath &entry, QWidget *parent = nullptr);
|
||||||
~AppItem();
|
~AppItem() override;
|
||||||
|
|
||||||
const QString appId() const;
|
const QString appId() const;
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
@ -53,9 +53,9 @@ public:
|
|||||||
QWidget *appDragWidget();
|
QWidget *appDragWidget();
|
||||||
void setDockInfo(Dock::Position dockPosition, const QRect &dockGeometry);
|
void setDockInfo(Dock::Position dockPosition, const QRect &dockGeometry);
|
||||||
|
|
||||||
inline ItemType itemType() const Q_DECL_OVERRIDE { return App; }
|
inline ItemType itemType() const override { return App; }
|
||||||
QPixmap appIcon(){ return m_appIcon; }
|
QPixmap appIcon(){ return m_appIcon; }
|
||||||
virtual QString accessibleName();
|
virtual QString accessibleName() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestActivateWindow(const WId wid) const;
|
void requestActivateWindow(const WId wid) const;
|
||||||
@ -77,10 +77,10 @@ private:
|
|||||||
void leaveEvent(QEvent *e) override;
|
void leaveEvent(QEvent *e) override;
|
||||||
void showEvent(QShowEvent *e) override;
|
void showEvent(QShowEvent *e) override;
|
||||||
|
|
||||||
void showHoverTips() Q_DECL_OVERRIDE;
|
void showHoverTips() override;
|
||||||
void invokedMenuItem(const QString &itemId, const bool checked) Q_DECL_OVERRIDE;
|
void invokedMenuItem(const QString &itemId, const bool checked) override;
|
||||||
const QString contextMenu() const Q_DECL_OVERRIDE;
|
const QString contextMenu() const override;
|
||||||
QWidget *popupTips() Q_DECL_OVERRIDE;
|
QWidget *popupTips() override;
|
||||||
void startDrag();
|
void startDrag();
|
||||||
bool hasAttention() const;
|
bool hasAttention() const;
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateWindowInfos(const WindowInfoMap &info);
|
void updateWindowInfos(const WindowInfoMap &info);
|
||||||
void refershIcon() Q_DECL_OVERRIDE;
|
void refershIcon() override;
|
||||||
void activeChanged();
|
void activeChanged();
|
||||||
void showPreview();
|
void showPreview();
|
||||||
void playSwingEffect();
|
void playSwingEffect();
|
||||||
|
@ -21,10 +21,11 @@
|
|||||||
|
|
||||||
#include "appdrag.h"
|
#include "appdrag.h"
|
||||||
|
|
||||||
AppDrag::AppDrag(QObject *dragSource) : QDrag(dragSource)
|
AppDrag::AppDrag(QObject *dragSource)
|
||||||
|
: QDrag(dragSource)
|
||||||
|
, m_appDragWidget(new AppDragWidget)
|
||||||
{
|
{
|
||||||
// delete by itself
|
// delete by itself
|
||||||
m_appDragWidget = new AppDragWidget;
|
|
||||||
m_appDragWidget->setVisible(false);
|
m_appDragWidget->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
class AppDrag : public QDrag
|
class AppDrag : public QDrag
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AppDrag(QObject *dragSource);
|
explicit AppDrag(QObject *dragSource);
|
||||||
virtual ~AppDrag();
|
virtual ~AppDrag();
|
||||||
|
|
||||||
void setPixmap(const QPixmap &);
|
void setPixmap(const QPixmap &);
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
class AppGraphicsObject : public QGraphicsObject
|
class AppGraphicsObject : public QGraphicsObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AppGraphicsObject(QGraphicsItem *parent = Q_NULLPTR) : QGraphicsObject(parent) {}
|
explicit AppGraphicsObject(QGraphicsItem *parent = Q_NULLPTR) : QGraphicsObject(parent) {}
|
||||||
~AppGraphicsObject() { }
|
~AppGraphicsObject() override { }
|
||||||
|
|
||||||
void setAppPixmap(QPixmap pix)
|
void setAppPixmap(QPixmap pix)
|
||||||
{
|
{
|
||||||
@ -44,13 +44,12 @@ public:
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF boundingRect() const Q_DECL_OVERRIDE
|
QRectF boundingRect() const override
|
||||||
{
|
{
|
||||||
return m_appPixmap.rect();
|
return m_appPixmap.rect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) Q_DECL_OVERRIDE
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) override {
|
||||||
{
|
|
||||||
Q_ASSERT(!m_appPixmap.isNull());
|
Q_ASSERT(!m_appPixmap.isNull());
|
||||||
|
|
||||||
painter->drawPixmap(QPoint(0, 0), m_appPixmap);
|
painter->drawPixmap(QPoint(0, 0), m_appPixmap);
|
||||||
@ -89,13 +88,14 @@ AppDragWidget::AppDragWidget(QWidget *parent) :
|
|||||||
m_followMouseTimer->setSingleShot(false);
|
m_followMouseTimer->setSingleShot(false);
|
||||||
m_followMouseTimer->setInterval(1);
|
m_followMouseTimer->setInterval(1);
|
||||||
connect(m_followMouseTimer, &QTimer::timeout, [this] {
|
connect(m_followMouseTimer, &QTimer::timeout, [this] {
|
||||||
QPoint destPos = QCursor::pos();
|
QPoint destPos = QCursor::pos();
|
||||||
move(destPos.x() - width() / 2, destPos.y() - height() / 2);
|
move(destPos.x() - width() / 2, destPos.y() - height() / 2);
|
||||||
});
|
});
|
||||||
m_followMouseTimer->start();
|
m_followMouseTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
AppDragWidget::~AppDragWidget() {
|
AppDragWidget::~AppDragWidget()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppDragWidget::mouseMoveEvent(QMouseEvent *event)
|
void AppDragWidget::mouseMoveEvent(QMouseEvent *event)
|
||||||
@ -203,7 +203,7 @@ void AppDragWidget::showGoBackAnimation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AppDragWidget::onRemoveAnimationStateChanged(QAbstractAnimation::State newState,
|
void AppDragWidget::onRemoveAnimationStateChanged(QAbstractAnimation::State newState,
|
||||||
QAbstractAnimation::State oldState)
|
QAbstractAnimation::State oldState)
|
||||||
{
|
{
|
||||||
if (newState == QAbstractAnimation::Stopped) {
|
if (newState == QAbstractAnimation::Stopped) {
|
||||||
hide();
|
hide();
|
||||||
@ -213,28 +213,28 @@ bool AppDragWidget::isRemoveAble()
|
|||||||
{
|
{
|
||||||
const QPoint &p = QCursor::pos();
|
const QPoint &p = QCursor::pos();
|
||||||
switch (m_dockPosition) {
|
switch (m_dockPosition) {
|
||||||
case Dock::Position::Left:
|
case Dock::Position::Left:
|
||||||
if ((p.x() - m_dockGeometry.topRight().x()) > (m_dockGeometry.width() * 3)) {
|
if ((p.x() - m_dockGeometry.topRight().x()) > (m_dockGeometry.width() * 3)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Dock::Position::Top:
|
case Dock::Position::Top:
|
||||||
if ((p.y() - m_dockGeometry.bottomLeft().y()) > (m_dockGeometry.height() * 3)) {
|
if ((p.y() - m_dockGeometry.bottomLeft().y()) > (m_dockGeometry.height() * 3)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Dock::Position::Right:
|
case Dock::Position::Right:
|
||||||
if ((m_dockGeometry.topLeft().x() - p.x()) > (m_dockGeometry.width() * 3)) {
|
if ((m_dockGeometry.topLeft().x() - p.x()) > (m_dockGeometry.width() * 3)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Dock::Position::Bottom:
|
case Dock::Position::Bottom:
|
||||||
if ((m_dockGeometry.topLeft().y() - p.y()) > (m_dockGeometry.height() * 3)) {
|
if ((m_dockGeometry.topLeft().y() - p.y()) > (m_dockGeometry.height() * 3)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ class AppGraphicsObject;
|
|||||||
class AppDragWidget : public QGraphicsView
|
class AppDragWidget : public QGraphicsView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AppDragWidget(QWidget *parent = Q_NULLPTR);
|
explicit AppDragWidget(QWidget *parent = Q_NULLPTR);
|
||||||
virtual ~AppDragWidget();
|
virtual ~AppDragWidget() override;
|
||||||
|
|
||||||
void setAppPixmap(const QPixmap &pix);
|
void setAppPixmap(const QPixmap &pix);
|
||||||
void setDockInfo(Dock::Position dockPosition, const QRect &dockGeometry);
|
void setDockInfo(Dock::Position dockPosition, const QRect &dockGeometry);
|
||||||
@ -47,11 +47,11 @@ public:
|
|||||||
bool isRemoveAble();
|
bool isRemoveAble();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
|
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *event) override;
|
||||||
void hideEvent(QHideEvent *event) Q_DECL_OVERRIDE;
|
void hideEvent(QHideEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAnimations();
|
void initAnimations();
|
||||||
|
@ -138,7 +138,6 @@ void AppSnapshot::fetchSnapshot()
|
|||||||
SHMInfo *info = nullptr;
|
SHMInfo *info = nullptr;
|
||||||
uchar *image_data = nullptr;
|
uchar *image_data = nullptr;
|
||||||
XImage *ximage = nullptr;
|
XImage *ximage = nullptr;
|
||||||
unsigned char *prop_to_return_gtk = nullptr;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
// get window image from shm(only for deepin app)
|
// get window image from shm(only for deepin app)
|
||||||
@ -172,7 +171,7 @@ void AppSnapshot::fetchSnapshot()
|
|||||||
Q_ASSERT(!qimage.isNull());
|
Q_ASSERT(!qimage.isNull());
|
||||||
|
|
||||||
// remove shadow frame
|
// remove shadow frame
|
||||||
m_snapshotSrcRect = rectRemovedShadow(qimage, prop_to_return_gtk);
|
m_snapshotSrcRect = rectRemovedShadow(qimage, nullptr);
|
||||||
m_snapshot = qimage;
|
m_snapshot = qimage;
|
||||||
} while (false);
|
} while (false);
|
||||||
|
|
||||||
@ -191,7 +190,6 @@ void AppSnapshot::fetchSnapshot()
|
|||||||
if (image_data) shmdt(image_data);
|
if (image_data) shmdt(image_data);
|
||||||
if (ximage) XDestroyImage(ximage);
|
if (ximage) XDestroyImage(ximage);
|
||||||
if (info) XFree(info);
|
if (info) XFree(info);
|
||||||
if (prop_to_return_gtk) XFree(prop_to_return_gtk);
|
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -69,13 +69,13 @@ public slots:
|
|||||||
void setWindowInfo(const WindowInfo &info);
|
void setWindowInfo(const WindowInfo &info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *e) override;
|
||||||
void enterEvent(QEvent *e) Q_DECL_OVERRIDE;
|
void enterEvent(QEvent *e) override;
|
||||||
void leaveEvent(QEvent *e) Q_DECL_OVERRIDE;
|
void leaveEvent(QEvent *e) override;
|
||||||
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
bool eventFilter(QObject *watched, QEvent *e) Q_DECL_OVERRIDE;
|
bool eventFilter(QObject *watched, QEvent *e) override;
|
||||||
SHMInfo *getImageDSHM();
|
SHMInfo *getImageDSHM();
|
||||||
XImage *getImageXlib();
|
XImage *getImageXlib();
|
||||||
QRect rectRemovedShadow(const QImage &qimage, unsigned char *prop_to_return_gtk);
|
QRect rectRemovedShadow(const QImage &qimage, unsigned char *prop_to_return_gtk);
|
||||||
|
@ -31,7 +31,7 @@ class PlaceholderItem : public DockItem
|
|||||||
public:
|
public:
|
||||||
explicit PlaceholderItem(QWidget *parent = 0);
|
explicit PlaceholderItem(QWidget *parent = 0);
|
||||||
|
|
||||||
inline ItemType itemType() const { return Placeholder; }
|
inline ItemType itemType() const override { return Placeholder; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLACEHOLDERITEM_H
|
#endif // PLACEHOLDERITEM_H
|
||||||
|
@ -60,9 +60,9 @@ protected:
|
|||||||
void mousePressEvent(QMouseEvent *e) override;
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
void mouseMoveEvent(QMouseEvent *e) override;
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *e) override;
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||||
void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
|
void enterEvent(QEvent *event) override;
|
||||||
void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
|
void leaveEvent(QEvent *event) override;
|
||||||
bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
void invokedMenuItem(const QString &itemId, const bool checked) override;
|
void invokedMenuItem(const QString &itemId, const bool checked) override;
|
||||||
|
@ -29,9 +29,9 @@ class TrayPluginItem : public PluginsItem
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TrayPluginItem(PluginsItemInterface* const pluginInter, const QString &itemKey, QWidget *parent = 0);
|
TrayPluginItem(PluginsItemInterface* const pluginInter, const QString &itemKey, QWidget *parent = nullptr);
|
||||||
|
|
||||||
inline ItemType itemType() const Q_DECL_OVERRIDE {return ItemType::TrayPlugin;}
|
inline ItemType itemType() const override {return ItemType::TrayPlugin;}
|
||||||
|
|
||||||
void setSuggestIconSize(QSize size);
|
void setSuggestIconSize(QSize size);
|
||||||
void setRightSplitVisible(const bool visible);
|
void setRightSplitVisible(const bool visible);
|
||||||
@ -41,7 +41,7 @@ Q_SIGNALS:
|
|||||||
void trayVisableCountChanged(const int &count) const;
|
void trayVisableCountChanged(const int &count) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool eventFilter(QObject *watched, QEvent *e) Q_DECL_OVERRIDE;
|
bool eventFilter(QObject *watched, QEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_trayVisableItemCount = 0;
|
int m_trayVisableItemCount = 0;
|
||||||
|
@ -935,7 +935,7 @@ void MainPanelControl::resizeDockIcon()
|
|||||||
iconCount -= pluginCount;
|
iconCount -= pluginCount;
|
||||||
|
|
||||||
// 余数
|
// 余数
|
||||||
int yu = (totalLength % iconCount);
|
yu = (totalLength % iconCount);
|
||||||
// icon宽度 = (总宽度-余数)/icon个数
|
// icon宽度 = (总宽度-余数)/icon个数
|
||||||
iconSize = (totalLength - yu) / iconCount;
|
iconSize = (totalLength - yu) / iconCount;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class DesktopWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DesktopWidget(QWidget *parent) : QWidget(parent){
|
explicit DesktopWidget(QWidget *parent) : QWidget(parent){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ class MainPanelControl : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MainPanelControl(QWidget *parent = 0);
|
explicit MainPanelControl(QWidget *parent = nullptr);
|
||||||
~MainPanelControl();
|
~MainPanelControl() override;
|
||||||
|
|
||||||
void addFixedAreaItem(int index, QWidget *wdg);
|
void addFixedAreaItem(int index, QWidget *wdg);
|
||||||
void addAppAreaItem(int index, QWidget *wdg);
|
void addAppAreaItem(int index, QWidget *wdg);
|
||||||
|
@ -43,8 +43,8 @@ public:
|
|||||||
explicit AbstractPluginsController(QObject *parent = 0);
|
explicit AbstractPluginsController(QObject *parent = 0);
|
||||||
|
|
||||||
// implements PluginProxyInterface
|
// implements PluginProxyInterface
|
||||||
void saveValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value) Q_DECL_OVERRIDE;
|
void saveValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value) override;
|
||||||
const QVariant getValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant& fallback = QVariant()) Q_DECL_OVERRIDE;
|
const QVariant getValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant& fallback = QVariant()) override;
|
||||||
void removeValue(PluginsItemInterface * const itemInter, const QStringList &keyList) override;
|
void removeValue(PluginsItemInterface * const itemInter, const QStringList &keyList) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -64,7 +64,7 @@ private slots:
|
|||||||
void refreshPluginSettings();
|
void refreshPluginSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
|
bool eventFilter(QObject *o, QEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDBusConnectionInterface *m_dbusDaemonInterface;
|
QDBusConnectionInterface *m_dbusDaemonInterface;
|
||||||
|
@ -251,10 +251,10 @@ const int DockSettings::dockMargin() const
|
|||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QSize DockSettings::panelSize() const
|
//const QSize DockSettings::panelSize() const
|
||||||
{
|
//{
|
||||||
return m_mainWindowSize;
|
// return m_mainWindowSize;
|
||||||
}
|
//}
|
||||||
|
|
||||||
const QRect DockSettings::windowRect(const Position position, const bool hide)
|
const QRect DockSettings::windowRect(const Position position, const bool hide)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
inline const quint8 Opacity() const { return m_opacity * 255; }
|
inline const quint8 Opacity() const { return m_opacity * 255; }
|
||||||
const int dockMargin() const;
|
const int dockMargin() const;
|
||||||
|
|
||||||
const QSize panelSize() const;
|
// const QSize panelSize() const;
|
||||||
const QRect windowRect(const Position position, const bool hide = false);
|
const QRect windowRect(const Position position, const bool hide = false);
|
||||||
qreal dockRatio() const;
|
qreal dockRatio() const;
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ private slots:
|
|||||||
void onMonitorListChanged(const QList<QDBusObjectPath> &mons);
|
void onMonitorListChanged(const QList<QDBusObjectPath> &mons);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DockSettings(QWidget *parent = nullptr);
|
explicit DockSettings(QWidget *parent = nullptr);
|
||||||
DockSettings(DockSettings const &) = delete;
|
DockSettings(DockSettings const &) = delete;
|
||||||
DockSettings operator =(DockSettings const &) = delete;
|
DockSettings operator =(DockSettings const &) = delete;
|
||||||
|
|
||||||
|
@ -29,8 +29,16 @@ const double DoubleZero = 0.000001;
|
|||||||
|
|
||||||
Monitor::Monitor(QObject *parent)
|
Monitor::Monitor(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
|
, m_x(0)
|
||||||
|
, m_y(0)
|
||||||
|
, m_w(0)
|
||||||
|
, m_h(0)
|
||||||
|
, m_mmWidth(0)
|
||||||
|
, m_mmHeight(0)
|
||||||
, m_scale(-1.0)
|
, m_scale(-1.0)
|
||||||
, m_brightness(1.0)
|
, m_rotate(0)
|
||||||
|
// , m_brightness(1.0)
|
||||||
|
, m_enable(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -114,15 +122,15 @@ void Monitor::setRotate(const quint16 rotate)
|
|||||||
Q_EMIT rotateChanged(m_rotate);
|
Q_EMIT rotateChanged(m_rotate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Monitor::setBrightness(const double brightness)
|
//void Monitor::setBrightness(const double brightness)
|
||||||
{
|
//{
|
||||||
if (fabs(m_brightness - brightness) < DoubleZero)
|
// if (fabs(m_brightness - brightness) < DoubleZero)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
m_brightness = brightness;
|
// m_brightness = brightness;
|
||||||
|
|
||||||
Q_EMIT brightnessChanged(m_brightness);
|
// Q_EMIT brightnessChanged(m_brightness);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void Monitor::setName(const QString &name)
|
void Monitor::setName(const QString &name)
|
||||||
{
|
{
|
||||||
@ -190,37 +198,36 @@ void Monitor::setMonitorEnable(bool enable)
|
|||||||
Q_EMIT enableChanged(enable);
|
Q_EMIT enableChanged(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//bool Monitor::isSameResolution(const Resolution &r1, const Resolution &r2)
|
||||||
|
//{
|
||||||
|
// return r1.width() == r2.width() && r1.height() == r2.height();
|
||||||
|
//}
|
||||||
|
|
||||||
bool Monitor::isSameResolution(const Resolution &r1, const Resolution &r2)
|
//bool Monitor::isSameRatefresh(const Resolution &r1, const Resolution &r2)
|
||||||
{
|
//{
|
||||||
return r1.width() == r2.width() && r1.height() == r2.height();
|
// return fabs(r1.rate() - r2.rate()) < 0.000001;
|
||||||
}
|
//}
|
||||||
|
|
||||||
bool Monitor::isSameRatefresh(const Resolution &r1, const Resolution &r2)
|
//bool Monitor::hasResolution(const Resolution &r)
|
||||||
{
|
//{
|
||||||
return fabs(r1.rate() - r2.rate()) < 0.000001;
|
// for (auto m : m_modeList) {
|
||||||
}
|
// if (isSameResolution(m, r)) {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
bool Monitor::hasResolution(const Resolution &r)
|
// return false;
|
||||||
{
|
//}
|
||||||
for (auto m : m_modeList) {
|
|
||||||
if (isSameResolution(m, r)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
//bool Monitor::hasResolutionAndRate(const Resolution &r)
|
||||||
}
|
//{
|
||||||
|
// for (auto m : m_modeList) {
|
||||||
|
// if (fabs(m.rate() - r.rate()) < 0.000001 &&
|
||||||
|
// m.width() == r.width() &&
|
||||||
|
// m.height() == r.height()) {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
bool Monitor::hasResolutionAndRate(const Resolution &r)
|
// return false;
|
||||||
{
|
//}
|
||||||
for (auto m : m_modeList) {
|
|
||||||
if (fabs(m.rate() - r.rate()) < 0.000001 &&
|
|
||||||
m.width() == r.width() &&
|
|
||||||
m.height() == r.height()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
inline double scale() const { return m_scale; }
|
inline double scale() const { return m_scale; }
|
||||||
inline bool isPrimary() const { return m_primary == m_name; }
|
inline bool isPrimary() const { return m_primary == m_name; }
|
||||||
inline quint16 rotate() const { return m_rotate; }
|
inline quint16 rotate() const { return m_rotate; }
|
||||||
inline double brightness() const { return m_brightness; }
|
// inline double brightness() const { return m_brightness; }
|
||||||
inline const QRect rect() const { return QRect(m_x, m_y, m_w, m_h); }
|
inline const QRect rect() const { return QRect(m_x, m_y, m_w, m_h); }
|
||||||
inline const QString name() const { Q_ASSERT(!m_name.isEmpty()); return m_name; }
|
inline const QString name() const { Q_ASSERT(!m_name.isEmpty()); return m_name; }
|
||||||
inline const QString path() const { return m_path; }
|
inline const QString path() const { return m_path; }
|
||||||
@ -89,16 +89,16 @@ Q_SIGNALS:
|
|||||||
void hChanged(const int h) const;
|
void hChanged(const int h) const;
|
||||||
void scaleChanged(const double scale) const;
|
void scaleChanged(const double scale) const;
|
||||||
void rotateChanged(const quint16 rotate) const;
|
void rotateChanged(const quint16 rotate) const;
|
||||||
void brightnessChanged(const double brightness) const;
|
// void brightnessChanged(const double brightness) const;
|
||||||
void currentModeChanged(const Resolution &resolution) const;
|
void currentModeChanged(const Resolution &resolution) const;
|
||||||
void modelListChanged(const QList<Resolution> &resolution) const;
|
void modelListChanged(const QList<Resolution> &resolution) const;
|
||||||
void enableChanged(bool enable) const;
|
void enableChanged(bool enable) const;
|
||||||
|
|
||||||
public:
|
//public:
|
||||||
static bool isSameResolution(const Resolution &r1,const Resolution &r2);
|
// static bool isSameResolution(const Resolution &r1,const Resolution &r2);
|
||||||
static bool isSameRatefresh(const Resolution &r1,const Resolution &r2);
|
// static bool isSameRatefresh(const Resolution &r1,const Resolution &r2);
|
||||||
bool hasResolution(const Resolution &r);
|
// bool hasResolution(const Resolution &r);
|
||||||
bool hasResolutionAndRate(const Resolution &r);
|
// bool hasResolutionAndRate(const Resolution &r);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setX(const int x);
|
void setX(const int x);
|
||||||
@ -110,7 +110,7 @@ public Q_SLOTS:
|
|||||||
void setScale(const double scale);
|
void setScale(const double scale);
|
||||||
void setPrimary(const QString &primaryName);
|
void setPrimary(const QString &primaryName);
|
||||||
void setRotate(const quint16 rotate);
|
void setRotate(const quint16 rotate);
|
||||||
void setBrightness(const double brightness);
|
// void setBrightness(const double brightness);
|
||||||
void setName(const QString &name);
|
void setName(const QString &name);
|
||||||
void setPath(const QString &path);
|
void setPath(const QString &path);
|
||||||
void setRotateList(const QList<quint16> &rotateList);
|
void setRotateList(const QList<quint16> &rotateList);
|
||||||
@ -127,7 +127,8 @@ private:
|
|||||||
uint m_mmHeight;
|
uint m_mmHeight;
|
||||||
double m_scale;
|
double m_scale;
|
||||||
quint16 m_rotate;
|
quint16 m_rotate;
|
||||||
double m_brightness;
|
// double m_brightness;
|
||||||
|
|
||||||
QString m_name;
|
QString m_name;
|
||||||
QString m_path;
|
QString m_path;
|
||||||
QString m_primary;
|
QString m_primary;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
StateButton::StateButton(QWidget *parent)
|
StateButton::StateButton(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
, m_type(Check)
|
||||||
{
|
{
|
||||||
setAttribute(Qt::WA_TranslucentBackground, true);
|
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ inline QString getAccessibleName(QWidget *w, QAccessible::Role r, const QString
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 公共的功能
|
// 公共的功能
|
||||||
#define FUNC_CREATE(classname,accessibletype,accessdescription) Accessible##classname(classname *w) \
|
#define FUNC_CREATE(classname,accessibletype,accessdescription) explicit Accessible##classname(classname *w) \
|
||||||
: QAccessibleWidget(w,accessibletype,#classname)\
|
: QAccessibleWidget(w,accessibletype,#classname)\
|
||||||
, m_w(w)\
|
, m_w(w)\
|
||||||
, m_description(accessdescription)\
|
, m_description(accessdescription)\
|
||||||
|
@ -58,7 +58,7 @@ private:
|
|||||||
QPoint m_resizePoint;
|
QPoint m_resizePoint;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DragWidget(QWidget *parent) : QWidget(parent)
|
explicit DragWidget(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
setObjectName("DragWidget");
|
setObjectName("DragWidget");
|
||||||
m_dragStatus = false;
|
m_dragStatus = false;
|
||||||
@ -505,36 +505,36 @@ void MainWindow::initConnections()
|
|||||||
connect(m_eventInter, &XEventMonitor::CursorMove, this, &MainWindow::onRegionMonitorChanged);
|
connect(m_eventInter, &XEventMonitor::CursorMove, this, &MainWindow::onRegionMonitorChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPoint MainWindow::x11GetWindowPos()
|
//const QPoint MainWindow::x11GetWindowPos()
|
||||||
{
|
//{
|
||||||
const auto disp = QX11Info::display();
|
// const auto disp = QX11Info::display();
|
||||||
|
|
||||||
unsigned int unused;
|
// unsigned int unused;
|
||||||
int x;
|
// int x;
|
||||||
int y;
|
// int y;
|
||||||
Window unused_window;
|
// Window unused_window;
|
||||||
|
|
||||||
XGetGeometry(disp, winId(), &unused_window, &x, &y, &unused, &unused, &unused, &unused);
|
// XGetGeometry(disp, winId(), &unused_window, &x, &y, &unused, &unused, &unused, &unused);
|
||||||
XFlush(disp);
|
// XFlush(disp);
|
||||||
|
|
||||||
return QPoint(x, y);
|
// return QPoint(x, y);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MainWindow::x11MoveWindow(const int x, const int y)
|
//void MainWindow::x11MoveWindow(const int x, const int y)
|
||||||
{
|
//{
|
||||||
const auto disp = QX11Info::display();
|
// const auto disp = QX11Info::display();
|
||||||
|
|
||||||
XMoveWindow(disp, winId(), x, y);
|
// XMoveWindow(disp, winId(), x, y);
|
||||||
XFlush(disp);
|
// XFlush(disp);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MainWindow::x11MoveResizeWindow(const int x, const int y, const int w, const int h)
|
//void MainWindow::x11MoveResizeWindow(const int x, const int y, const int w, const int h)
|
||||||
{
|
//{
|
||||||
const auto disp = QX11Info::display();
|
// const auto disp = QX11Info::display();
|
||||||
|
|
||||||
XMoveResizeWindow(disp, winId(), x, y, w, h);
|
// XMoveResizeWindow(disp, winId(), x, y, w, h);
|
||||||
XFlush(disp);
|
// XFlush(disp);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MainWindow::positionChanged()
|
void MainWindow::positionChanged()
|
||||||
{
|
{
|
||||||
@ -713,18 +713,9 @@ void MainWindow::expand()
|
|||||||
resetPanelEnvironment();
|
resetPanelEnvironment();
|
||||||
if (showAniState != QPropertyAnimation::Running && pos() != m_panelShowAni->currentValue()) {
|
if (showAniState != QPropertyAnimation::Running && pos() != m_panelShowAni->currentValue()) {
|
||||||
const QRect windowRect = m_settings->windowRect(m_dockPosition);
|
const QRect windowRect = m_settings->windowRect(m_dockPosition);
|
||||||
switch (m_dockPosition) {
|
|
||||||
case Top:
|
startValue = (m_dockPosition == Top || m_dockPosition == Bottom) ? height() : width();
|
||||||
case Bottom:
|
endValue = (m_dockPosition == Top || m_dockPosition == Bottom) ? windowRect.height() : windowRect.width();
|
||||||
startValue = height();
|
|
||||||
endValue = windowRect.height();
|
|
||||||
break;
|
|
||||||
case Left:
|
|
||||||
case Right:
|
|
||||||
startValue = width();
|
|
||||||
endValue = windowRect.width();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startValue > DOCK_MAX_SIZE || endValue > DOCK_MAX_SIZE) {
|
if (startValue > DOCK_MAX_SIZE || endValue > DOCK_MAX_SIZE) {
|
||||||
return;
|
return;
|
||||||
@ -742,25 +733,11 @@ void MainWindow::expand()
|
|||||||
|
|
||||||
void MainWindow::narrow()
|
void MainWindow::narrow()
|
||||||
{
|
{
|
||||||
int startValue = 0;
|
int startValue = ( m_dockPosition == Top || m_dockPosition == Bottom ) ? height() : width();
|
||||||
int endValue = 0;
|
|
||||||
|
|
||||||
switch (m_dockPosition) {
|
|
||||||
case Top:
|
|
||||||
case Bottom:
|
|
||||||
startValue = height();
|
|
||||||
endValue = 0;
|
|
||||||
break;
|
|
||||||
case Left:
|
|
||||||
case Right:
|
|
||||||
startValue = width();
|
|
||||||
endValue = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_panelShowAni->stop();
|
m_panelShowAni->stop();
|
||||||
m_panelHideAni->setStartValue(startValue);
|
m_panelHideAni->setStartValue(startValue);
|
||||||
m_panelHideAni->setEndValue(endValue);
|
m_panelHideAni->setEndValue(0);
|
||||||
m_panelHideAni->start();
|
m_panelHideAni->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,14 +69,14 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
using QWidget::show;
|
using QWidget::show;
|
||||||
bool event(QEvent *e);
|
bool event(QEvent *e) override;
|
||||||
void showEvent(QShowEvent *e);
|
void showEvent(QShowEvent *e) override;
|
||||||
void mousePressEvent(QMouseEvent *e);
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
void enterEvent(QEvent *e);
|
void enterEvent(QEvent *e) override;
|
||||||
void leaveEvent(QEvent *e);
|
void leaveEvent(QEvent *e) override;
|
||||||
void dragEnterEvent(QDragEnterEvent *e);
|
void dragEnterEvent(QDragEnterEvent *e) override;
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
|
||||||
void initSNIHost();
|
void initSNIHost();
|
||||||
void initComponents();
|
void initComponents();
|
||||||
@ -84,10 +84,10 @@ private:
|
|||||||
void resizeMainWindow();
|
void resizeMainWindow();
|
||||||
void resizeMainPanelWindow();
|
void resizeMainPanelWindow();
|
||||||
|
|
||||||
const QPoint x11GetWindowPos();
|
// const QPoint x11GetWindowPos();
|
||||||
void x11MoveWindow(const int x, const int y);
|
// void x11MoveWindow(const int x, const int y);
|
||||||
void x11MoveResizeWindow(const int x, const int y, const int w, const int h);
|
// void x11MoveResizeWindow(const int x, const int y, const int w, const int h);
|
||||||
bool appIsOnDock(const QString &appDesktop);
|
bool appIsOnDock(const QString &appDesktop) override;
|
||||||
void onRegionMonitorChanged(int x, int y, const QString &key);
|
void onRegionMonitorChanged(int x, int y, const QString &key);
|
||||||
void updateRegionMonitorWatch();
|
void updateRegionMonitorWatch();
|
||||||
void getTrayVisableItemCount();
|
void getTrayVisableItemCount();
|
||||||
|
@ -35,21 +35,21 @@ class BluetoothPlugin : public QObject, PluginsItemInterface
|
|||||||
public:
|
public:
|
||||||
explicit BluetoothPlugin(QObject *parent = nullptr);
|
explicit BluetoothPlugin(QObject *parent = nullptr);
|
||||||
|
|
||||||
const QString pluginName() const Q_DECL_OVERRIDE;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const Q_DECL_OVERRIDE;
|
const QString pluginDisplayName() const override;
|
||||||
void init(PluginProxyInterface *proxyInter) Q_DECL_OVERRIDE;
|
void init(PluginProxyInterface *proxyInter) override;
|
||||||
void pluginStateSwitched() Q_DECL_OVERRIDE;
|
void pluginStateSwitched() override;
|
||||||
bool pluginIsAllowDisable() Q_DECL_OVERRIDE { return true; }
|
bool pluginIsAllowDisable() override { return true; }
|
||||||
bool pluginIsDisable() Q_DECL_OVERRIDE;
|
bool pluginIsDisable() override;
|
||||||
QWidget *itemWidget(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemWidget(const QString &itemKey) override;
|
||||||
QWidget *itemTipsWidget(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemTipsWidget(const QString &itemKey) override;
|
||||||
QWidget *itemPopupApplet(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemPopupApplet(const QString &itemKey) override;
|
||||||
const QString itemContextMenu(const QString &itemKey) Q_DECL_OVERRIDE;
|
const QString itemContextMenu(const QString &itemKey) override;
|
||||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) Q_DECL_OVERRIDE;
|
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
void refreshIcon(const QString &itemKey) Q_DECL_OVERRIDE;
|
void refreshIcon(const QString &itemKey) override;
|
||||||
void pluginSettingsChanged() Q_DECL_OVERRIDE;
|
void pluginSettingsChanged() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void refreshPluginItemsVisible();
|
void refreshPluginItemsVisible();
|
||||||
|
@ -106,29 +106,29 @@ void Adapter::updateDevice(const QJsonObject &dviceJson)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Adapter::removeAllDevices()
|
//void Adapter::removeAllDevices()
|
||||||
{
|
//{
|
||||||
QMapIterator<QString, const Device *> iterator(m_devices);
|
// QMapIterator<QString, const Device *> iterator(m_devices);
|
||||||
while (iterator.hasNext()) {
|
// while (iterator.hasNext()) {
|
||||||
iterator.next();
|
// iterator.next();
|
||||||
auto device = const_cast<Device *>(iterator.value());
|
// auto device = const_cast<Device *>(iterator.value());
|
||||||
if (device) {
|
// if (device) {
|
||||||
m_devices.remove(device->id());
|
// m_devices.remove(device->id());
|
||||||
m_paredDev.remove(device->id());
|
// m_paredDev.remove(device->id());
|
||||||
delete device;
|
// delete device;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
const QMap<QString, const Device *> &Adapter::paredDevices() const
|
const QMap<QString, const Device *> &Adapter::paredDevices() const
|
||||||
{
|
{
|
||||||
return m_paredDev;
|
return m_paredDev;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Adapter::paredDevicesCount() const
|
//int Adapter::paredDevicesCount() const
|
||||||
{
|
//{
|
||||||
return m_paredDev.size();
|
// return m_paredDev.size();
|
||||||
}
|
//}
|
||||||
|
|
||||||
void Adapter::divideDevice(const Device *device)
|
void Adapter::divideDevice(const Device *device)
|
||||||
{
|
{
|
||||||
|
@ -55,9 +55,9 @@ public:
|
|||||||
void addDevice(const QJsonObject &deviceObj);
|
void addDevice(const QJsonObject &deviceObj);
|
||||||
void removeDevice(const QString &deviceId);
|
void removeDevice(const QString &deviceId);
|
||||||
void updateDevice(const QJsonObject &dviceJson);
|
void updateDevice(const QJsonObject &dviceJson);
|
||||||
void removeAllDevices();
|
// void removeAllDevices();
|
||||||
const QMap<QString, const Device *> &paredDevices() const;
|
const QMap<QString, const Device *> &paredDevices() const;
|
||||||
int paredDevicesCount() const;
|
// int paredDevicesCount() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void nameChanged(const QString &name) const;
|
void nameChanged(const QString &name) const;
|
||||||
|
@ -82,15 +82,15 @@ AdaptersManager::AdaptersManager(QObject *parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, const Adapter *> AdaptersManager::adapters() const
|
//QMap<QString, const Adapter *> AdaptersManager::adapters() const
|
||||||
{
|
//{
|
||||||
return m_adapters;
|
// return m_adapters;
|
||||||
}
|
//}
|
||||||
|
|
||||||
const Adapter *AdaptersManager::adapterById(const QString &id)
|
//const Adapter *AdaptersManager::adapterById(const QString &id)
|
||||||
{
|
//{
|
||||||
return m_adapters.keys().contains(id) ? m_adapters[id] : nullptr;
|
// return m_adapters.keys().contains(id) ? m_adapters[id] : nullptr;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void AdaptersManager::setAdapterPowered(const Adapter *adapter, const bool &powered)
|
void AdaptersManager::setAdapterPowered(const Adapter *adapter, const bool &powered)
|
||||||
{
|
{
|
||||||
@ -114,17 +114,17 @@ void AdaptersManager::setAdapterPowered(const Adapter *adapter, const bool &powe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdaptersManager::connectAllPairedDevice(const Adapter *adapter)
|
//void AdaptersManager::connectAllPairedDevice(const Adapter *adapter)
|
||||||
{
|
//{
|
||||||
for (const Device *d : adapter->paredDevices()) {
|
// for (const Device *d : adapter->paredDevices()) {
|
||||||
Device *vd = const_cast<Device *>(d);
|
// Device *vd = const_cast<Device *>(d);
|
||||||
if (vd) {
|
// if (vd) {
|
||||||
QDBusObjectPath path(vd->id());
|
// QDBusObjectPath path(vd->id());
|
||||||
m_bluetoothInter->ConnectDevice(path);
|
// m_bluetoothInter->ConnectDevice(path);
|
||||||
qDebug() << "connect to device: " << vd->name();
|
// qDebug() << "connect to device: " << vd->name();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
void AdaptersManager::connectDevice(Device *device)
|
void AdaptersManager::connectDevice(Device *device)
|
||||||
{
|
{
|
||||||
|
@ -34,11 +34,11 @@ class AdaptersManager : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit AdaptersManager(QObject *parent = nullptr);
|
explicit AdaptersManager(QObject *parent = nullptr);
|
||||||
|
|
||||||
QMap<QString, const Adapter *> adapters() const;
|
// QMap<QString, const Adapter *> adapters() const;
|
||||||
const Adapter *adapterById(const QString &id);
|
// const Adapter *adapterById(const QString &id);
|
||||||
|
|
||||||
void setAdapterPowered(const Adapter *adapter, const bool &powered);
|
void setAdapterPowered(const Adapter *adapter, const bool &powered);
|
||||||
void connectAllPairedDevice(const Adapter *adapter);
|
// void connectAllPairedDevice(const Adapter *adapter);
|
||||||
void connectDevice(Device *deviceId);
|
void connectDevice(Device *deviceId);
|
||||||
bool defaultAdapterInitPowerState();
|
bool defaultAdapterInitPowerState();
|
||||||
int adaptersCount();
|
int adaptersCount();
|
||||||
|
@ -51,7 +51,7 @@ signals:
|
|||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj,QEvent *event) Q_DECL_OVERRIDE;
|
bool eventFilter(QObject *obj,QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *m_title;
|
QLabel *m_title;
|
||||||
|
@ -38,7 +38,7 @@ class DatetimePlugin : public QObject, PluginsItemInterface
|
|||||||
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "datetime.json")
|
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "datetime.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DatetimePlugin(QObject *parent = 0);
|
explicit DatetimePlugin(QObject *parent = nullptr);
|
||||||
|
|
||||||
const QString pluginName() const override;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const override;
|
const QString pluginDisplayName() const override;
|
||||||
@ -48,8 +48,8 @@ public:
|
|||||||
bool pluginIsAllowDisable() override { return true; }
|
bool pluginIsAllowDisable() override { return true; }
|
||||||
bool pluginIsDisable() override;
|
bool pluginIsDisable() override;
|
||||||
|
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
|
|
||||||
QWidget *itemWidget(const QString &itemKey) override;
|
QWidget *itemWidget(const QString &itemKey) override;
|
||||||
QWidget *itemTipsWidget(const QString &itemKey) override;
|
QWidget *itemTipsWidget(const QString &itemKey) override;
|
||||||
|
@ -38,6 +38,8 @@ DWIDGET_USE_NAMESPACE
|
|||||||
|
|
||||||
DatetimeWidget::DatetimeWidget(QWidget *parent)
|
DatetimeWidget::DatetimeWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
, m_24HourFormat(false)
|
||||||
|
, m_timeOffset(false)
|
||||||
{
|
{
|
||||||
setMinimumSize(PLUGIN_BACKGROUND_MIN_SIZE, PLUGIN_BACKGROUND_MIN_SIZE);
|
setMinimumSize(PLUGIN_BACKGROUND_MIN_SIZE, PLUGIN_BACKGROUND_MIN_SIZE);
|
||||||
}
|
}
|
||||||
|
@ -23,15 +23,15 @@
|
|||||||
#include "pluginsiteminterface.h"
|
#include "pluginsiteminterface.h"
|
||||||
#include "dbusadaptors.h"
|
#include "dbusadaptors.h"
|
||||||
|
|
||||||
class KeyboardPlugin : public QObject , PluginsItemInterface
|
class KeyboardPlugin : public QObject, PluginsItemInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(PluginsItemInterface)
|
Q_INTERFACES(PluginsItemInterface)
|
||||||
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "keyboard.json")
|
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "keyboard.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KeyboardPlugin(QObject *parent = nullptr);
|
explicit KeyboardPlugin(QObject *parent = nullptr);
|
||||||
~KeyboardPlugin();
|
~KeyboardPlugin() override;
|
||||||
|
|
||||||
const QString pluginName() const override;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const override;
|
const QString pluginDisplayName() const override;
|
||||||
|
@ -35,7 +35,7 @@ class MultitaskingPlugin : public QObject, PluginsItemInterface
|
|||||||
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "multitasking.json")
|
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "multitasking.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MultitaskingPlugin(QObject *parent = 0);
|
explicit MultitaskingPlugin(QObject *parent = nullptr);
|
||||||
|
|
||||||
const QString pluginName() const override;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const override;
|
const QString pluginDisplayName() const override;
|
||||||
@ -48,9 +48,9 @@ public:
|
|||||||
const QString itemCommand(const QString &itemKey) override;
|
const QString itemCommand(const QString &itemKey) override;
|
||||||
const QString itemContextMenu(const QString &itemKey) override;
|
const QString itemContextMenu(const QString &itemKey) override;
|
||||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
||||||
void refreshIcon(const QString &itemKey) Q_DECL_OVERRIDE;
|
void refreshIcon(const QString &itemKey) override;
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
void pluginSettingsChanged() override;
|
void pluginSettingsChanged() override;
|
||||||
PluginType type() override;
|
PluginType type() override;
|
||||||
|
|
||||||
|
@ -28,8 +28,9 @@
|
|||||||
|
|
||||||
MultitaskingWidget::MultitaskingWidget(QWidget *parent)
|
MultitaskingWidget::MultitaskingWidget(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
, m_icon(QIcon::fromTheme(":/icons/deepin-multitasking-view.svg"))
|
||||||
{
|
{
|
||||||
m_icon = QIcon::fromTheme(":/icons/deepin-multitasking-view.svg");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultitaskingWidget::refreshIcon()
|
void MultitaskingWidget::refreshIcon()
|
||||||
|
@ -32,7 +32,7 @@ class MultitaskingWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MultitaskingWidget(QWidget *parent = 0);
|
explicit MultitaskingWidget(QWidget *parent = nullptr);
|
||||||
void refreshIcon();
|
void refreshIcon();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -35,8 +35,8 @@ class SsidButton : public QLabel
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SsidButton(QWidget *parent = nullptr) : QLabel(parent) {}
|
explicit SsidButton(QWidget *parent = nullptr) : QLabel(parent) {}
|
||||||
virtual ~SsidButton() {}
|
virtual ~SsidButton() override {}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void clicked();
|
void clicked();
|
||||||
|
@ -46,7 +46,7 @@ signals:
|
|||||||
void requestRefresh() const;
|
void requestRefresh() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
void refreshIcon();
|
void refreshIcon();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -54,9 +54,9 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit WirelessItem(dde::network::WirelessDevice *device);
|
explicit WirelessItem(dde::network::WirelessDevice *device);
|
||||||
~WirelessItem();
|
~WirelessItem() override;
|
||||||
|
|
||||||
QWidget *itemApplet();
|
QWidget *itemApplet() override;
|
||||||
int APcount();
|
int APcount();
|
||||||
bool deviceEanbled();
|
bool deviceEanbled();
|
||||||
void setDeviceEnabled(bool enable);
|
void setDeviceEnabled(bool enable);
|
||||||
|
@ -66,9 +66,9 @@ public slots:
|
|||||||
void refreshIcon();
|
void refreshIcon();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
bool eventFilter(QObject *obj,QEvent *event) Q_DECL_OVERRIDE;
|
bool eventFilter(QObject *obj,QEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void wiredsEnable(bool enable);
|
void wiredsEnable(bool enable);
|
||||||
|
@ -156,10 +156,10 @@ void NetworkPlugin::pluginSettingsChanged()
|
|||||||
refreshPluginItemsVisible();
|
refreshPluginItemsVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetworkPlugin::isConnectivity()
|
//bool NetworkPlugin::isConnectivity()
|
||||||
{
|
//{
|
||||||
return NetworkModel::connectivity() == Connectivity::Full;
|
// return NetworkModel::connectivity() == Connectivity::Full;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void NetworkPlugin::onDeviceListChanged(const QList<NetworkDevice *> devices)
|
void NetworkPlugin::onDeviceListChanged(const QList<NetworkDevice *> devices)
|
||||||
{
|
{
|
||||||
|
@ -40,26 +40,26 @@ class NetworkPlugin : public QObject, PluginsItemInterface
|
|||||||
public:
|
public:
|
||||||
explicit NetworkPlugin(QObject *parent = nullptr);
|
explicit NetworkPlugin(QObject *parent = nullptr);
|
||||||
|
|
||||||
const QString pluginName() const Q_DECL_OVERRIDE;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const Q_DECL_OVERRIDE;
|
const QString pluginDisplayName() const override;
|
||||||
void init(PluginProxyInterface *proxyInter) Q_DECL_OVERRIDE;
|
void init(PluginProxyInterface *proxyInter) override;
|
||||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) Q_DECL_OVERRIDE;
|
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
||||||
void refreshIcon(const QString &itemKey) Q_DECL_OVERRIDE;
|
void refreshIcon(const QString &itemKey) override;
|
||||||
void pluginStateSwitched() Q_DECL_OVERRIDE;
|
void pluginStateSwitched() override;
|
||||||
bool pluginIsAllowDisable() Q_DECL_OVERRIDE { return true; }
|
bool pluginIsAllowDisable() override { return true; }
|
||||||
bool pluginIsDisable() Q_DECL_OVERRIDE;
|
bool pluginIsDisable() override;
|
||||||
const QString itemCommand(const QString &itemKey) Q_DECL_OVERRIDE;
|
const QString itemCommand(const QString &itemKey) override;
|
||||||
const QString itemContextMenu(const QString &itemKey) Q_DECL_OVERRIDE;
|
const QString itemContextMenu(const QString &itemKey) override;
|
||||||
QWidget *itemWidget(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemWidget(const QString &itemKey) override;
|
||||||
QWidget *itemTipsWidget(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemTipsWidget(const QString &itemKey) override;
|
||||||
QWidget *itemPopupApplet(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemPopupApplet(const QString &itemKey) override;
|
||||||
|
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
|
|
||||||
void pluginSettingsChanged() override;
|
void pluginSettingsChanged() override;
|
||||||
|
|
||||||
static bool isConnectivity();
|
// static bool isConnectivity();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onDeviceListChanged(const QList<dde::network::NetworkDevice *> devices);
|
void onDeviceListChanged(const QList<dde::network::NetworkDevice *> devices);
|
||||||
|
@ -40,7 +40,7 @@ class OnboardPlugin : public QObject, PluginsItemInterface
|
|||||||
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "onboard.json")
|
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "onboard.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit OnboardPlugin(QObject *parent = 0);
|
explicit OnboardPlugin(QObject *parent = nullptr);
|
||||||
|
|
||||||
const QString pluginName() const override;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const override;
|
const QString pluginDisplayName() const override;
|
||||||
@ -57,8 +57,8 @@ public:
|
|||||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
||||||
void displayModeChanged(const Dock::DisplayMode displayMode) override;
|
void displayModeChanged(const Dock::DisplayMode displayMode) override;
|
||||||
|
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
|
|
||||||
void pluginSettingsChanged() override;
|
void pluginSettingsChanged() override;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class OverlayWarningPlugin : public QObject, PluginsItemInterface
|
|||||||
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "overlay-warning.json")
|
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "overlay-warning.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit OverlayWarningPlugin(QObject *parent = 0);
|
explicit OverlayWarningPlugin(QObject *parent = nullptr);
|
||||||
|
|
||||||
const QString pluginName() const override;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const override;
|
const QString pluginDisplayName() const override;
|
||||||
@ -57,8 +57,8 @@ public:
|
|||||||
const QString itemCommand(const QString &itemKey) override;
|
const QString itemCommand(const QString &itemKey) override;
|
||||||
void displayModeChanged(const Dock::DisplayMode displayMode) override;
|
void displayModeChanged(const Dock::DisplayMode displayMode) override;
|
||||||
|
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadPlugin();
|
void loadPlugin();
|
||||||
|
@ -129,7 +129,7 @@ void HomeMonitorPlugin::invokedMenuItem(const QString &itemKey, const QString &m
|
|||||||
// 根据上面接口设置的 id 执行不同的操作
|
// 根据上面接口设置的 id 执行不同的操作
|
||||||
if (menuId == "refresh") {
|
if (menuId == "refresh") {
|
||||||
m_pluginWidget->storageInfo()->refresh();
|
m_pluginWidget->storageInfo()->refresh();
|
||||||
} else if ("open") {
|
} else if (menuId == "open") {
|
||||||
QProcess::startDetached("gparted");
|
QProcess::startDetached("gparted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ class PowerPlugin : public QObject, PluginsItemInterface
|
|||||||
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "power.json")
|
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "power.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PowerPlugin(QObject *parent = 0);
|
explicit PowerPlugin(QObject *parent = nullptr);
|
||||||
|
|
||||||
const QString pluginName() const override;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const override;
|
const QString pluginDisplayName() const override;
|
||||||
@ -62,9 +62,9 @@ public:
|
|||||||
const QString itemCommand(const QString &itemKey) override;
|
const QString itemCommand(const QString &itemKey) override;
|
||||||
const QString itemContextMenu(const QString &itemKey) override;
|
const QString itemContextMenu(const QString &itemKey) override;
|
||||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
||||||
void refreshIcon(const QString &itemKey) Q_DECL_OVERRIDE;
|
void refreshIcon(const QString &itemKey) override;
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
void pluginSettingsChanged() override;
|
void pluginSettingsChanged() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -67,7 +67,6 @@ QPixmap PowerStatusWidget::getBatteryIcon()
|
|||||||
const BatteryPercentageMap data = m_powerInter->batteryPercentage();
|
const BatteryPercentageMap data = m_powerInter->batteryPercentage();
|
||||||
const uint value = uint(qMin(100.0, qMax(0.0, data.value("Display"))));
|
const uint value = uint(qMin(100.0, qMax(0.0, data.value("Display"))));
|
||||||
const int percentage = int(std::round(value));
|
const int percentage = int(std::round(value));
|
||||||
// const int batteryState = m_powerInter->batteryState()["Display"];
|
|
||||||
const bool plugged = !m_powerInter->onBattery();
|
const bool plugged = !m_powerInter->onBattery();
|
||||||
|
|
||||||
/*根据新需求,电池电量显示分别是*/
|
/*根据新需求,电池电量显示分别是*/
|
||||||
|
@ -35,7 +35,7 @@ class ShowDesktopPlugin : public QObject, PluginsItemInterface
|
|||||||
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "show-desktop.json")
|
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "show-desktop.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ShowDesktopPlugin(QObject *parent = 0);
|
explicit ShowDesktopPlugin(QObject *parent = nullptr);
|
||||||
|
|
||||||
const QString pluginName() const override;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const override;
|
const QString pluginDisplayName() const override;
|
||||||
@ -48,9 +48,9 @@ public:
|
|||||||
const QString itemCommand(const QString &itemKey) override;
|
const QString itemCommand(const QString &itemKey) override;
|
||||||
const QString itemContextMenu(const QString &itemKey) override;
|
const QString itemContextMenu(const QString &itemKey) override;
|
||||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
||||||
void refreshIcon(const QString &itemKey) Q_DECL_OVERRIDE;
|
void refreshIcon(const QString &itemKey) override;
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
void pluginSettingsChanged() override;
|
void pluginSettingsChanged() override;
|
||||||
PluginType type() override;
|
PluginType type() override;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class ShutdownPlugin : public QObject, PluginsItemInterface
|
|||||||
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "shutdown.json")
|
Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "shutdown.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ShutdownPlugin(QObject *parent = 0);
|
explicit ShutdownPlugin(QObject *parent = nullptr);
|
||||||
|
|
||||||
const QString pluginName() const override;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const override;
|
const QString pluginDisplayName() const override;
|
||||||
@ -53,8 +53,8 @@ public:
|
|||||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
||||||
void displayModeChanged(const Dock::DisplayMode displayMode) override;
|
void displayModeChanged(const Dock::DisplayMode displayMode) override;
|
||||||
|
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
|
|
||||||
void pluginSettingsChanged() override;
|
void pluginSettingsChanged() override;
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ signals:
|
|||||||
void requestPlaySoundEffect() const;
|
void requestPlaySoundEffect() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||||
void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
|
void wheelEvent(QWheelEvent *e) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTimeout();
|
void onTimeout();
|
||||||
|
@ -34,20 +34,20 @@ class SoundPlugin : public QObject, PluginsItemInterface
|
|||||||
public:
|
public:
|
||||||
explicit SoundPlugin(QObject *parent = 0);
|
explicit SoundPlugin(QObject *parent = 0);
|
||||||
|
|
||||||
const QString pluginName() const Q_DECL_OVERRIDE;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const Q_DECL_OVERRIDE;
|
const QString pluginDisplayName() const override;
|
||||||
void init(PluginProxyInterface *proxyInter) Q_DECL_OVERRIDE;
|
void init(PluginProxyInterface *proxyInter) override;
|
||||||
void pluginStateSwitched() Q_DECL_OVERRIDE;
|
void pluginStateSwitched() override;
|
||||||
bool pluginIsAllowDisable() Q_DECL_OVERRIDE { return true; }
|
bool pluginIsAllowDisable() override { return true; }
|
||||||
bool pluginIsDisable() Q_DECL_OVERRIDE;
|
bool pluginIsDisable() override;
|
||||||
QWidget *itemWidget(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemWidget(const QString &itemKey) override;
|
||||||
QWidget *itemTipsWidget(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemTipsWidget(const QString &itemKey) override;
|
||||||
QWidget *itemPopupApplet(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemPopupApplet(const QString &itemKey) override;
|
||||||
const QString itemContextMenu(const QString &itemKey) Q_DECL_OVERRIDE;
|
const QString itemContextMenu(const QString &itemKey) override;
|
||||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) Q_DECL_OVERRIDE;
|
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
void refreshIcon(const QString &itemKey) Q_DECL_OVERRIDE;
|
void refreshIcon(const QString &itemKey) override;
|
||||||
void pluginSettingsChanged() override;
|
void pluginSettingsChanged() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -73,10 +73,10 @@ QSize PopupControlWidget::sizeHint() const
|
|||||||
return QSize(width(), m_empty ? 30 : 60);
|
return QSize(width(), m_empty ? 30 : 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString PopupControlWidget::trashDir()
|
//const QString PopupControlWidget::trashDir()
|
||||||
{
|
//{
|
||||||
return TrashDir;
|
// return TrashDir;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void PopupControlWidget::openTrashFloder()
|
void PopupControlWidget::openTrashFloder()
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
bool empty() const;
|
bool empty() const;
|
||||||
int trashItems() const;
|
int trashItems() const;
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
static const QString trashDir();
|
// static const QString trashDir();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void openTrashFloder();
|
void openTrashFloder();
|
||||||
|
@ -43,23 +43,23 @@ class TrashPlugin : public QObject, PluginsItemInterface
|
|||||||
public:
|
public:
|
||||||
explicit TrashPlugin(QObject *parent = 0);
|
explicit TrashPlugin(QObject *parent = 0);
|
||||||
|
|
||||||
const QString pluginName() const Q_DECL_OVERRIDE;
|
const QString pluginName() const override;
|
||||||
const QString pluginDisplayName() const override;
|
const QString pluginDisplayName() const override;
|
||||||
void init(PluginProxyInterface *proxyInter) Q_DECL_OVERRIDE;
|
void init(PluginProxyInterface *proxyInter) override;
|
||||||
|
|
||||||
QWidget *itemWidget(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemWidget(const QString &itemKey) override;
|
||||||
QWidget *itemTipsWidget(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemTipsWidget(const QString &itemKey) override;
|
||||||
QWidget *itemPopupApplet(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemPopupApplet(const QString &itemKey) override;
|
||||||
const QString itemCommand(const QString &itemKey) Q_DECL_OVERRIDE;
|
const QString itemCommand(const QString &itemKey) override;
|
||||||
const QString itemContextMenu(const QString &itemKey) Q_DECL_OVERRIDE;
|
const QString itemContextMenu(const QString &itemKey) override;
|
||||||
void refreshIcon(const QString &itemKey) Q_DECL_OVERRIDE;
|
void refreshIcon(const QString &itemKey) override;
|
||||||
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) Q_DECL_OVERRIDE;
|
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
|
||||||
bool pluginIsAllowDisable() override { return true; }
|
bool pluginIsAllowDisable() override { return true; }
|
||||||
bool pluginIsDisable() override;
|
bool pluginIsDisable() override;
|
||||||
void pluginStateSwitched() override;
|
void pluginStateSwitched() override;
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
void displayModeChanged(const Dock::DisplayMode displayMode) Q_DECL_OVERRIDE;
|
void displayModeChanged(const Dock::DisplayMode displayMode) override;
|
||||||
void pluginSettingsChanged() override;
|
void pluginSettingsChanged() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -54,10 +54,10 @@ signals:
|
|||||||
void requestContextMenu() const;
|
void requestContextMenu() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *e) override;
|
||||||
void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
|
void dragMoveEvent(QDragMoveEvent *e) override;
|
||||||
void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent *e) override;
|
||||||
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void removeApp(const QString &appKey);
|
void removeApp(const QString &appKey);
|
||||||
|
@ -54,8 +54,8 @@ Q_SIGNALS:
|
|||||||
void requestRefershWindowVisible();
|
void requestRefershWindowVisible();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||||
|
|
||||||
void handleMouseRelease();
|
void handleMouseRelease();
|
||||||
const QRect perfectIconRect() const;
|
const QRect perfectIconRect() const;
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
#include "../fashiontrayconstants.h"
|
#include "../fashiontrayconstants.h"
|
||||||
|
|
||||||
AbstractContainer::AbstractContainer(TrayPlugin *trayPlugin, QWidget *parent)
|
AbstractContainer::AbstractContainer(TrayPlugin *trayPlugin, QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent)
|
||||||
m_trayPlugin(trayPlugin),
|
, m_trayPlugin(trayPlugin)
|
||||||
m_wrapperLayout(new QBoxLayout(QBoxLayout::LeftToRight, this)),
|
, m_wrapperLayout(new QBoxLayout(QBoxLayout::LeftToRight, this))
|
||||||
m_currentDraggingWrapper(nullptr),
|
, m_currentDraggingWrapper(nullptr)
|
||||||
m_expand(true),
|
, m_expand(true)
|
||||||
m_dockPosition(Dock::Position::Bottom),
|
, m_dockPosition(Dock::Position::Bottom)
|
||||||
m_wrapperSize(QSize(PLUGIN_BACKGROUND_MAX_SIZE, PLUGIN_BACKGROUND_MAX_SIZE))
|
// , m_wrapperSize(QSize(PLUGIN_BACKGROUND_MAX_SIZE, PLUGIN_BACKGROUND_MAX_SIZE))
|
||||||
{
|
{
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
@ -342,10 +342,10 @@ Dock::Position AbstractContainer::dockPosition() const
|
|||||||
return m_dockPosition;
|
return m_dockPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize AbstractContainer::wrapperSize() const
|
//QSize AbstractContainer::wrapperSize() const
|
||||||
{
|
//{
|
||||||
return m_wrapperSize;
|
// return m_wrapperSize;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void AbstractContainer::dragEnterEvent(QDragEnterEvent *event)
|
void AbstractContainer::dragEnterEvent(QDragEnterEvent *event)
|
||||||
{
|
{
|
||||||
|
@ -72,10 +72,10 @@ protected:
|
|||||||
void setWrapperLayout(QBoxLayout *layout);
|
void setWrapperLayout(QBoxLayout *layout);
|
||||||
bool expand() const;
|
bool expand() const;
|
||||||
Dock::Position dockPosition() const;
|
Dock::Position dockPosition() const;
|
||||||
QSize wrapperSize() const;
|
// QSize wrapperSize() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
@ -94,7 +94,7 @@ private:
|
|||||||
bool m_expand;
|
bool m_expand;
|
||||||
Dock::Position m_dockPosition;
|
Dock::Position m_dockPosition;
|
||||||
|
|
||||||
QSize m_wrapperSize;
|
// QSize m_wrapperSize;
|
||||||
int m_itemSize = 40;
|
int m_itemSize = 40;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@ public:
|
|||||||
|
|
||||||
// AbstractContainer interface
|
// AbstractContainer interface
|
||||||
public:
|
public:
|
||||||
bool acceptWrapper(FashionTrayWidgetWrapper *wrapper) Q_DECL_OVERRIDE;
|
bool acceptWrapper(FashionTrayWidgetWrapper *wrapper) override;
|
||||||
void refreshVisible() Q_DECL_OVERRIDE;
|
void refreshVisible() override;
|
||||||
void addWrapper(FashionTrayWidgetWrapper *wrapper) Q_DECL_OVERRIDE;
|
void addWrapper(FashionTrayWidgetWrapper *wrapper) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ATTENTIONCONTAINER_H
|
#endif // ATTENTIONCONTAINER_H
|
||||||
|
@ -10,11 +10,11 @@ public:
|
|||||||
explicit HoldContainer(TrayPlugin *trayPlugin, QWidget *parent = nullptr);
|
explicit HoldContainer(TrayPlugin *trayPlugin, QWidget *parent = nullptr);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool acceptWrapper(FashionTrayWidgetWrapper *wrapper) Q_DECL_OVERRIDE;
|
bool acceptWrapper(FashionTrayWidgetWrapper *wrapper) override;
|
||||||
void addWrapper(FashionTrayWidgetWrapper *wrapper) Q_DECL_OVERRIDE;
|
void addWrapper(FashionTrayWidgetWrapper *wrapper) override;
|
||||||
void refreshVisible() Q_DECL_OVERRIDE;
|
void refreshVisible() override;
|
||||||
void setDockPosition(const Dock::Position pos) Q_DECL_OVERRIDE;
|
void setDockPosition(const Dock::Position pos) override;
|
||||||
// QSize totalSize() const Q_DECL_OVERRIDE;
|
// QSize totalSize() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QBoxLayout *m_mainBoxLayout;
|
QBoxLayout *m_mainBoxLayout;
|
||||||
|
@ -11,16 +11,16 @@ public:
|
|||||||
|
|
||||||
// AbstractContainer interface
|
// AbstractContainer interface
|
||||||
public:
|
public:
|
||||||
bool acceptWrapper(FashionTrayWidgetWrapper *wrapper) Q_DECL_OVERRIDE;
|
bool acceptWrapper(FashionTrayWidgetWrapper *wrapper) override;
|
||||||
void addWrapper(FashionTrayWidgetWrapper *wrapper) Q_DECL_OVERRIDE;
|
void addWrapper(FashionTrayWidgetWrapper *wrapper) override;
|
||||||
void refreshVisible() Q_DECL_OVERRIDE;
|
void refreshVisible() override;
|
||||||
void setExpand(const bool expand) Q_DECL_OVERRIDE;
|
void setExpand(const bool expand) override;
|
||||||
int itemCount() override;
|
int itemCount() override;
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
void updateSize();
|
void updateSize();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int whereToInsert(FashionTrayWidgetWrapper *wrapper) Q_DECL_OVERRIDE;
|
int whereToInsert(FashionTrayWidgetWrapper *wrapper) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -28,36 +28,36 @@ void SpliterAnimated::setEndValue(const QVariant &value)
|
|||||||
m_sizeAnimation->setEndValue(value);
|
m_sizeAnimation->setEndValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpliterAnimated::startAnimation()
|
//void SpliterAnimated::startAnimation()
|
||||||
{
|
//{
|
||||||
if (!isVisible()) {
|
// if (!isVisible()) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
m_currentOpacity = OpacityMini;
|
// m_currentOpacity = OpacityMini;
|
||||||
|
|
||||||
if (m_dockPosition == Dock::Position::Top || m_dockPosition == Dock::Position::Bottom) {
|
// if (m_dockPosition == Dock::Position::Top || m_dockPosition == Dock::Position::Bottom) {
|
||||||
m_opacityChangeStep = (OpacityMax - OpacityMini) /
|
// m_opacityChangeStep = (OpacityMax - OpacityMini) /
|
||||||
(m_sizeAnimation->endValue().toSizeF().height() -
|
// (m_sizeAnimation->endValue().toSizeF().height() -
|
||||||
m_sizeAnimation->startValue().toSizeF().height());
|
// m_sizeAnimation->startValue().toSizeF().height());
|
||||||
} else {
|
// } else {
|
||||||
m_opacityChangeStep = (OpacityMax - OpacityMini) /
|
// m_opacityChangeStep = (OpacityMax - OpacityMini) /
|
||||||
(m_sizeAnimation->endValue().toSizeF().width() -
|
// (m_sizeAnimation->endValue().toSizeF().width() -
|
||||||
m_sizeAnimation->startValue().toSizeF().width());
|
// m_sizeAnimation->startValue().toSizeF().width());
|
||||||
}
|
// }
|
||||||
|
|
||||||
m_sizeAnimation->start();
|
// m_sizeAnimation->start();
|
||||||
|
|
||||||
update();
|
// update();
|
||||||
}
|
//}
|
||||||
|
|
||||||
void SpliterAnimated::stopAnimation()
|
//void SpliterAnimated::stopAnimation()
|
||||||
{
|
//{
|
||||||
m_sizeAnimation->stop();
|
// m_sizeAnimation->stop();
|
||||||
m_currentOpacity = OpacityMini;
|
// m_currentOpacity = OpacityMini;
|
||||||
|
|
||||||
update();
|
// update();
|
||||||
}
|
//}
|
||||||
|
|
||||||
void SpliterAnimated::setDockPosition(const Dock::Position position)
|
void SpliterAnimated::setDockPosition(const Dock::Position position)
|
||||||
{
|
{
|
||||||
|
@ -14,12 +14,12 @@ public:
|
|||||||
|
|
||||||
void setStartValue(const QVariant &value);
|
void setStartValue(const QVariant &value);
|
||||||
void setEndValue(const QVariant &value);
|
void setEndValue(const QVariant &value);
|
||||||
void startAnimation();
|
// void startAnimation();
|
||||||
void stopAnimation();
|
// void stopAnimation();
|
||||||
void setDockPosition(const Dock::Position position);
|
void setDockPosition(const Dock::Position position);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onSizeAnimationValueChanged(const QVariant &value);
|
void onSizeAnimationValueChanged(const QVariant &value);
|
||||||
|
@ -42,11 +42,11 @@ Q_SIGNALS:
|
|||||||
void expandChanged(const bool expanded);
|
void expandChanged(const bool expanded);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
|
void enterEvent(QEvent *event) override;
|
||||||
void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
|
void leaveEvent(QEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -62,10 +62,10 @@ public slots:
|
|||||||
void onPluginSettingsChanged();
|
void onPluginSettingsChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
void showEvent(QShowEvent *event) override;
|
||||||
void hideEvent(QHideEvent *event) Q_DECL_OVERRIDE;
|
void hideEvent(QHideEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
bool event(QEvent *event) override;
|
bool event(QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -51,13 +51,13 @@ Q_SIGNALS:
|
|||||||
void requestSwapWithDragging();
|
void requestSwapWithDragging();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
|
void enterEvent(QEvent *event) override;
|
||||||
void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
|
void leaveEvent(QEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
class IndicatorTrayPrivate
|
class IndicatorTrayPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IndicatorTrayPrivate(IndicatorTray *parent) : q_ptr(parent) {}
|
explicit IndicatorTrayPrivate(IndicatorTray *parent) : q_ptr(parent) {}
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ public:
|
|||||||
~IndicatorTrayWidget();
|
~IndicatorTrayWidget();
|
||||||
|
|
||||||
QString itemKeyForConfig() override;
|
QString itemKeyForConfig() override;
|
||||||
void setActive(const bool active) Q_DECL_OVERRIDE;
|
void setActive(const bool active) override;
|
||||||
void updateIcon() Q_DECL_OVERRIDE;
|
void updateIcon() override;
|
||||||
const QImage trayImage() Q_DECL_OVERRIDE;
|
const QImage trayImage() override;
|
||||||
void sendClick(uint8_t, int, int) Q_DECL_OVERRIDE;
|
void sendClick(uint8_t, int, int) override;
|
||||||
static QString toIndicatorKey(const QString &indicatorName) { return QString("indicator:%1").arg(indicatorName); }
|
static QString toIndicatorKey(const QString &indicatorName) { return QString("indicator:%1").arg(indicatorName); }
|
||||||
static bool isIndicatorKey(const QString &itemKey) { return itemKey.startsWith("indicator:"); }
|
static bool isIndicatorKey(const QString &itemKey) { return itemKey.startsWith("indicator:"); }
|
||||||
|
|
||||||
|
@ -49,15 +49,15 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SNITrayWidget(const QString &sniServicePath, QWidget *parent = Q_NULLPTR);
|
SNITrayWidget(const QString &sniServicePath, QWidget *parent = Q_NULLPTR);
|
||||||
virtual ~SNITrayWidget();
|
virtual ~SNITrayWidget() override;
|
||||||
|
|
||||||
QString itemKeyForConfig() override;
|
QString itemKeyForConfig() override;
|
||||||
void setActive(const bool active) Q_DECL_OVERRIDE;
|
void setActive(const bool active) override;
|
||||||
void updateIcon() Q_DECL_OVERRIDE;
|
void updateIcon() override;
|
||||||
void sendClick(uint8_t mouseButton, int x, int y) Q_DECL_OVERRIDE;
|
void sendClick(uint8_t mouseButton, int x, int y) override;
|
||||||
const QImage trayImage() Q_DECL_OVERRIDE;
|
const QImage trayImage() override;
|
||||||
|
|
||||||
bool isValid();
|
bool isValid() override;
|
||||||
SNITrayWidget::ItemStatus status();
|
SNITrayWidget::ItemStatus status();
|
||||||
SNITrayWidget::ItemCategory category();
|
SNITrayWidget::ItemCategory category();
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ private Q_SLOTS:
|
|||||||
void leaveEvent(QEvent *event) override;
|
void leaveEvent(QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
QPixmap newIconPixmap(IconType iconType);
|
QPixmap newIconPixmap(IconType iconType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -41,11 +41,11 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QString itemKeyForConfig() override;
|
QString itemKeyForConfig() override;
|
||||||
void setActive(const bool active) Q_DECL_OVERRIDE;
|
void setActive(const bool active) override;
|
||||||
void updateIcon() Q_DECL_OVERRIDE;
|
void updateIcon() override;
|
||||||
const QImage trayImage() Q_DECL_OVERRIDE;
|
const QImage trayImage() override;
|
||||||
void sendClick(uint8_t mouseButton, int x, int y) Q_DECL_OVERRIDE;
|
void sendClick(uint8_t mouseButton, int x, int y) override;
|
||||||
inline TrayType trayTyep() const Q_DECL_OVERRIDE { return TrayType::SystemTray; }
|
inline TrayType trayTyep() const override { return TrayType::SystemTray; }
|
||||||
|
|
||||||
QWidget *trayTipsWidget();
|
QWidget *trayTipsWidget();
|
||||||
QWidget *trayPopupApplet();
|
QWidget *trayPopupApplet();
|
||||||
@ -66,11 +66,11 @@ signals:
|
|||||||
void itemVisibleChanged(bool visible);
|
void itemVisibleChanged(bool visible);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
bool event(QEvent *event) override;
|
||||||
void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
|
void enterEvent(QEvent *event) override;
|
||||||
void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
|
void leaveEvent(QEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
void showEvent(QShowEvent* event) override;
|
void showEvent(QShowEvent* event) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -42,12 +42,12 @@ public:
|
|||||||
explicit SystemTraysController(QObject *parent = nullptr);
|
explicit SystemTraysController(QObject *parent = nullptr);
|
||||||
|
|
||||||
// implements PluginProxyInterface
|
// implements PluginProxyInterface
|
||||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||||
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) Q_DECL_OVERRIDE;
|
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) override;
|
||||||
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) Q_DECL_OVERRIDE;
|
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||||
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) Q_DECL_OVERRIDE;
|
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) override;
|
||||||
|
|
||||||
int systemTrayItemSortKey(const QString &itemKey);
|
int systemTrayItemSortKey(const QString &itemKey);
|
||||||
void setSystemTrayItemSortKey(const QString &itemKey, const int order);
|
void setSystemTrayItemSortKey(const QString &itemKey, const int order);
|
||||||
|
@ -169,7 +169,7 @@ int TrayPlugin::itemSortKey(const QString &itemKey)
|
|||||||
return m_systemTraysController->systemTrayItemSortKey(itemKey);
|
return m_systemTraysController->systemTrayItemSortKey(itemKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int defaultSort = displayMode() == Dock::DisplayMode::Fashion ? 0 : 0;
|
const int defaultSort = 0;
|
||||||
|
|
||||||
AbstractTrayWidget *const trayWidget = m_trayMap.value(itemKey, nullptr);
|
AbstractTrayWidget *const trayWidget = m_trayMap.value(itemKey, nullptr);
|
||||||
if (trayWidget == nullptr) {
|
if (trayWidget == nullptr) {
|
||||||
|
@ -46,17 +46,17 @@ class TrayPlugin : public QObject, PluginsItemInterface
|
|||||||
public:
|
public:
|
||||||
explicit TrayPlugin(QObject *parent = 0);
|
explicit TrayPlugin(QObject *parent = 0);
|
||||||
|
|
||||||
const QString pluginName() const Q_DECL_OVERRIDE;
|
const QString pluginName() const override;
|
||||||
void init(PluginProxyInterface *proxyInter) Q_DECL_OVERRIDE;
|
void init(PluginProxyInterface *proxyInter) override;
|
||||||
bool pluginIsDisable() override;
|
bool pluginIsDisable() override;
|
||||||
void displayModeChanged(const Dock::DisplayMode mode) Q_DECL_OVERRIDE;
|
void displayModeChanged(const Dock::DisplayMode mode) override;
|
||||||
void positionChanged(const Dock::Position position) Q_DECL_OVERRIDE;
|
void positionChanged(const Dock::Position position) override;
|
||||||
QWidget *itemWidget(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemWidget(const QString &itemKey) override;
|
||||||
QWidget *itemTipsWidget(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemTipsWidget(const QString &itemKey) override;
|
||||||
QWidget *itemPopupApplet(const QString &itemKey) Q_DECL_OVERRIDE;
|
QWidget *itemPopupApplet(const QString &itemKey) override;
|
||||||
int itemSortKey(const QString &itemKey) Q_DECL_OVERRIDE;
|
int itemSortKey(const QString &itemKey) override;
|
||||||
void setSortKey(const QString &itemKey, const int order) Q_DECL_OVERRIDE;
|
void setSortKey(const QString &itemKey, const int order) override;
|
||||||
void refreshIcon(const QString &itemKey) Q_DECL_OVERRIDE;
|
void refreshIcon(const QString &itemKey) override;
|
||||||
void pluginSettingsChanged() override;
|
void pluginSettingsChanged() override;
|
||||||
|
|
||||||
Dock::Position dockPosition() const;
|
Dock::Position dockPosition() const;
|
||||||
|
@ -440,44 +440,44 @@ QString XEmbedTrayWidget::getAppNameForWindow(quint32 winId)
|
|||||||
return appName;
|
return appName;
|
||||||
}
|
}
|
||||||
|
|
||||||
int XEmbedTrayWidget::getTrayWidgetKeySuffix(const QString &appName, quint32 winId)
|
//int XEmbedTrayWidget::getTrayWidgetKeySuffix(const QString &appName, quint32 winId)
|
||||||
{
|
//{
|
||||||
int suffix = AppWinidSuffixMap.value(appName).value(winId, 0);
|
// int suffix = AppWinidSuffixMap.value(appName).value(winId, 0);
|
||||||
|
|
||||||
// return the exist suffix
|
// // return the exist suffix
|
||||||
if (suffix != 0) {
|
// if (suffix != 0) {
|
||||||
return suffix;
|
// return suffix;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// it is the first window for this application
|
// // it is the first window for this application
|
||||||
if (!AppWinidSuffixMap.contains(appName)) {
|
// if (!AppWinidSuffixMap.contains(appName)) {
|
||||||
QMap<quint32, int> winIdSuffixMap;
|
// QMap<quint32, int> winIdSuffixMap;
|
||||||
winIdSuffixMap.insert(winId, 1);
|
// winIdSuffixMap.insert(winId, 1);
|
||||||
AppWinidSuffixMap.insert(appName, winIdSuffixMap);
|
// AppWinidSuffixMap.insert(appName, winIdSuffixMap);
|
||||||
return 1;
|
// return 1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
QMap<quint32, int> subMap = AppWinidSuffixMap.value(appName);
|
// QMap<quint32, int> subMap = AppWinidSuffixMap.value(appName);
|
||||||
QList<int> suffixList = subMap.values();
|
// QList<int> suffixList = subMap.values();
|
||||||
|
|
||||||
// suffix will never be 0
|
// // suffix will never be 0
|
||||||
suffixList.removeAll(0);
|
// suffixList.removeAll(0);
|
||||||
std::sort(suffixList.begin(), suffixList.end());
|
// std::sort(suffixList.begin(), suffixList.end());
|
||||||
|
|
||||||
// get the minimum of useable suffix
|
// // get the minimum of useable suffix
|
||||||
int index = 0;
|
// int index = 0;
|
||||||
for (; index < suffixList.size(); ++index) {
|
// for (; index < suffixList.size(); ++index) {
|
||||||
if (suffixList.at(index) != index + 1) {
|
// if (suffixList.at(index) != index + 1) {
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
suffix = index + 1;
|
// suffix = index + 1;
|
||||||
|
|
||||||
subMap.insert(winId, suffix);
|
// subMap.insert(winId, suffix);
|
||||||
AppWinidSuffixMap.insert(appName, subMap);
|
// AppWinidSuffixMap.insert(appName, subMap);
|
||||||
|
|
||||||
return suffix;
|
// return suffix;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void XEmbedTrayWidget::setX11PassMouseEvent(const bool pass)
|
void XEmbedTrayWidget::setX11PassMouseEvent(const bool pass)
|
||||||
{
|
{
|
||||||
|
@ -36,10 +36,10 @@ public:
|
|||||||
~XEmbedTrayWidget();
|
~XEmbedTrayWidget();
|
||||||
|
|
||||||
QString itemKeyForConfig() override;
|
QString itemKeyForConfig() override;
|
||||||
void updateIcon() Q_DECL_OVERRIDE;
|
void updateIcon() override;
|
||||||
void setActive(const bool active) Q_DECL_OVERRIDE;
|
void setActive(const bool active) override;
|
||||||
const QImage trayImage() Q_DECL_OVERRIDE;
|
const QImage trayImage() override;
|
||||||
void sendClick(uint8_t mouseButton, int x, int y) Q_DECL_OVERRIDE;
|
void sendClick(uint8_t mouseButton, int x, int y) override;
|
||||||
|
|
||||||
static QString getWindowProperty(quint32 winId, QString propName);
|
static QString getWindowProperty(quint32 winId, QString propName);
|
||||||
static QString toXEmbedKey(quint32 winId);
|
static QString toXEmbedKey(quint32 winId);
|
||||||
@ -47,9 +47,9 @@ public:
|
|||||||
virtual bool isValid() override {return m_valid;}
|
virtual bool isValid() override {return m_valid;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void showEvent(QShowEvent *e) Q_DECL_OVERRIDE;
|
void showEvent(QShowEvent *e) override;
|
||||||
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
void configContainerPosition();
|
void configContainerPosition();
|
||||||
|
|
||||||
void wrapWindow();
|
void wrapWindow();
|
||||||
@ -57,7 +57,7 @@ private:
|
|||||||
void refershIconImage();
|
void refershIconImage();
|
||||||
|
|
||||||
static QString getAppNameForWindow(quint32 winId);
|
static QString getAppNameForWindow(quint32 winId);
|
||||||
static int getTrayWidgetKeySuffix(const QString &appName, quint32 winId);
|
// static int getTrayWidgetKeySuffix(const QString &appName, quint32 winId);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setX11PassMouseEvent(const bool pass);
|
void setX11PassMouseEvent(const bool pass);
|
||||||
|
@ -4,7 +4,10 @@
|
|||||||
#include <QAccessible>
|
#include <QAccessible>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
|
|
||||||
TipsWidget::TipsWidget(QWidget *parent) : QFrame(parent)
|
TipsWidget::TipsWidget(QWidget *parent)
|
||||||
|
: QFrame(parent)
|
||||||
|
, m_width(0)
|
||||||
|
, m_type(SingleLine)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user