mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
120 lines
3.4 KiB
C++
120 lines
3.4 KiB
C++
/*
|
|
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
|
*
|
|
* Author: sbw <sbw@sbw.so>
|
|
*
|
|
* Maintainer: sbw <sbw@sbw.so>
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef APPITEM_H
|
|
#define APPITEM_H
|
|
|
|
#include "dockitem.h"
|
|
#include "components/previewcontainer.h"
|
|
#include "dbus/dbusclientmanager.h"
|
|
#include "../widgets/tipswidget.h"
|
|
|
|
#include <QGraphicsView>
|
|
#include <QGraphicsItem>
|
|
#include <QGraphicsItemAnimation>
|
|
|
|
#include <com_deepin_dde_daemon_dock_entry.h>
|
|
|
|
using DockEntryInter = com::deepin::dde::daemon::dock::Entry;
|
|
|
|
class AppItem : public DockItem
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit AppItem(const QDBusObjectPath &entry, QWidget *parent = nullptr);
|
|
~AppItem();
|
|
|
|
const QString appId() const;
|
|
void updateWindowIconGeometries();
|
|
static void setIconBaseSize(const int size);
|
|
static int iconBaseSize();
|
|
static int itemBaseHeight();
|
|
static int itemBaseWidth();
|
|
|
|
inline ItemType itemType() const { return App; }
|
|
|
|
signals:
|
|
void requestActivateWindow(const WId wid) const;
|
|
void requestPreviewWindow(const WId wid) const;
|
|
void requestCancelPreview() const;
|
|
|
|
private:
|
|
void moveEvent(QMoveEvent *e) override;
|
|
void paintEvent(QPaintEvent *e) override;
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
|
void mousePressEvent(QMouseEvent *e) override;
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
|
void wheelEvent(QWheelEvent *e) override;
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
void dragEnterEvent(QDragEnterEvent *e) override;
|
|
void dragMoveEvent(QDragMoveEvent *e) override;
|
|
void dropEvent(QDropEvent *e) override;
|
|
void leaveEvent(QEvent *e) override;
|
|
void showEvent(QShowEvent *e) override;
|
|
|
|
void showHoverTips();
|
|
void invokedMenuItem(const QString &itemId, const bool checked);
|
|
const QString contextMenu() const;
|
|
QWidget *popupTips();
|
|
|
|
void startDrag();
|
|
bool hasAttention() const;
|
|
|
|
private slots:
|
|
void updateWindowInfos(const WindowInfoMap &info);
|
|
void refershIcon();
|
|
void activeChanged();
|
|
void showPreview();
|
|
void cancelAndHidePreview();
|
|
void playSwingEffect();
|
|
void stopSwingEffect();
|
|
void checkAttentionEffect();
|
|
|
|
private:
|
|
TipsWidget *m_appNameTips;
|
|
PreviewContainer *m_appPreviewTips;
|
|
DockEntryInter *m_itemEntryInter;
|
|
|
|
QGraphicsView *m_swingEffectView;
|
|
QGraphicsItemAnimation *m_itemAnimation;
|
|
|
|
bool m_dragging;
|
|
bool m_active;
|
|
WindowInfoMap m_windowInfos;
|
|
QString m_id;
|
|
QPixmap m_appIcon;
|
|
QPixmap m_horizontalIndicator;
|
|
QPixmap m_verticalIndicator;
|
|
QPixmap m_activeHorizontalIndicator;
|
|
QPixmap m_activeVerticalIndicator;
|
|
|
|
QTimer *m_updateIconGeometryTimer;
|
|
|
|
QFutureWatcher<QPixmap> *m_smallWatcher;
|
|
QFutureWatcher<QPixmap> *m_largeWatcher;
|
|
|
|
static int IconBaseSize;
|
|
static QPoint MousePressPos;
|
|
};
|
|
|
|
#endif // APPITEM_H
|