2023-02-16 13:51:55 +08:00
|
|
|
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
|
|
|
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2022-05-12 17:09:10 +08:00
|
|
|
#ifndef TRAYMANAGERWINDOW_H
|
|
|
|
#define TRAYMANAGERWINDOW_H
|
|
|
|
|
|
|
|
#include "constants.h"
|
2022-08-25 19:31:31 +00:00
|
|
|
#include "dbusutil.h"
|
2022-05-12 17:09:10 +08:00
|
|
|
|
2022-11-18 17:08:32 +08:00
|
|
|
#include "org_deepin_dde_timedate1.h"
|
2022-05-12 17:09:10 +08:00
|
|
|
|
2023-03-09 16:46:07 +08:00
|
|
|
#include <QPainterPath>
|
2022-09-16 20:12:52 +00:00
|
|
|
#include <QWidget>
|
2022-05-12 17:09:10 +08:00
|
|
|
|
2023-01-11 09:09:36 +08:00
|
|
|
namespace Dtk { namespace Widget { class DBlurEffectWidget; } }
|
2022-05-12 17:09:10 +08:00
|
|
|
|
|
|
|
using namespace Dtk::Widget;
|
|
|
|
|
2022-11-18 17:08:32 +08:00
|
|
|
using Timedate = org::deepin::dde::Timedate1;
|
2022-05-12 17:09:10 +08:00
|
|
|
|
|
|
|
class QuickPluginWindow;
|
|
|
|
class QBoxLayout;
|
|
|
|
class TrayGridView;
|
|
|
|
class TrayModel;
|
2022-05-17 20:57:09 +08:00
|
|
|
class TrayDelegate;
|
2022-05-12 17:09:10 +08:00
|
|
|
class SystemPluginWindow;
|
|
|
|
class QLabel;
|
|
|
|
class QDropEvent;
|
|
|
|
class DateTimeDisplayer;
|
2022-08-25 19:31:31 +00:00
|
|
|
class QPainterPath;
|
2022-05-12 17:09:10 +08:00
|
|
|
|
|
|
|
class TrayManagerWindow : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit TrayManagerWindow(QWidget *parent = nullptr);
|
|
|
|
~TrayManagerWindow() override;
|
2022-05-27 17:34:02 +08:00
|
|
|
|
2022-08-25 19:31:31 +00:00
|
|
|
void updateBorderRadius(int borderRadius);
|
2022-05-27 17:34:02 +08:00
|
|
|
void updateLayout();
|
2022-05-12 17:09:10 +08:00
|
|
|
void setPositon(Dock::Position position);
|
2022-11-02 06:57:46 +00:00
|
|
|
void setDisplayMode(Dock::DisplayMode displayMode);
|
2022-08-25 19:31:31 +00:00
|
|
|
QSize suitableSize() const;
|
|
|
|
QSize suitableSize(const Dock::Position &position) const;
|
2022-05-12 17:09:10 +08:00
|
|
|
|
2022-05-25 09:42:01 +08:00
|
|
|
Q_SIGNALS:
|
2022-06-20 15:03:35 +08:00
|
|
|
void requestUpdate();
|
2022-05-25 09:42:01 +08:00
|
|
|
|
2022-05-12 17:09:10 +08:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
2022-05-25 09:44:29 +08:00
|
|
|
void dragEnterEvent(QDragEnterEvent *e) override;
|
|
|
|
void dragMoveEvent(QDragMoveEvent *e) override;
|
|
|
|
void dropEvent(QDropEvent *e) override;
|
|
|
|
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
2022-05-25 09:42:01 +08:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
2022-05-12 17:09:10 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
void initUi();
|
|
|
|
void initConnection();
|
|
|
|
|
|
|
|
void resetChildWidgetSize();
|
|
|
|
void resetMultiDirection();
|
|
|
|
void resetSingleDirection();
|
2022-05-25 09:42:01 +08:00
|
|
|
QColor maskColor(uint8_t alpha) const;
|
2022-05-12 17:09:10 +08:00
|
|
|
|
2022-08-25 19:31:31 +00:00
|
|
|
int appDatetimeSize(const Dock::Position &position) const;
|
2022-05-25 09:42:01 +08:00
|
|
|
QPainterPath roundedPaths();
|
2022-12-12 09:52:52 +00:00
|
|
|
void updateItemLayout(int dockSize);
|
2023-01-12 13:55:34 +08:00
|
|
|
int pathRadius() const;
|
2022-05-12 17:09:10 +08:00
|
|
|
|
2022-11-02 06:57:46 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void onTrayCountChanged();
|
2023-03-09 16:46:07 +08:00
|
|
|
void updateHighlightArea(const QRect &rect);
|
2022-11-02 06:57:46 +00:00
|
|
|
|
2022-05-12 17:09:10 +08:00
|
|
|
private:
|
2022-05-25 09:42:01 +08:00
|
|
|
QWidget *m_appPluginDatetimeWidget;
|
2022-05-12 17:09:10 +08:00
|
|
|
SystemPluginWindow *m_systemPluginWidget;
|
|
|
|
QWidget *m_appPluginWidget;
|
|
|
|
QuickPluginWindow *m_quickIconWidget;
|
|
|
|
DateTimeDisplayer *m_dateTimeWidget;
|
|
|
|
QBoxLayout *m_appPluginLayout;
|
|
|
|
QBoxLayout *m_mainLayout;
|
|
|
|
TrayGridView *m_trayView;
|
|
|
|
TrayModel *m_model;
|
2022-05-17 20:57:09 +08:00
|
|
|
TrayDelegate *m_delegate;
|
2022-08-25 19:31:31 +00:00
|
|
|
Dock::Position m_position;
|
2022-11-02 06:57:46 +00:00
|
|
|
Dock::DisplayMode m_displayMode;
|
2022-05-17 20:57:09 +08:00
|
|
|
QLabel *m_splitLine;
|
2022-08-25 19:31:31 +00:00
|
|
|
bool m_singleShow; // 用于记录当前日期时间和插件区域是显示一行还是显示多行
|
|
|
|
int m_borderRadius; // 圆角的值
|
2023-06-07 14:11:50 +08:00
|
|
|
uint m_windowFashionSize;
|
2023-03-09 16:46:07 +08:00
|
|
|
QPainterPath m_highlightArea;
|
2022-05-12 17:09:10 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PLUGINWINDOW_H
|