2022-05-17 20:57:09 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
|
|
|
*
|
|
|
|
* Author: donghualin <donghualin@uniontech.com>
|
|
|
|
*
|
|
|
|
* Maintainer: donghualin <donghualin@uniontech.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
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
|
|
|
|
2022-09-16 20:12:52 +00:00
|
|
|
#include <QWidget>
|
2022-05-12 17:09:10 +08:00
|
|
|
|
|
|
|
namespace Dtk { namespace Gui { class DRegionMonitor; };
|
|
|
|
namespace Widget { class DBlurEffectWidget; } }
|
|
|
|
|
|
|
|
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-05-12 17:09:10 +08:00
|
|
|
|
2022-11-02 06:57:46 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void onTrayCountChanged();
|
|
|
|
|
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
|
|
|
DockInter *m_dockInter;
|
|
|
|
bool m_singleShow; // 用于记录当前日期时间和插件区域是显示一行还是显示多行
|
|
|
|
int m_borderRadius; // 圆角的值
|
2022-05-12 17:09:10 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PLUGINWINDOW_H
|