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-15 17:44:38 +08:00
|
|
|
#ifndef PLUGINSITEM_H
|
|
|
|
#define PLUGINSITEM_H
|
|
|
|
|
|
|
|
#include "dockitem.h"
|
2016-06-24 11:32:25 +08:00
|
|
|
#include "pluginsiteminterface.h"
|
2016-06-15 17:44:38 +08:00
|
|
|
|
|
|
|
class PluginsItem : public DockItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-06-24 11:32:25 +08:00
|
|
|
explicit PluginsItem(PluginsItemInterface* const pluginInter, const QString &itemKey, QWidget *parent = 0);
|
2016-06-28 19:35:19 +08:00
|
|
|
~PluginsItem();
|
2016-06-16 16:56:21 +08:00
|
|
|
|
2016-06-24 14:59:56 +08:00
|
|
|
int itemSortKey() const;
|
2016-08-08 20:52:19 +08:00
|
|
|
void setItemSortKey(const int order) const;
|
2016-06-28 19:35:19 +08:00
|
|
|
void detachPluginWidget();
|
2016-06-24 14:59:56 +08:00
|
|
|
|
2016-08-15 14:11:19 +08:00
|
|
|
bool allowContainer() const;
|
|
|
|
bool isInContainer() const;
|
|
|
|
void setInContainer(const bool container);
|
|
|
|
|
2016-08-08 19:19:11 +08:00
|
|
|
using DockItem::showContextMenu;
|
2017-02-15 17:34:45 +08:00
|
|
|
using DockItem::hidePopup;
|
2016-08-08 19:19:11 +08:00
|
|
|
|
2017-06-26 15:20:16 +08:00
|
|
|
inline ItemType itemType() const override {return Plugins;}
|
|
|
|
QSize sizeHint() const override;
|
2016-08-08 09:52:05 +08:00
|
|
|
|
2016-08-18 15:14:50 +08:00
|
|
|
public slots:
|
2017-06-26 15:20:16 +08:00
|
|
|
void refershIcon() override;
|
2016-08-18 15:14:50 +08:00
|
|
|
|
2016-06-24 14:59:56 +08:00
|
|
|
private:
|
2017-06-26 15:20:16 +08:00
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
|
|
|
bool eventFilter(QObject *o, QEvent *e) override;
|
|
|
|
|
|
|
|
void invokedMenuItem(const QString &itemId, const bool checked) override;
|
2017-11-08 14:10:56 +08:00
|
|
|
void showPopupWindow(QWidget * const content, const bool model = false) override;
|
2017-06-26 15:20:16 +08:00
|
|
|
const QString contextMenu() const override;
|
|
|
|
QWidget *popupTips() override;
|
2016-07-01 11:07:20 +08:00
|
|
|
|
2016-06-27 10:50:00 +08:00
|
|
|
private:
|
|
|
|
void startDrag();
|
|
|
|
void mouseClicked();
|
|
|
|
|
2016-06-16 16:56:21 +08:00
|
|
|
private:
|
2016-06-24 11:32:25 +08:00
|
|
|
PluginsItemInterface * const m_pluginInter;
|
2017-02-06 22:25:47 +08:00
|
|
|
QWidget *m_centralWidget;
|
2016-06-24 11:32:25 +08:00
|
|
|
const QString m_itemKey;
|
2016-06-27 10:50:00 +08:00
|
|
|
bool m_draging;
|
2016-06-24 11:32:25 +08:00
|
|
|
|
2016-06-27 10:50:00 +08:00
|
|
|
static QPoint MousePressPoint;
|
2016-06-15 17:44:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PLUGINSITEM_H
|