2017-09-18 14:33:44 +08:00
|
|
|
/*
|
2018-02-07 11:52:47 +08:00
|
|
|
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
2017-09-18 14:33:44 +08:00
|
|
|
*
|
|
|
|
* Author: sbw <sbw@sbw.so>
|
|
|
|
*
|
|
|
|
* Maintainer: sbw <sbw@sbw.so>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-06-02 09:46:43 +08:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
2016-06-02 15:43:57 +08:00
|
|
|
#include "xcb/xcb_misc.h"
|
2016-06-03 16:06:11 +08:00
|
|
|
#include "dbus/dbusdisplay.h"
|
2017-03-21 15:40:52 +08:00
|
|
|
#include "dbus/dbusdockadaptors.h"
|
2016-06-06 10:59:29 +08:00
|
|
|
#include "util/docksettings.h"
|
2016-06-02 15:43:57 +08:00
|
|
|
|
2016-06-02 09:46:43 +08:00
|
|
|
#include <QWidget>
|
2016-06-03 16:06:11 +08:00
|
|
|
#include <QTimer>
|
2016-10-14 15:47:43 +08:00
|
|
|
#include <QRect>
|
2017-03-21 15:40:52 +08:00
|
|
|
|
|
|
|
#include <DPlatformWindowHandle>
|
2017-05-11 10:10:32 +08:00
|
|
|
#include <DWindowManagerHelper>
|
2017-03-21 15:40:52 +08:00
|
|
|
|
2016-06-06 10:59:29 +08:00
|
|
|
class MainPanel;
|
2016-10-14 15:47:43 +08:00
|
|
|
class DBusDockAdaptors;
|
2016-06-02 09:46:43 +08:00
|
|
|
class MainWindow : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MainWindow(QWidget *parent = 0);
|
2016-06-15 11:09:34 +08:00
|
|
|
~MainWindow();
|
2016-06-02 15:43:57 +08:00
|
|
|
|
2017-12-05 13:08:17 +08:00
|
|
|
public slots:
|
|
|
|
void launch();
|
|
|
|
|
2016-06-02 15:43:57 +08:00
|
|
|
private:
|
2017-12-05 13:08:17 +08:00
|
|
|
using QWidget::show;
|
2017-12-11 12:02:54 +08:00
|
|
|
bool event(QEvent *e);
|
2018-02-01 14:23:53 +08:00
|
|
|
void showEvent(QShowEvent *e);
|
2016-06-21 14:02:51 +08:00
|
|
|
void mousePressEvent(QMouseEvent *e);
|
2016-06-03 16:06:11 +08:00
|
|
|
void keyPressEvent(QKeyEvent *e);
|
2016-06-29 16:53:37 +08:00
|
|
|
void enterEvent(QEvent *e);
|
|
|
|
void leaveEvent(QEvent *e);
|
2017-07-04 14:34:38 +08:00
|
|
|
void dragEnterEvent(QDragEnterEvent *e);
|
2016-06-29 16:53:37 +08:00
|
|
|
|
2016-06-23 20:05:03 +08:00
|
|
|
void setFixedSize(const QSize &size);
|
2017-11-13 21:17:56 +08:00
|
|
|
void internalAnimationMove(int x, int y);
|
2016-06-06 10:59:29 +08:00
|
|
|
void initComponents();
|
|
|
|
void initConnections();
|
2016-06-03 16:06:11 +08:00
|
|
|
|
2017-06-08 15:38:11 +08:00
|
|
|
const QPoint x11GetWindowPos();
|
|
|
|
void x11MoveWindow(const int x, const int y);
|
|
|
|
void x11MoveResizeWindow(const int x, const int y, const int w, const int h);
|
|
|
|
|
2016-10-14 15:47:43 +08:00
|
|
|
signals:
|
|
|
|
void panelGeometryChanged();
|
|
|
|
|
2016-06-03 16:06:11 +08:00
|
|
|
private slots:
|
2016-08-12 14:28:35 +08:00
|
|
|
void positionChanged(const Position prevPos);
|
2016-06-03 16:06:11 +08:00
|
|
|
void updatePosition();
|
2016-06-22 10:28:47 +08:00
|
|
|
void updateGeometry();
|
2016-06-15 11:09:34 +08:00
|
|
|
void clearStrutPartial();
|
|
|
|
void setStrutPartial();
|
2017-05-22 10:38:49 +08:00
|
|
|
void compositeChanged();
|
2017-11-23 12:21:00 +08:00
|
|
|
void internalMove() { internalMove(m_posChangeAni->currentValue().toPoint()); }
|
|
|
|
void internalMove(const QPoint &p);
|
2016-06-03 16:06:11 +08:00
|
|
|
|
2016-06-29 16:53:37 +08:00
|
|
|
void expand();
|
2016-08-12 14:28:35 +08:00
|
|
|
void narrow(const Position prevPos);
|
2018-01-02 16:48:01 +08:00
|
|
|
void resetPanelEnvironment(const bool visible, const bool resetPosition = true);
|
2016-06-29 16:53:37 +08:00
|
|
|
void updatePanelVisible();
|
|
|
|
|
2017-03-21 15:40:52 +08:00
|
|
|
void adjustShadowMask();
|
2017-12-11 12:02:54 +08:00
|
|
|
void positionCheck();
|
2017-03-21 15:40:52 +08:00
|
|
|
|
2016-06-03 16:06:11 +08:00
|
|
|
private:
|
2017-12-05 13:08:17 +08:00
|
|
|
bool m_launched;
|
2016-08-12 14:28:35 +08:00
|
|
|
bool m_updatePanelVisible;
|
2016-06-02 15:43:57 +08:00
|
|
|
MainPanel *m_mainPanel;
|
2016-06-03 16:06:11 +08:00
|
|
|
|
2017-03-27 15:36:37 +08:00
|
|
|
DPlatformWindowHandle m_platformWindowHandle;
|
2017-05-11 10:10:32 +08:00
|
|
|
DWindowManagerHelper *m_wmHelper;
|
2017-03-21 15:40:52 +08:00
|
|
|
|
2016-06-03 16:06:11 +08:00
|
|
|
QTimer *m_positionUpdateTimer;
|
2016-08-18 16:06:40 +08:00
|
|
|
QTimer *m_expandDelayTimer;
|
2018-01-02 16:48:01 +08:00
|
|
|
QTimer *m_leaveDelayTimer;
|
2017-12-05 13:08:17 +08:00
|
|
|
QTimer *m_shadowMaskOptimizeTimer;
|
2017-07-04 14:58:11 +08:00
|
|
|
QVariantAnimation *m_sizeChangeAni;
|
2017-11-13 21:17:56 +08:00
|
|
|
QVariantAnimation *m_posChangeAni;
|
2016-06-29 16:53:37 +08:00
|
|
|
QPropertyAnimation *m_panelShowAni;
|
|
|
|
QPropertyAnimation *m_panelHideAni;
|
2016-06-27 16:36:51 +08:00
|
|
|
|
|
|
|
XcbMisc *m_xcbMisc;
|
|
|
|
DockSettings *m_settings;
|
2016-06-02 09:46:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|