mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
chore: 修复内存泄露问题
修复内存泄露 Log: Bug: https://pms.uniontech.com/zentao/bug-view-80694.html Bug: https://pms.uniontech.com/zentao/bug-view-80695.html Change-Id: I7410c84aa0a4d6f277ba7a887614814374ef683d
This commit is contained in:
parent
e4d7556090
commit
331cf7c749
@ -4,6 +4,11 @@ set(BIN_NAME dde-dock)
|
||||
|
||||
configure_file(environments.h.in environments.h @ONLY)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=address -O2")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address -O2")
|
||||
endif()
|
||||
|
||||
# Sources files
|
||||
file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../widgets/*.h" "../widgets/*.cpp")
|
||||
|
||||
|
@ -125,66 +125,66 @@ QAccessibleInterface *accessibleFactory(const QString &classname, QObject *objec
|
||||
|
||||
QAccessibleInterface *interface = nullptr;
|
||||
|
||||
USE_ACCESSIBLE(classname, MainWindow);
|
||||
USE_ACCESSIBLE(classname, MainPanelControl);
|
||||
USE_ACCESSIBLE(QString(classname).replace("Dock::", ""), TipsWidget);
|
||||
USE_ACCESSIBLE(classname, DockPopupWindow);
|
||||
USE_ACCESSIBLE(classname, LauncherItem);
|
||||
USE_ACCESSIBLE(classname, AppItem);
|
||||
USE_ACCESSIBLE(classname, PreviewContainer);
|
||||
USE_ACCESSIBLE(classname, PluginsItem);
|
||||
USE_ACCESSIBLE(classname, TrayPluginItem);
|
||||
USE_ACCESSIBLE(classname, PlaceholderItem);
|
||||
USE_ACCESSIBLE(classname, AppDragWidget);
|
||||
USE_ACCESSIBLE(classname, AppSnapshot);
|
||||
USE_ACCESSIBLE(classname, FloatingPreview);
|
||||
USE_ACCESSIBLE(classname, SNITrayWidget);
|
||||
USE_ACCESSIBLE(classname, AbstractTrayWidget);
|
||||
USE_ACCESSIBLE(classname, SystemTrayItem);
|
||||
USE_ACCESSIBLE(classname, FashionTrayItem);
|
||||
USE_ACCESSIBLE(classname, FashionTrayWidgetWrapper);
|
||||
USE_ACCESSIBLE(classname, FashionTrayControlWidget);
|
||||
USE_ACCESSIBLE(classname, AttentionContainer);
|
||||
USE_ACCESSIBLE(classname, HoldContainer);
|
||||
USE_ACCESSIBLE(classname, NormalContainer);
|
||||
USE_ACCESSIBLE(classname, SpliterAnimated);
|
||||
USE_ACCESSIBLE(classname, IndicatorTrayWidget);
|
||||
USE_ACCESSIBLE(classname, XEmbedTrayWidget);
|
||||
USE_ACCESSIBLE(classname, DesktopWidget);
|
||||
USE_ACCESSIBLE(classname, DatetimeWidget);
|
||||
USE_ACCESSIBLE(classname, OnboardItem);
|
||||
USE_ACCESSIBLE(classname, TrashWidget);
|
||||
USE_ACCESSIBLE(classname, PopupControlWidget);
|
||||
USE_ACCESSIBLE(classname, ShutdownWidget);
|
||||
USE_ACCESSIBLE(classname, MultitaskingWidget);
|
||||
USE_ACCESSIBLE(classname, ShowDesktopWidget);
|
||||
USE_ACCESSIBLE(classname, OverlayWarningWidget);
|
||||
USE_ACCESSIBLE(classname, QWidget);
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_fix");
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_app");
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_tray");
|
||||
USE_ACCESSIBLE(classname, QLabel);
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DIconButton, "closebutton-2d");
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DIconButton, "closebutton-3d");
|
||||
USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DSwitchButton, "");
|
||||
USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DBlurEffectWidget);
|
||||
USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DListView);
|
||||
USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DLoadingIndicator);
|
||||
USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DSpinner);
|
||||
USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DSwitchButton);
|
||||
USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DIconButton);
|
||||
USE_ACCESSIBLE(classname, QMenu);
|
||||
USE_ACCESSIBLE(classname, QPushButton);
|
||||
USE_ACCESSIBLE(classname, QSlider);
|
||||
USE_ACCESSIBLE(classname, QScrollBar);
|
||||
USE_ACCESSIBLE(classname, QScrollArea);
|
||||
USE_ACCESSIBLE(classname, QFrame);
|
||||
USE_ACCESSIBLE(classname, QGraphicsView);
|
||||
USE_ACCESSIBLE(classname, DragWidget);
|
||||
USE_ACCESSIBLE(classname, NetworkItem);
|
||||
USE_ACCESSIBLE(classname, StateButton);
|
||||
USE_ACCESSIBLE(classname, DeviceControlWidget);
|
||||
USE_ACCESSIBLE(classname, HorizontalSeperator);
|
||||
USE_ACCESSIBLE(classname, MainWindow)
|
||||
ELSE_USE_ACCESSIBLE(classname, MainPanelControl)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dock::", ""), TipsWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, DockPopupWindow)
|
||||
ELSE_USE_ACCESSIBLE(classname, LauncherItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, AppItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, PreviewContainer)
|
||||
ELSE_USE_ACCESSIBLE(classname, PluginsItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, TrayPluginItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, PlaceholderItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, AppDragWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, AppSnapshot)
|
||||
ELSE_USE_ACCESSIBLE(classname, FloatingPreview)
|
||||
ELSE_USE_ACCESSIBLE(classname, SNITrayWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, AbstractTrayWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, SystemTrayItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, FashionTrayItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, FashionTrayWidgetWrapper)
|
||||
ELSE_USE_ACCESSIBLE(classname, FashionTrayControlWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, AttentionContainer)
|
||||
ELSE_USE_ACCESSIBLE(classname, HoldContainer)
|
||||
ELSE_USE_ACCESSIBLE(classname, NormalContainer)
|
||||
ELSE_USE_ACCESSIBLE(classname, SpliterAnimated)
|
||||
ELSE_USE_ACCESSIBLE(classname, IndicatorTrayWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, XEmbedTrayWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, DesktopWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, DatetimeWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, OnboardItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, TrashWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, PopupControlWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, ShutdownWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, MultitaskingWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, ShowDesktopWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, OverlayWarningWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, QWidget)
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_fix")
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_app")
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_tray")
|
||||
ELSE_USE_ACCESSIBLE(classname, QLabel)
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DIconButton, "closebutton-2d")
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DIconButton, "closebutton-3d")
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DSwitchButton, "")
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DBlurEffectWidget)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DListView)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DLoadingIndicator)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DSpinner)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DSwitchButton)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DIconButton)
|
||||
ELSE_USE_ACCESSIBLE(classname, QMenu)
|
||||
ELSE_USE_ACCESSIBLE(classname, QPushButton)
|
||||
ELSE_USE_ACCESSIBLE(classname, QSlider)
|
||||
ELSE_USE_ACCESSIBLE(classname, QScrollBar)
|
||||
ELSE_USE_ACCESSIBLE(classname, QScrollArea)
|
||||
ELSE_USE_ACCESSIBLE(classname, QFrame)
|
||||
ELSE_USE_ACCESSIBLE(classname, QGraphicsView)
|
||||
ELSE_USE_ACCESSIBLE(classname, DragWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, NetworkItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, StateButton)
|
||||
ELSE_USE_ACCESSIBLE(classname, DeviceControlWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, HorizontalSeperator);
|
||||
|
||||
if (!interface && object->inherits("QWidget") && !ignoreLst.contains(classname)) {
|
||||
QWidget *w = static_cast<QWidget *>(object);
|
||||
|
@ -389,12 +389,23 @@ inline QString getAccessibleName(QWidget *w, QAccessible::Role r, const QString
|
||||
interface = new Accessible##classname(static_cast<classname *>(object));\
|
||||
}\
|
||||
|
||||
#define ELSE_USE_ACCESSIBLE(classnamestring,classname) else if (classnamestring == QLatin1String(#classname) && object && object->isWidgetType())\
|
||||
{\
|
||||
interface = new Accessible##classname(static_cast<classname *>(object));\
|
||||
}\
|
||||
|
||||
|
||||
// [指定objectname]---适用同一个类,但objectname不同的情况
|
||||
#define USE_ACCESSIBLE_BY_OBJECTNAME(classnamestring,classname,objectname) if (classnamestring == QLatin1String(#classname) && object && (object->objectName() == objectname) && object->isWidgetType())\
|
||||
{\
|
||||
interface = new Accessible##classname(static_cast<classname *>(object));\
|
||||
}\
|
||||
|
||||
#define ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(classnamestring,classname,objectname) else if (classnamestring == QLatin1String(#classname) && object && (object->objectName() == objectname) && object->isWidgetType())\
|
||||
{\
|
||||
interface = new Accessible##classname(static_cast<classname *>(object));\
|
||||
}\
|
||||
|
||||
/*******************************************简化使用*******************************************/
|
||||
#define SET_FORM_ACCESSIBLE(classname,accessiblename) SET_FORM_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,"")
|
||||
|
||||
|
@ -78,6 +78,8 @@ DockItemManager::DockItemManager(QObject *parent)
|
||||
connect(app, &DApplication::iconThemeChanged, this, &DockItemManager::refreshItemsIcon);
|
||||
}
|
||||
|
||||
connect(qApp, &QApplication::aboutToQuit, this, &QObject::deleteLater);
|
||||
|
||||
// 刷新图标
|
||||
QMetaObject::invokeMethod(this, "refreshItemsIcon", Qt::QueuedConnection);
|
||||
}
|
||||
@ -345,9 +347,9 @@ void DockItemManager::sortPluginItems()
|
||||
if (firstPluginIndex == -1)
|
||||
return;
|
||||
|
||||
std::sort(m_itemList.begin() + firstPluginIndex, m_itemList.end(), [](DockItem * a, DockItem * b) -> bool {
|
||||
PluginsItem *pa = static_cast<PluginsItem *>(a);
|
||||
PluginsItem *pb = static_cast<PluginsItem *>(b);
|
||||
std::sort(m_itemList.begin() + firstPluginIndex, m_itemList.end(), [](QPointer<DockItem> a, QPointer<DockItem> b) -> bool {
|
||||
PluginsItem *pa = static_cast<PluginsItem *>(a.data());
|
||||
PluginsItem *pb = static_cast<PluginsItem *>(b.data());
|
||||
|
||||
const int aKey = pa->itemSortKey();
|
||||
const int bKey = pb->itemSortKey();
|
||||
|
@ -66,8 +66,6 @@ AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSetti
|
||||
, m_updateIconGeometryTimer(new QTimer(this))
|
||||
, m_retryObtainIconTimer(new QTimer(this))
|
||||
, m_refershIconTimer(new QTimer(this))
|
||||
, m_smallWatcher(new QFutureWatcher<QPixmap>(this))
|
||||
, m_largeWatcher(new QFutureWatcher<QPixmap>(this))
|
||||
{
|
||||
QHBoxLayout *centralLayout = new QHBoxLayout;
|
||||
centralLayout->setMargin(0);
|
||||
|
@ -137,8 +137,6 @@ private:
|
||||
|
||||
QDate m_curDate; // 保存当前icon的日期来判断是否需要更新日历APP的ICON
|
||||
|
||||
QFutureWatcher<QPixmap> *m_smallWatcher;
|
||||
QFutureWatcher<QPixmap> *m_largeWatcher;
|
||||
DGuiApplicationHelper::ColorType m_themeType;
|
||||
|
||||
static QPoint MousePressPos;
|
||||
|
@ -71,7 +71,7 @@ AppDragWidget::AppDragWidget(QWidget *parent)
|
||||
, m_goBackAnim(new QPropertyAnimation(this, "pos", this))
|
||||
, m_dockPosition(Dock::Position::Bottom)
|
||||
, m_removeTips(new TipsWidget(this))
|
||||
, m_popupWindow(nullptr)
|
||||
, m_popupWindow(new DockPopupWindow(this))
|
||||
, m_distanceMultiple(Utils::SettingValue("com.deepin.dde.dock.distancemultiple", "/com/deepin/dde/dock/distancemultiple/", "distance-multiple", 1.5).toDouble())
|
||||
{
|
||||
m_removeTips->setText(tr("Remove"));
|
||||
@ -79,14 +79,12 @@ AppDragWidget::AppDragWidget(QWidget *parent)
|
||||
m_removeTips->setVisible(false);
|
||||
m_removeTips->installEventFilter(this);
|
||||
|
||||
DockPopupWindow *arrowRectangle = new DockPopupWindow(nullptr);
|
||||
arrowRectangle->setShadowBlurRadius(20);
|
||||
arrowRectangle->setRadius(18);
|
||||
arrowRectangle->setShadowYOffset(2);
|
||||
arrowRectangle->setShadowXOffset(0);
|
||||
arrowRectangle->setArrowWidth(18);
|
||||
arrowRectangle->setArrowHeight(10);
|
||||
m_popupWindow = arrowRectangle;
|
||||
m_popupWindow->setShadowBlurRadius(20);
|
||||
m_popupWindow->setRadius(18);
|
||||
m_popupWindow->setShadowYOffset(2);
|
||||
m_popupWindow->setShadowXOffset(0);
|
||||
m_popupWindow->setArrowWidth(18);
|
||||
m_popupWindow->setArrowHeight(10);
|
||||
m_popupWindow->setRadius(18);
|
||||
|
||||
m_scene->addItem(m_object);
|
||||
@ -364,6 +362,8 @@ bool AppDragWidget::isRemoveItem()
|
||||
|
||||
void AppDragWidget::enterEvent(QEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
if (m_goBackAnim->state() != QPropertyAnimation::State::Running
|
||||
&& m_animGroup->state() != QParallelAnimationGroup::Running) {
|
||||
hide();
|
||||
|
@ -36,7 +36,7 @@
|
||||
FloatingPreview::FloatingPreview(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_closeBtn3D(new DIconButton(this))
|
||||
, m_titleBtn(new DPushButton)
|
||||
, m_titleBtn(new DPushButton(this))
|
||||
{
|
||||
m_closeBtn3D->setObjectName("closebutton-3d");
|
||||
m_closeBtn3D->setFixedSize(24, 24);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QJsonObject>
|
||||
#include <QCursor>
|
||||
#include <QApplication>
|
||||
|
||||
#define PLUGIN_MARGIN 10
|
||||
#define ITEM_MAXSIZE 100
|
||||
@ -56,6 +57,7 @@ DockItem::DockItem(QWidget *parent)
|
||||
arrowRectangle->setArrowHeight(10);
|
||||
arrowRectangle->setObjectName("apppopup");
|
||||
PopupWindow = arrowRectangle;
|
||||
connect(qApp, &QApplication::aboutToQuit, PopupWindow, &DockPopupWindow::deleteLater);
|
||||
}
|
||||
|
||||
m_popupTipsDelayTimer->setInterval(500);
|
||||
|
@ -77,11 +77,11 @@ signals:
|
||||
void requestRefreshWindowVisible() const;
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void enterEvent(QEvent *e);
|
||||
void leaveEvent(QEvent *e);
|
||||
bool event(QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void mousePressEvent(QMouseEvent *e) override;
|
||||
void enterEvent(QEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
|
||||
const QRect perfectIconRect() const;
|
||||
const QPoint popupMarkPoint() ;
|
||||
|
@ -49,6 +49,15 @@ AbstractPluginsController::AbstractPluginsController(QObject *parent)
|
||||
connect(m_dockDaemonInter, &DockDaemonInter::PluginSettingsSynced, this, &AbstractPluginsController::refreshPluginSettings, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
AbstractPluginsController::~AbstractPluginsController()
|
||||
{
|
||||
for (auto inter: m_pluginsMap.keys()) {
|
||||
m_pluginsMap.remove(inter);
|
||||
delete m_pluginsMap.value(inter).value("pluginloader");
|
||||
delete inter;
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractPluginsController::saveValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value)
|
||||
{
|
||||
// is it necessary?
|
||||
@ -185,7 +194,7 @@ void AbstractPluginsController::positionChanged()
|
||||
|
||||
void AbstractPluginsController::loadPlugin(const QString &pluginFile)
|
||||
{
|
||||
QPluginLoader *pluginLoader = new QPluginLoader(pluginFile);
|
||||
QPluginLoader *pluginLoader = new QPluginLoader(pluginFile, this);
|
||||
const QJsonObject &meta = pluginLoader->metaData().value("MetaData").toObject();
|
||||
const QString &pluginApi = meta.value("api").toString();
|
||||
bool pluginIsValid = true;
|
||||
@ -199,6 +208,7 @@ void AbstractPluginsController::loadPlugin(const QString &pluginFile)
|
||||
}
|
||||
|
||||
PluginsItemInterface *interface = qobject_cast<PluginsItemInterface *>(pluginLoader->instance());
|
||||
|
||||
if (!interface) {
|
||||
qDebug() << objectName() << "load plugin failed!!!" << pluginLoader->errorString() << pluginFile;
|
||||
|
||||
|
@ -41,6 +41,7 @@ class AbstractPluginsController : public QObject, PluginProxyInterface
|
||||
|
||||
public:
|
||||
explicit AbstractPluginsController(QObject *parent = 0);
|
||||
~ AbstractPluginsController() override;
|
||||
|
||||
// implements PluginProxyInterface
|
||||
void saveValue(PluginsItemInterface *const itemInter, const QString &key, const QVariant &value) override;
|
||||
|
@ -42,12 +42,12 @@ const QString OnlyShowPrimary = "onlyShowPrimary";
|
||||
// Monitor数据->屏幕是否可停靠更新->监视唤醒区域更新,任务栏显示区域更新->拖拽区域更新->通知后端接口,通知窗管
|
||||
|
||||
MultiScreenWorker::MultiScreenWorker(QWidget *parent, DWindowManagerHelper *helper)
|
||||
: QObject(nullptr)
|
||||
: QObject(parent)
|
||||
, m_parent(parent)
|
||||
, m_wmHelper(helper)
|
||||
, m_eventInter(new XEventMonitor("com.deepin.api.XEventMonitor", "/com/deepin/api/XEventMonitor", QDBusConnection::sessionBus()))
|
||||
, m_extralEventInter(new XEventMonitor("com.deepin.api.XEventMonitor", "/com/deepin/api/XEventMonitor", QDBusConnection::sessionBus()))
|
||||
, m_touchEventInter(new XEventMonitor("com.deepin.api.XEventMonitor", "/com/deepin/api/XEventMonitor", QDBusConnection::sessionBus()))
|
||||
, m_eventInter(new XEventMonitor("com.deepin.api.XEventMonitor", "/com/deepin/api/XEventMonitor", QDBusConnection::sessionBus(), this))
|
||||
, m_extralEventInter(new XEventMonitor("com.deepin.api.XEventMonitor", "/com/deepin/api/XEventMonitor", QDBusConnection::sessionBus(), this))
|
||||
, m_touchEventInter(new XEventMonitor("com.deepin.api.XEventMonitor", "/com/deepin/api/XEventMonitor", QDBusConnection::sessionBus(), this))
|
||||
, m_dockInter(new DBusDock("com.deepin.dde.daemon.Dock", "/com/deepin/dde/daemon/Dock", QDBusConnection::sessionBus(), this))
|
||||
, m_launcherInter(new DBusLuncher("com.deepin.dde.Launcher", "/com/deepin/dde/Launcher", QDBusConnection::sessionBus(), this))
|
||||
, m_monitorUpdateTimer(new QTimer(this))
|
||||
|
@ -40,7 +40,6 @@ protected:
|
||||
|
||||
private:
|
||||
QString m_pluginDirPath;
|
||||
|
||||
};
|
||||
|
||||
#endif // PLUGINLOADER_H
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <QPixmapCache>
|
||||
#include <QCryptographicHash>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QDate>
|
||||
#include <QPainter>
|
||||
#include <QStandardPaths>
|
||||
|
@ -52,22 +52,23 @@ MainPanelControl::MainPanelControl(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_mainPanelLayout(new QBoxLayout(QBoxLayout::LeftToRight, this))
|
||||
, m_fixedAreaWidget(new QWidget(this))
|
||||
, m_fixedAreaLayout(new QBoxLayout(QBoxLayout::LeftToRight))
|
||||
, m_fixedAreaLayout(new QBoxLayout(QBoxLayout::LeftToRight, this))
|
||||
, m_fixedSpliter(new QLabel(this))
|
||||
, m_appAreaWidget(new QWidget(this))
|
||||
, m_appAreaSonWidget(new QWidget(this))
|
||||
, m_appAreaSonLayout(new QBoxLayout(QBoxLayout::LeftToRight))
|
||||
, m_appAreaSonLayout(new QBoxLayout(QBoxLayout::LeftToRight, this))
|
||||
, m_appSpliter(new QLabel(this))
|
||||
, m_trayAreaWidget(new QWidget(this))
|
||||
, m_trayAreaLayout(new QBoxLayout(QBoxLayout::LeftToRight))
|
||||
, m_trayAreaLayout(new QBoxLayout(QBoxLayout::LeftToRight, this))
|
||||
, m_traySpliter(new QLabel(this))
|
||||
, m_pluginAreaWidget(new QWidget(this))
|
||||
, m_pluginLayout(new QBoxLayout(QBoxLayout::LeftToRight))
|
||||
, m_pluginLayout(new QBoxLayout(QBoxLayout::LeftToRight, this))
|
||||
, m_desktopWidget(new DesktopWidget(this))
|
||||
, m_position(Position::Bottom)
|
||||
, m_placeholderItem(nullptr)
|
||||
, m_appDragWidget(nullptr)
|
||||
, m_dislayMode(Efficient)
|
||||
, m_tray(nullptr)
|
||||
, m_isHover(false)
|
||||
, m_needRecoveryWin(false)
|
||||
, m_trashItem(nullptr)
|
||||
|
@ -130,7 +130,7 @@ private:
|
||||
DisplayMode m_dislayMode;
|
||||
QPoint m_mousePressPos;
|
||||
int m_trayIconCount;
|
||||
TrayPluginItem *m_tray = nullptr;
|
||||
TrayPluginItem *m_tray;
|
||||
bool m_isHover; // 判断鼠标是否移到desktop区域
|
||||
bool m_needRecoveryWin; // 判断鼠标移出desktop区域是否恢复之前窗口
|
||||
int m_dragIndex = -1; // 记录应用区域被拖拽图标的位置
|
||||
|
@ -47,13 +47,13 @@ void BluetoothPlugin::init(PluginProxyInterface *proxyInter)
|
||||
if (m_bluetoothItem)
|
||||
return;
|
||||
|
||||
m_bluetoothItem = new BluetoothItem;
|
||||
m_bluetoothItem.reset(new BluetoothItem);
|
||||
|
||||
connect(m_bluetoothItem, &BluetoothItem::justHasAdapter, [&] {
|
||||
connect(m_bluetoothItem.data(), &BluetoothItem::justHasAdapter, [&] {
|
||||
m_enableState = true;
|
||||
refreshPluginItemsVisible();
|
||||
});
|
||||
connect(m_bluetoothItem, &BluetoothItem::noAdapter, [&] {
|
||||
connect(m_bluetoothItem.data(), &BluetoothItem::noAdapter, [&] {
|
||||
m_enableState = false;
|
||||
refreshPluginItemsVisible();
|
||||
});
|
||||
@ -79,7 +79,7 @@ bool BluetoothPlugin::pluginIsDisable()
|
||||
QWidget *BluetoothPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
if (itemKey == BLUETOOTH_KEY) {
|
||||
return m_bluetoothItem;
|
||||
return m_bluetoothItem.data();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "pluginsiteminterface.h"
|
||||
#include "bluetoothitem.h"
|
||||
|
||||
#include <QScopedPointer>
|
||||
|
||||
class BluetoothPlugin : public QObject, PluginsItemInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -55,7 +57,7 @@ private:
|
||||
void refreshPluginItemsVisible();
|
||||
|
||||
private:
|
||||
BluetoothItem *m_bluetoothItem;
|
||||
QScopedPointer<BluetoothItem> m_bluetoothItem;
|
||||
bool m_enableState = true;
|
||||
};
|
||||
|
||||
|
@ -65,6 +65,8 @@ BluetoothDeviceItem::BluetoothDeviceItem(QStyle *style, const Device *device, DL
|
||||
: m_style(style)
|
||||
, m_device(device)
|
||||
, m_standarditem(new DStandardItem())
|
||||
, m_labelAction(nullptr)
|
||||
, m_stateAction(nullptr)
|
||||
, m_loading(new DSpinner(parent))
|
||||
{
|
||||
initActionList();
|
||||
@ -77,6 +79,14 @@ BluetoothDeviceItem::~BluetoothDeviceItem()
|
||||
delete m_loading;
|
||||
m_loading = nullptr;
|
||||
}
|
||||
|
||||
delete m_standarditem;
|
||||
|
||||
if (m_labelAction)
|
||||
delete m_labelAction;
|
||||
|
||||
if (m_stateAction)
|
||||
delete m_stateAction;
|
||||
}
|
||||
|
||||
void BluetoothDeviceItem::initActionList()
|
||||
@ -150,6 +160,7 @@ BluetoothAdapterItem::BluetoothAdapterItem(Adapter *adapter, QWidget *parent)
|
||||
, m_adapterLabel(new SettingLabel(adapter->name(), this))
|
||||
, m_adapterStateBtn(new DSwitchButton(this))
|
||||
, m_deviceListview(new DListView(this))
|
||||
, m_itemDelegate(new ItemDelegate(m_deviceListview))
|
||||
, m_deviceModel(new QStandardItemModel(m_deviceListview))
|
||||
, m_refreshBtn(new RefreshButton(this))
|
||||
, m_bluetoothInter(new DBusBluetooth("com.deepin.daemon.Bluetooth",
|
||||
@ -158,7 +169,6 @@ BluetoothAdapterItem::BluetoothAdapterItem(Adapter *adapter, QWidget *parent)
|
||||
this))
|
||||
, m_showUnnamedDevices(false)
|
||||
, m_seperator(new HorizontalSeperator(this))
|
||||
, m_itemDelegate(new ItemDelegate(m_deviceListview))
|
||||
, m_bottomSeperator(new HorizontalSeperator(this))
|
||||
{
|
||||
initData();
|
||||
|
@ -88,11 +88,11 @@ private:
|
||||
DStyleHelper m_style;
|
||||
QString m_deviceIcon;
|
||||
|
||||
const Device *m_device = nullptr;
|
||||
DStandardItem *m_standarditem = nullptr;
|
||||
DViewItemAction *m_labelAction = nullptr;
|
||||
DViewItemAction *m_stateAction = nullptr;
|
||||
DSpinner *m_loading = nullptr;
|
||||
const Device *m_device;
|
||||
DStandardItem *m_standarditem;
|
||||
DViewItemAction *m_labelAction;
|
||||
DViewItemAction *m_stateAction;
|
||||
DSpinner *m_loading;
|
||||
};
|
||||
|
||||
class BluetoothAdapterItem : public QWidget
|
||||
@ -135,13 +135,13 @@ private:
|
||||
void initConnect();
|
||||
void setUnnamedDevicesVisible(bool isShow);
|
||||
|
||||
Adapter *m_adapter = nullptr;
|
||||
SettingLabel *m_adapterLabel = nullptr;
|
||||
DSwitchButton *m_adapterStateBtn = nullptr;
|
||||
DListView *m_deviceListview = nullptr;
|
||||
Adapter *m_adapter;
|
||||
SettingLabel *m_adapterLabel;
|
||||
DSwitchButton *m_adapterStateBtn;
|
||||
DListView *m_deviceListview;
|
||||
ItemDelegate *m_itemDelegate;
|
||||
QStandardItemModel *m_deviceModel = nullptr;
|
||||
RefreshButton *m_refreshBtn = nullptr;
|
||||
QStandardItemModel *m_deviceModel;
|
||||
RefreshButton *m_refreshBtn;
|
||||
DBusBluetooth *m_bluetoothInter;
|
||||
bool m_showUnnamedDevices;
|
||||
|
||||
|
@ -101,6 +101,7 @@ void SettingLabel::paintEvent(QPaintEvent *event)
|
||||
|
||||
BluetoothApplet::BluetoothApplet(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_scroarea(nullptr)
|
||||
, m_contentWidget(new QWidget(this))
|
||||
, m_adaptersManager(new AdaptersManager(this))
|
||||
, m_settingLabel(new SettingLabel(tr("Bluetooth settings"), this))
|
||||
|
@ -63,8 +63,8 @@ private:
|
||||
void updateIconTheme();
|
||||
|
||||
private:
|
||||
DLabel *m_label = nullptr;
|
||||
QHBoxLayout *m_layout = nullptr;
|
||||
DLabel *m_label;
|
||||
QHBoxLayout *m_layout;
|
||||
};
|
||||
|
||||
class BluetoothApplet : public QWidget
|
||||
@ -106,12 +106,12 @@ private:
|
||||
void updateIconTheme();
|
||||
|
||||
private:
|
||||
QScrollArea *m_scroarea = nullptr;
|
||||
QWidget *m_contentWidget = nullptr;
|
||||
AdaptersManager *m_adaptersManager = nullptr;
|
||||
SettingLabel *m_settingLabel = nullptr;
|
||||
QVBoxLayout *m_mainLayout = nullptr;
|
||||
QVBoxLayout *m_contentLayout = nullptr;
|
||||
QScrollArea *m_scroarea;
|
||||
QWidget *m_contentWidget;
|
||||
AdaptersManager *m_adaptersManager;
|
||||
SettingLabel *m_settingLabel;
|
||||
QVBoxLayout *m_mainLayout;
|
||||
QVBoxLayout *m_contentLayout;
|
||||
|
||||
QStringList m_connectDeviceName;
|
||||
QMap<QString, BluetoothAdapterItem *> m_adapterItems; // 所有蓝牙适配器
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "../../frame/util/utils.h"
|
||||
|
||||
#include <DDBusSender>
|
||||
#include <QLabel>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDBusConnectionInterface>
|
||||
|
||||
@ -35,6 +35,9 @@
|
||||
using namespace Dock;
|
||||
DatetimePlugin::DatetimePlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_centralWidget(nullptr)
|
||||
, m_dateTipsLabel(nullptr)
|
||||
, m_refershTimer(nullptr)
|
||||
, m_interface(nullptr)
|
||||
, m_pluginLoaded(false)
|
||||
{
|
||||
@ -83,16 +86,16 @@ void DatetimePlugin::loadPlugin()
|
||||
return;
|
||||
|
||||
m_pluginLoaded = true;
|
||||
m_dateTipsLabel = new TipsWidget;
|
||||
m_dateTipsLabel.reset(new TipsWidget);
|
||||
m_refershTimer = new QTimer(this);
|
||||
m_dateTipsLabel->setObjectName("datetime");
|
||||
|
||||
m_refershTimer->setInterval(1000);
|
||||
m_refershTimer->start();
|
||||
|
||||
m_centralWidget = new DatetimeWidget;
|
||||
m_centralWidget.reset(new DatetimeWidget);
|
||||
|
||||
connect(m_centralWidget, &DatetimeWidget::requestUpdateGeometry, [this] { m_proxyInter->itemUpdate(this, pluginName()); });
|
||||
connect(m_centralWidget.data(), &DatetimeWidget::requestUpdateGeometry, [this] { m_proxyInter->itemUpdate(this, pluginName()); });
|
||||
connect(m_refershTimer, &QTimer::timeout, this, &DatetimePlugin::updateCurrentTimeString);
|
||||
|
||||
m_proxyInter->itemAdded(this, pluginName());
|
||||
@ -132,14 +135,14 @@ QWidget *DatetimePlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_centralWidget;
|
||||
return m_centralWidget.data();
|
||||
}
|
||||
|
||||
QWidget *DatetimePlugin::itemTipsWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_dateTipsLabel;
|
||||
return m_dateTipsLabel.data();
|
||||
}
|
||||
|
||||
const QString DatetimePlugin::itemCommand(const QString &itemKey)
|
||||
@ -188,12 +191,12 @@ void DatetimePlugin::invokedMenuItem(const QString &itemKey, const QString &menu
|
||||
|
||||
if (menuId == "open") {
|
||||
DDBusSender()
|
||||
.service("com.deepin.dde.ControlCenter")
|
||||
.interface("com.deepin.dde.ControlCenter")
|
||||
.path("/com/deepin/dde/ControlCenter")
|
||||
.method(QString("ShowModule"))
|
||||
.arg(QString("datetime"))
|
||||
.call();
|
||||
.service("com.deepin.dde.ControlCenter")
|
||||
.interface("com.deepin.dde.ControlCenter")
|
||||
.path("/com/deepin/dde/ControlCenter")
|
||||
.method(QString("ShowModule"))
|
||||
.arg(QString("datetime"))
|
||||
.call();
|
||||
} else {
|
||||
const bool value = timedateInterface()->property(TIME_FORMAT_KEY).toBool();
|
||||
timedateInterface()->setProperty(TIME_FORMAT_KEY, !value);
|
||||
@ -255,11 +258,11 @@ QDBusInterface* DatetimePlugin::timedateInterface()
|
||||
{
|
||||
if (!m_interface) {
|
||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("com.deepin.daemon.Timedate")) {
|
||||
m_interface = new QDBusInterface("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", "com.deepin.daemon.Timedate");
|
||||
m_interface = new QDBusInterface("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", "com.deepin.daemon.Timedate", QDBusConnection::sessionBus(), this);
|
||||
} else {
|
||||
const QString path = QString("/com/deepin/daemon/Accounts/User%1").arg(QString::number(getuid()));
|
||||
QDBusInterface * systemInterface = new QDBusInterface("com.deepin.daemon.Accounts", path, "com.deepin.daemon.Accounts.User",
|
||||
QDBusConnection::systemBus(), this);
|
||||
QDBusConnection::systemBus(), this);
|
||||
return systemInterface;
|
||||
}
|
||||
}
|
||||
|
@ -75,8 +75,8 @@ private:
|
||||
QDBusInterface *timedateInterface();
|
||||
|
||||
private:
|
||||
QPointer<DatetimeWidget> m_centralWidget;
|
||||
QPointer<Dock::TipsWidget> m_dateTipsLabel;
|
||||
QScopedPointer<DatetimeWidget> m_centralWidget;
|
||||
QScopedPointer<Dock::TipsWidget> m_dateTipsLabel;
|
||||
QTimer *m_refershTimer;
|
||||
QString m_currentTimeString;
|
||||
QDBusInterface *m_interface;
|
||||
|
@ -34,6 +34,7 @@ using namespace Dock;
|
||||
MultitaskingPlugin::MultitaskingPlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_pluginLoaded(false)
|
||||
, m_multitaskingWidget(nullptr)
|
||||
, m_tipsLabel(new TipsWidget)
|
||||
{
|
||||
m_tipsLabel->setVisible(false);
|
||||
@ -65,7 +66,7 @@ QWidget *MultitaskingPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_multitaskingWidget;
|
||||
return m_multitaskingWidget.data();
|
||||
}
|
||||
|
||||
QWidget *MultitaskingPlugin::itemTipsWidget(const QString &itemKey)
|
||||
@ -74,7 +75,7 @@ QWidget *MultitaskingPlugin::itemTipsWidget(const QString &itemKey)
|
||||
|
||||
m_tipsLabel->setText(pluginDisplayName());
|
||||
|
||||
return m_tipsLabel;
|
||||
return m_tipsLabel.data();
|
||||
}
|
||||
|
||||
void MultitaskingPlugin::init(PluginProxyInterface *proxyInter)
|
||||
@ -201,7 +202,7 @@ void MultitaskingPlugin::loadPlugin()
|
||||
|
||||
m_pluginLoaded = true;
|
||||
|
||||
m_multitaskingWidget = new MultitaskingWidget;
|
||||
m_multitaskingWidget.reset(new MultitaskingWidget);
|
||||
|
||||
m_proxyInter->itemAdded(this, pluginName());
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "pluginsiteminterface.h"
|
||||
#include "multitaskingwidget.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Dock {
|
||||
class TipsWidget;
|
||||
@ -64,8 +64,8 @@ private:
|
||||
private:
|
||||
bool m_pluginLoaded;
|
||||
|
||||
MultitaskingWidget *m_multitaskingWidget;
|
||||
Dock::TipsWidget *m_tipsLabel;
|
||||
QScopedPointer<MultitaskingWidget> m_multitaskingWidget;
|
||||
QScopedPointer<Dock::TipsWidget> m_tipsLabel;
|
||||
};
|
||||
|
||||
#endif // MULTITASKINGPLUGIN_H
|
||||
|
@ -45,12 +45,12 @@ extern const QString DarkType;
|
||||
extern const QString LightType;
|
||||
extern void initFontColor(QWidget *widget);
|
||||
|
||||
AccessPointWidget::AccessPointWidget()
|
||||
: QFrame(nullptr)
|
||||
AccessPointWidget::AccessPointWidget(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
, m_activeState(NetworkDevice::Unknown)
|
||||
, m_ssidBtn(new SsidButton(this))
|
||||
, m_securityLabel(new QLabel)
|
||||
, m_strengthLabel(new QLabel)
|
||||
, m_securityLabel(new QLabel(this))
|
||||
, m_strengthLabel(new QLabel(this))
|
||||
, m_stateButton(new StateButton(this))
|
||||
, m_isEnter(false)
|
||||
{
|
||||
|
@ -35,7 +35,8 @@ class SsidButton : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SsidButton(QWidget *parent = nullptr) : QLabel(parent) {}
|
||||
explicit SsidButton(QWidget *parent = nullptr)
|
||||
: QLabel(parent) {}
|
||||
virtual ~SsidButton() override {}
|
||||
|
||||
signals:
|
||||
@ -56,7 +57,7 @@ class AccessPointWidget : public QFrame
|
||||
Q_PROPERTY(bool active READ active DESIGNABLE true)
|
||||
|
||||
public:
|
||||
explicit AccessPointWidget();
|
||||
explicit AccessPointWidget(QWidget *parent = nullptr);
|
||||
|
||||
const AccessPoint ap() const { return m_ap; }
|
||||
void updateAP(const AccessPoint &ap);
|
||||
@ -70,8 +71,8 @@ signals:
|
||||
void clicked() const;
|
||||
|
||||
private:
|
||||
void enterEvent(QEvent *e);
|
||||
void leaveEvent(QEvent *e);
|
||||
void enterEvent(QEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
void setStrengthIcon(const int strength);
|
||||
|
||||
protected:
|
||||
|
@ -40,16 +40,15 @@ extern void initFontColor(QWidget *widget);
|
||||
|
||||
DeviceControlWidget::DeviceControlWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_deviceName(new QLabel(this))
|
||||
, m_switchBtn(new DSwitchButton(this))
|
||||
, m_loadingIndicator(new DLoadingIndicator(this))
|
||||
{
|
||||
m_deviceName = new QLabel(this);
|
||||
m_deviceName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
initFontColor(m_deviceName);
|
||||
|
||||
m_switchBtn = new DSwitchButton;
|
||||
|
||||
const QPixmap pixmap = DHiDPIHelper::loadNxPixmap(":/wireless/resources/wireless/refresh.svg");
|
||||
|
||||
m_loadingIndicator = new DLoadingIndicator;
|
||||
m_loadingIndicator->setLoading(false);
|
||||
m_loadingIndicator->setSmooth(true);
|
||||
m_loadingIndicator->setAniDuration(1000);
|
||||
|
@ -48,8 +48,8 @@ WirelessList::WirelessList(WirelessDevice *deviceIter, QWidget *parent)
|
||||
, m_activeAP()
|
||||
, m_updateAPTimer(new QTimer(this))
|
||||
, m_centralLayout(new QVBoxLayout)
|
||||
, m_centralWidget(new QWidget)
|
||||
, m_controlPanel(new DeviceControlWidget)
|
||||
, m_centralWidget(new QWidget(this))
|
||||
, m_controlPanel(new DeviceControlWidget(this))
|
||||
{
|
||||
setFixedHeight(ItemHeight);
|
||||
|
||||
@ -227,7 +227,7 @@ void WirelessList::updateAPList()
|
||||
if (m_apList.size() > m_apwList.size()) {
|
||||
int i = m_apList.size() - m_apwList.size();
|
||||
for (int index = 0; index != i; index++) {
|
||||
AccessPointWidget *apw = new AccessPointWidget;
|
||||
AccessPointWidget *apw = new AccessPointWidget(this);
|
||||
apw->setFixedHeight(ItemHeight);
|
||||
m_apwList << apw;
|
||||
m_centralLayout->addWidget(apw);
|
||||
|
@ -87,7 +87,6 @@ private:
|
||||
StateButton *m_stateButton;
|
||||
DSpinner *m_loadingStat;
|
||||
|
||||
HorizontalSeperator *m_line;
|
||||
QTimer *m_freshWiredIcon;
|
||||
NetworkDevice::DeviceStatus m_deviceState;
|
||||
};
|
||||
|
@ -43,7 +43,7 @@ WirelessItem::WirelessItem(WirelessDevice *device)
|
||||
, m_refreshLimit(0)
|
||||
, m_refreshLimitTimer(new QTimer(this))
|
||||
, m_refreshTimer(new QTimer(this))
|
||||
, m_wirelessApplet(new QWidget)
|
||||
, m_wirelessApplet(new QWidget(this))
|
||||
, m_APList(nullptr)
|
||||
{
|
||||
m_refreshTimer->setSingleShot(true);
|
||||
@ -101,8 +101,12 @@ WirelessItem::WirelessItem(WirelessDevice *device)
|
||||
|
||||
WirelessItem::~WirelessItem()
|
||||
{
|
||||
m_APList->deleteLater();
|
||||
m_APList->controlPanel()->deleteLater();
|
||||
if (m_APList) {
|
||||
m_APList->deleteLater();
|
||||
|
||||
if (m_APList->controlPanel())
|
||||
m_APList->controlPanel()->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
QWidget *WirelessItem::itemApplet()
|
||||
@ -232,6 +236,6 @@ void WirelessItem::adjustHeight(bool visibel)
|
||||
return;
|
||||
|
||||
auto height = visibel ? (m_APList->height() + controlPanel->height())
|
||||
: m_APList->height();
|
||||
: m_APList->height();
|
||||
m_wirelessApplet->setFixedHeight(height);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ Q_SIGNALS:
|
||||
void deviceStateChanged();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *o, QEvent *e);
|
||||
bool eventFilter(QObject *o, QEvent *e) override;
|
||||
|
||||
private slots:
|
||||
void init();
|
||||
|
@ -47,7 +47,7 @@ NetworkItem::NetworkItem(QWidget *parent)
|
||||
, m_applet(new QScrollArea(this))
|
||||
, m_switchWire(true)
|
||||
, m_timeOut(true)
|
||||
, m_timer(new QTimer(this))
|
||||
, refreshIconTimer(new QTimer(this))
|
||||
, m_switchWireTimer(new QTimer(this))
|
||||
, m_wirelessScanTimer(new QTimer(this))
|
||||
, m_wirelessScanInterval(Utils::SettingValue("com.deepin.dde.dock", QByteArray(), "wireless-scan-interval", 10).toInt())
|
||||
@ -55,7 +55,7 @@ NetworkItem::NetworkItem(QWidget *parent)
|
||||
, m_secondSeparator(new HorizontalSeperator(this))
|
||||
, m_thirdSeparator(new HorizontalSeperator(this))
|
||||
{
|
||||
m_timer->setInterval(100);
|
||||
refreshIconTimer->setInterval(100);
|
||||
|
||||
m_tipsWidget->setVisible(false);
|
||||
|
||||
@ -72,7 +72,7 @@ NetworkItem::NetworkItem(QWidget *parent)
|
||||
|
||||
const QPixmap pixmap = DHiDPIHelper::loadNxPixmap(":/wireless/resources/wireless/refresh.svg");
|
||||
|
||||
m_loadingIndicator = new DLoadingIndicator;
|
||||
m_loadingIndicator = new DLoadingIndicator(this);
|
||||
m_loadingIndicator->setLoading(false);
|
||||
m_loadingIndicator->setSmooth(true);
|
||||
m_loadingIndicator->setAniDuration(1000);
|
||||
@ -86,7 +86,7 @@ NetworkItem::NetworkItem(QWidget *parent)
|
||||
m_wirelessLayout = new QVBoxLayout;
|
||||
m_wirelessLayout->setMargin(0);
|
||||
m_wirelessLayout->setSpacing(0);
|
||||
auto switchWirelessLayout = new QHBoxLayout;
|
||||
QHBoxLayout *switchWirelessLayout = new QHBoxLayout;
|
||||
switchWirelessLayout->setMargin(0);
|
||||
switchWirelessLayout->setSpacing(0);
|
||||
switchWirelessLayout->addSpacing(20);
|
||||
@ -101,28 +101,28 @@ NetworkItem::NetworkItem(QWidget *parent)
|
||||
|
||||
m_wiredControlPanel = new QWidget(this);
|
||||
|
||||
m_wiredTitle = new QLabel(m_wiredControlPanel);
|
||||
m_wiredTitle->setText(tr("Wired Network"));
|
||||
m_wiredTitle->setFont(titlefont);
|
||||
initFontColor(m_wiredTitle);
|
||||
QLabel *wiredTitle = new QLabel(m_wiredControlPanel);
|
||||
wiredTitle->setText(tr("Wired Network"));
|
||||
wiredTitle->setFont(titlefont);
|
||||
initFontColor(wiredTitle);
|
||||
m_switchWiredBtn = new DSwitchButton(m_wiredControlPanel);
|
||||
m_switchWiredBtnState = false;
|
||||
m_wiredLayout = new QVBoxLayout;
|
||||
m_wiredLayout->setMargin(0);
|
||||
m_wiredLayout->setSpacing(0);
|
||||
auto switchWiredLayout = new QHBoxLayout;
|
||||
QHBoxLayout *switchWiredLayout = new QHBoxLayout;
|
||||
switchWiredLayout->setMargin(0);
|
||||
switchWiredLayout->setSpacing(0);
|
||||
switchWiredLayout->addSpacing(20);
|
||||
switchWiredLayout->addWidget(m_wiredTitle);
|
||||
switchWiredLayout->addWidget(wiredTitle);
|
||||
switchWiredLayout->addStretch();
|
||||
switchWiredLayout->addWidget(m_switchWiredBtn);
|
||||
switchWiredLayout->addSpacing(8);
|
||||
m_wiredControlPanel->setLayout(switchWiredLayout);
|
||||
m_wiredControlPanel->setFixedHeight(ControlItemHeight);
|
||||
|
||||
auto centralWidget = new QWidget(m_applet);
|
||||
auto centralLayout = new QVBoxLayout;
|
||||
QWidget *centralWidget = new QWidget;
|
||||
QVBoxLayout *centralLayout = new QVBoxLayout;
|
||||
centralLayout->setContentsMargins(QMargins(ItemMargin, 0, ItemMargin, 0));
|
||||
centralLayout->setSpacing(0);
|
||||
centralLayout->setMargin(0);
|
||||
@ -152,7 +152,7 @@ NetworkItem::NetworkItem(QWidget *parent)
|
||||
m_switchWire = !m_switchWire;
|
||||
m_timeOut = true;
|
||||
});
|
||||
connect(m_timer, &QTimer::timeout, this, &NetworkItem::refreshIcon);
|
||||
connect(refreshIconTimer, &QTimer::timeout, this, &NetworkItem::refreshIcon);
|
||||
connect(m_switchWiredBtn, &DSwitchButton::toggled, this, &NetworkItem::wiredsEnable);
|
||||
connect(m_switchWirelessBtn, &DSwitchButton::toggled, this, &NetworkItem::wirelessEnable);
|
||||
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &NetworkItem::onThemeTypeChanged);
|
||||
@ -381,7 +381,7 @@ void NetworkItem::refreshIcon()
|
||||
iconString = QString("network-%1-symbolic").arg(stateString);
|
||||
break;
|
||||
case Connecting: {
|
||||
m_timer->start();
|
||||
refreshIconTimer->start();
|
||||
if (m_switchWire) {
|
||||
strength = QTime::currentTime().msec() / 10 % 100;
|
||||
stateString = getStrengthStateString(strength);
|
||||
@ -393,7 +393,7 @@ void NetworkItem::refreshIcon()
|
||||
update();
|
||||
return;
|
||||
} else {
|
||||
m_timer->start(200);
|
||||
refreshIconTimer->start(200);
|
||||
const int index = QTime::currentTime().msec() / 200 % 10;
|
||||
const int num = index + 1;
|
||||
iconString = QString("network-wired-symbolic-connecting%1").arg(num);
|
||||
@ -406,7 +406,7 @@ void NetworkItem::refreshIcon()
|
||||
}
|
||||
}
|
||||
case Aconnecting: {
|
||||
m_timer->start();
|
||||
refreshIconTimer->start();
|
||||
strength = QTime::currentTime().msec() / 10 % 100;
|
||||
stateString = getStrengthStateString(strength);
|
||||
iconString = QString("wireless-%1-symbolic").arg(stateString);
|
||||
@ -418,7 +418,7 @@ void NetworkItem::refreshIcon()
|
||||
return;
|
||||
}
|
||||
case Bconnecting: {
|
||||
m_timer->start(200);
|
||||
refreshIconTimer->start(200);
|
||||
const int index = QTime::currentTime().msec() / 200 % 10;
|
||||
const int num = index + 1;
|
||||
iconString = QString("network-wired-symbolic-connecting%1").arg(num);
|
||||
@ -453,7 +453,7 @@ void NetworkItem::refreshIcon()
|
||||
iconString = QString("wireless-%1").arg(stateString);
|
||||
}
|
||||
|
||||
m_timer->stop();
|
||||
refreshIconTimer->stop();
|
||||
|
||||
if (height() <= PLUGIN_BACKGROUND_MIN_SIZE && DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType)
|
||||
iconString.append(PLUGIN_MIN_ICON_NAME);
|
||||
|
@ -91,7 +91,6 @@ private:
|
||||
Dock::TipsWidget *m_tipsWidget;
|
||||
QScrollArea *m_applet;
|
||||
|
||||
QLabel *m_wiredTitle;
|
||||
DSwitchButton *m_switchWiredBtn;
|
||||
QVBoxLayout *m_wiredLayout;
|
||||
QWidget *m_wiredControlPanel;
|
||||
@ -115,7 +114,7 @@ private:
|
||||
|
||||
QPixmap m_iconPixmap;
|
||||
PluginState m_pluginState;
|
||||
QTimer *m_timer;
|
||||
QTimer *refreshIconTimer;
|
||||
QTimer *m_switchWireTimer;
|
||||
QTimer *m_wirelessScanTimer;
|
||||
int m_wirelessScanInterval;
|
||||
|
@ -56,7 +56,7 @@ void NetworkPlugin::init(PluginProxyInterface *proxyInter)
|
||||
if (m_networkItem)
|
||||
return;
|
||||
|
||||
m_networkItem = new NetworkItem;
|
||||
m_networkItem.reset(new NetworkItem);
|
||||
|
||||
if (!pluginIsDisable()) {
|
||||
loadPlugin();
|
||||
@ -113,7 +113,7 @@ const QString NetworkPlugin::itemContextMenu(const QString &itemKey)
|
||||
QWidget *NetworkPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
if (itemKey == NETWORK_KEY) {
|
||||
return m_networkItem;
|
||||
return m_networkItem.data();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@ -195,11 +195,11 @@ void NetworkPlugin::onDeviceListChanged(const QList<NetworkDevice *> devices)
|
||||
wiredItems.insert(path, static_cast<WiredItem *>(item));
|
||||
|
||||
connect(static_cast<WiredItem *>(item), &WiredItem::wiredStateChanged,
|
||||
m_networkItem, &NetworkItem::updateSelf);
|
||||
m_networkItem.data(), &NetworkItem::updateSelf);
|
||||
connect(static_cast<WiredItem *>(item), &WiredItem::enableChanged,
|
||||
m_networkItem, &NetworkItem::updateSelf);
|
||||
m_networkItem.data(), &NetworkItem::updateSelf);
|
||||
connect(static_cast<WiredItem *>(item), &WiredItem::activeConnectionChanged,
|
||||
m_networkItem, &NetworkItem::updateSelf);
|
||||
m_networkItem.data(), &NetworkItem::updateSelf);
|
||||
break;
|
||||
case NetworkDevice::Wireless:
|
||||
item = new WirelessItem(static_cast<WirelessDevice *>(device));
|
||||
@ -207,26 +207,26 @@ void NetworkPlugin::onDeviceListChanged(const QList<NetworkDevice *> devices)
|
||||
wirelessItems.insert(path, static_cast<WirelessItem *>(item));
|
||||
|
||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::queryActiveConnInfo,
|
||||
m_networkWorker, &NetworkWorker::queryActiveConnInfo);
|
||||
m_networkWorker.data(), &NetworkWorker::queryActiveConnInfo);
|
||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::requestActiveAP,
|
||||
m_networkWorker, &NetworkWorker::activateAccessPoint);
|
||||
m_networkWorker.data(), &NetworkWorker::activateAccessPoint);
|
||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::requestDeactiveAP,
|
||||
m_networkWorker, &NetworkWorker::disconnectDevice);
|
||||
m_networkWorker.data(), &NetworkWorker::disconnectDevice);
|
||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::feedSecret,
|
||||
m_networkWorker, &NetworkWorker::feedSecret);
|
||||
m_networkWorker.data(), &NetworkWorker::feedSecret);
|
||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::cancelSecret,
|
||||
m_networkWorker, &NetworkWorker::cancelSecret);
|
||||
m_networkWorker.data(), &NetworkWorker::cancelSecret);
|
||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::requestWirelessScan,
|
||||
m_networkWorker, &NetworkWorker::requestWirelessScan);
|
||||
m_networkWorker.data(), &NetworkWorker::requestWirelessScan);
|
||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::createApConfig,
|
||||
m_networkWorker, &NetworkWorker::createApConfig);
|
||||
m_networkWorker.data(), &NetworkWorker::createApConfig);
|
||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::queryConnectionSession,
|
||||
m_networkWorker, &NetworkWorker::queryConnectionSession);
|
||||
m_networkWorker.data(), &NetworkWorker::queryConnectionSession);
|
||||
|
||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::deviceStateChanged,
|
||||
m_networkItem, &NetworkItem::updateSelf);
|
||||
m_networkItem.data(), &NetworkItem::updateSelf);
|
||||
connect(static_cast<WirelessItem *>(item), &WirelessItem::requestWirelessScan,
|
||||
m_networkItem, &NetworkItem::wirelessScan);
|
||||
m_networkItem.data(), &NetworkItem::wirelessScan);
|
||||
|
||||
m_networkWorker->requestWirelessScan();
|
||||
break;
|
||||
@ -234,9 +234,9 @@ void NetworkPlugin::onDeviceListChanged(const QList<NetworkDevice *> devices)
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
|
||||
connect(item, &DeviceItem::requestSetDeviceEnable, m_networkWorker, &NetworkWorker::setDeviceEnable);
|
||||
connect(m_networkModel, &NetworkModel::connectivityChanged, item, &DeviceItem::refreshConnectivity);
|
||||
connect(m_networkModel, &NetworkModel::connectivityChanged, m_networkItem, &NetworkItem::updateSelf);
|
||||
connect(item, &DeviceItem::requestSetDeviceEnable, m_networkWorker.data(), &NetworkWorker::setDeviceEnable);
|
||||
connect(m_networkModel.data(), &NetworkModel::connectivityChanged, item, &DeviceItem::refreshConnectivity);
|
||||
connect(m_networkModel.data(), &NetworkModel::connectivityChanged, m_networkItem.data(), &NetworkItem::updateSelf);
|
||||
}
|
||||
|
||||
m_hasDevice = wiredItems.size() || wirelessItems.size();
|
||||
@ -245,10 +245,10 @@ void NetworkPlugin::onDeviceListChanged(const QList<NetworkDevice *> devices)
|
||||
|
||||
void NetworkPlugin::loadPlugin()
|
||||
{
|
||||
m_networkModel = new NetworkModel;
|
||||
m_networkWorker = new NetworkWorker(m_networkModel);
|
||||
m_networkModel.reset(new NetworkModel);
|
||||
m_networkWorker.reset(new NetworkWorker(m_networkModel.data()));
|
||||
|
||||
connect(m_networkModel, &NetworkModel::deviceListChanged, this, &NetworkPlugin::onDeviceListChanged);
|
||||
connect(m_networkModel.data(), &NetworkModel::deviceListChanged, this, &NetworkPlugin::onDeviceListChanged);
|
||||
|
||||
m_networkModel->moveToThread(qApp->thread());
|
||||
m_networkWorker->moveToThread(qApp->thread());
|
||||
|
@ -69,10 +69,10 @@ private:
|
||||
void refreshPluginItemsVisible();
|
||||
|
||||
private:
|
||||
dde::network::NetworkModel *m_networkModel;
|
||||
dde::network::NetworkWorker *m_networkWorker;
|
||||
QScopedPointer<dde::network::NetworkModel> m_networkModel;
|
||||
QScopedPointer<dde::network::NetworkWorker> m_networkWorker;
|
||||
|
||||
NetworkItem *m_networkItem;
|
||||
QScopedPointer<NetworkItem> m_networkItem;
|
||||
|
||||
bool m_hasDevice;
|
||||
};
|
||||
|
@ -29,11 +29,11 @@
|
||||
|
||||
using namespace Dock;
|
||||
OnboardPlugin::OnboardPlugin(QObject *parent)
|
||||
: QObject(parent),
|
||||
|
||||
m_pluginLoaded(false),
|
||||
m_startupState(false),
|
||||
m_tipsLabel(new TipsWidget)
|
||||
: QObject(parent)
|
||||
, m_pluginLoaded(false)
|
||||
, m_startupState(false)
|
||||
, m_onboardItem(nullptr)
|
||||
, m_tipsLabel(new TipsWidget)
|
||||
{
|
||||
m_tipsLabel->setText(tr("Onboard"));
|
||||
m_tipsLabel->setVisible(false);
|
||||
@ -54,14 +54,14 @@ QWidget *OnboardPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_onboardItem;
|
||||
return m_onboardItem.data();
|
||||
}
|
||||
|
||||
QWidget *OnboardPlugin::itemTipsWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_tipsLabel;
|
||||
return m_tipsLabel.data();
|
||||
}
|
||||
|
||||
void OnboardPlugin::init(PluginProxyInterface *proxyInter)
|
||||
@ -184,7 +184,7 @@ void OnboardPlugin::loadPlugin()
|
||||
|
||||
m_pluginLoaded = true;
|
||||
|
||||
m_onboardItem = new OnboardItem;
|
||||
m_onboardItem.reset(new OnboardItem);
|
||||
|
||||
m_proxyInter->itemAdded(this, pluginName());
|
||||
displayModeChanged(displayMode());
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "onboarditem.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QScopedPointer>
|
||||
|
||||
#include <com_deepin_dde_daemon_dock.h>
|
||||
#include <com_deepin_dde_daemon_dock_entry.h>
|
||||
|
||||
@ -71,8 +73,8 @@ private:
|
||||
bool m_pluginLoaded;
|
||||
bool m_startupState;
|
||||
|
||||
OnboardItem *m_onboardItem;
|
||||
Dock::TipsWidget *m_tipsLabel;
|
||||
QScopedPointer<OnboardItem> m_onboardItem;
|
||||
QScopedPointer<Dock::TipsWidget> m_tipsLabel;
|
||||
};
|
||||
|
||||
#endif // ONBOARDPLUGIN_H
|
||||
|
@ -40,6 +40,7 @@ int WaitingAuthAgentTimes = 0;
|
||||
OverlayWarningPlugin::OverlayWarningPlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_pluginLoaded(false)
|
||||
, m_warningWidget(nullptr)
|
||||
, m_showDisableOverlayDialogTimer(new QTimer(this))
|
||||
{
|
||||
m_showDisableOverlayDialogTimer->setInterval(6000);
|
||||
@ -61,7 +62,7 @@ QWidget *OverlayWarningPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_warningWidget;
|
||||
return m_warningWidget.data();
|
||||
}
|
||||
|
||||
QWidget *OverlayWarningPlugin::itemTipsWidget(const QString &itemKey)
|
||||
@ -140,7 +141,7 @@ void OverlayWarningPlugin::loadPlugin()
|
||||
|
||||
m_pluginLoaded = true;
|
||||
|
||||
m_warningWidget = new OverlayWarningWidget;
|
||||
m_warningWidget.reset(new OverlayWarningWidget);
|
||||
|
||||
if (!isOverlayRoot()) {
|
||||
return;
|
||||
|
@ -71,7 +71,7 @@ private slots:
|
||||
private:
|
||||
bool m_pluginLoaded;
|
||||
|
||||
OverlayWarningWidget *m_warningWidget;
|
||||
QScopedPointer<OverlayWarningWidget> m_warningWidget;
|
||||
QTimer *m_showDisableOverlayDialogTimer;
|
||||
};
|
||||
|
||||
|
@ -43,7 +43,10 @@ PowerPlugin::PowerPlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_pluginLoaded(false)
|
||||
, m_showTimeToFull(true)
|
||||
, m_powerStatusWidget(nullptr)
|
||||
, m_tipsLabel(new TipsWidget)
|
||||
, m_systemPowerInter(nullptr)
|
||||
, m_powerInter(nullptr)
|
||||
, m_preChargeTimer(new QTimer(this))
|
||||
{
|
||||
m_tipsLabel->setVisible(false);
|
||||
@ -66,7 +69,7 @@ const QString PowerPlugin::pluginDisplayName() const
|
||||
QWidget *PowerPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
if (itemKey == POWER_KEY)
|
||||
return m_powerStatusWidget;
|
||||
return m_powerStatusWidget.data();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@ -83,7 +86,7 @@ QWidget *PowerPlugin::itemTipsWidget(const QString &itemKey)
|
||||
|
||||
refreshTipsData();
|
||||
|
||||
return m_tipsLabel;
|
||||
return m_tipsLabel.data();
|
||||
}
|
||||
|
||||
void PowerPlugin::init(PluginProxyInterface *proxyInter)
|
||||
@ -201,7 +204,7 @@ void PowerPlugin::loadPlugin()
|
||||
|
||||
m_pluginLoaded = true;
|
||||
|
||||
m_powerStatusWidget = new PowerStatusWidget;
|
||||
m_powerStatusWidget.reset(new PowerStatusWidget);
|
||||
m_powerInter = new DBusPower(this);
|
||||
|
||||
m_systemPowerInter = new SystemPowerInter("com.deepin.system.Power", "/com/deepin/system/Power", QDBusConnection::systemBus(), this);
|
||||
|
@ -70,8 +70,8 @@ private:
|
||||
bool m_pluginLoaded;
|
||||
bool m_showTimeToFull;
|
||||
|
||||
PowerStatusWidget *m_powerStatusWidget;
|
||||
Dock::TipsWidget *m_tipsLabel;
|
||||
QScopedPointer<PowerStatusWidget> m_powerStatusWidget;
|
||||
QScopedPointer<Dock::TipsWidget> m_tipsLabel;
|
||||
|
||||
SystemPowerInter *m_systemPowerInter;
|
||||
DBusPower *m_powerInter;
|
||||
|
@ -23,12 +23,14 @@
|
||||
#include "../widgets/tipswidget.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QDebug>
|
||||
|
||||
#define PLUGIN_STATE_KEY "enable"
|
||||
using namespace Dock;
|
||||
ShowDesktopPlugin::ShowDesktopPlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_pluginLoaded(false)
|
||||
, m_showDesktopWidget(nullptr)
|
||||
, m_tipsLabel(new TipsWidget)
|
||||
{
|
||||
m_tipsLabel->setVisible(false);
|
||||
@ -49,7 +51,7 @@ QWidget *ShowDesktopPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_showDesktopWidget;
|
||||
return m_showDesktopWidget.data();
|
||||
}
|
||||
|
||||
QWidget *ShowDesktopPlugin::itemTipsWidget(const QString &itemKey)
|
||||
@ -58,7 +60,7 @@ QWidget *ShowDesktopPlugin::itemTipsWidget(const QString &itemKey)
|
||||
|
||||
m_tipsLabel->setText(pluginDisplayName());
|
||||
|
||||
return m_tipsLabel;
|
||||
return m_tipsLabel.data();
|
||||
}
|
||||
|
||||
void ShowDesktopPlugin::init(PluginProxyInterface *proxyInter)
|
||||
@ -178,7 +180,7 @@ void ShowDesktopPlugin::loadPlugin()
|
||||
|
||||
m_pluginLoaded = true;
|
||||
|
||||
m_showDesktopWidget = new ShowDesktopWidget;
|
||||
m_showDesktopWidget.reset(new ShowDesktopWidget);
|
||||
|
||||
m_proxyInter->itemAdded(this, pluginName());
|
||||
|
||||
|
@ -63,8 +63,8 @@ private:
|
||||
private:
|
||||
bool m_pluginLoaded;
|
||||
|
||||
ShowDesktopWidget *m_showDesktopWidget;
|
||||
Dock::TipsWidget *m_tipsLabel;
|
||||
QScopedPointer<ShowDesktopWidget> m_showDesktopWidget;
|
||||
QScopedPointer<Dock::TipsWidget> m_tipsLabel;
|
||||
};
|
||||
|
||||
#endif // SHOWDESKTOPPLUGIN_H
|
||||
|
@ -42,6 +42,7 @@ using namespace Dock;
|
||||
ShutdownPlugin::ShutdownPlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_pluginLoaded(false)
|
||||
, m_shutdownWidget(nullptr)
|
||||
, m_tipsLabel(new TipsWidget)
|
||||
, m_powerManagerInter(new DBusPowerManager("com.deepin.daemon.PowerManager", "/com/deepin/daemon/PowerManager", QDBusConnection::systemBus(), this))
|
||||
, m_gsettings(Utils::ModuleSettingsPtr("shutdown", QByteArray(), this))
|
||||
@ -64,7 +65,7 @@ QWidget *ShutdownPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_shutdownWidget;
|
||||
return m_shutdownWidget.data();
|
||||
}
|
||||
|
||||
QWidget *ShutdownPlugin::itemTipsWidget(const QString &itemKey)
|
||||
@ -75,7 +76,7 @@ QWidget *ShutdownPlugin::itemTipsWidget(const QString &itemKey)
|
||||
// font size be changed in ControlCenter
|
||||
m_tipsLabel->setText(tr("Power"));
|
||||
|
||||
return m_tipsLabel;
|
||||
return m_tipsLabel.data();
|
||||
}
|
||||
|
||||
void ShutdownPlugin::init(PluginProxyInterface *proxyInter)
|
||||
@ -284,7 +285,7 @@ void ShutdownPlugin::loadPlugin()
|
||||
|
||||
m_pluginLoaded = true;
|
||||
|
||||
m_shutdownWidget = new ShutdownWidget;
|
||||
m_shutdownWidget.reset(new ShutdownWidget);
|
||||
|
||||
m_proxyInter->itemAdded(this, pluginName());
|
||||
displayModeChanged(displayMode());
|
||||
|
@ -110,8 +110,8 @@ private:
|
||||
private:
|
||||
bool m_pluginLoaded;
|
||||
|
||||
ShutdownWidget *m_shutdownWidget;
|
||||
Dock::TipsWidget *m_tipsLabel;
|
||||
QScopedPointer<ShutdownWidget> m_shutdownWidget;
|
||||
QScopedPointer<Dock::TipsWidget> m_tipsLabel;
|
||||
DBusPowerManager* m_powerManagerInter;
|
||||
const QGSettings *m_gsettings;
|
||||
};
|
||||
|
@ -135,11 +135,11 @@ void Port::setCardId(const uint &cardId)
|
||||
|
||||
SoundApplet::SoundApplet(QWidget *parent)
|
||||
: QScrollArea(parent)
|
||||
, m_centralWidget(new QWidget)
|
||||
, m_centralWidget(new QWidget(this))
|
||||
, m_volumeBtn(new DIconButton(this))
|
||||
, m_volumeIconMax(new QLabel)
|
||||
, m_volumeSlider(new VolumeSlider)
|
||||
, m_soundShow(new TipsWidget)
|
||||
, m_volumeIconMax(new QLabel(this))
|
||||
, m_volumeSlider(new VolumeSlider(this))
|
||||
, m_soundShow(new TipsWidget(this))
|
||||
, m_seperator(new HorizontalSeperator(this))
|
||||
, m_secondSeperator(new HorizontalSeperator(this))
|
||||
, m_deviceLabel(nullptr)
|
||||
@ -147,11 +147,10 @@ SoundApplet::SoundApplet(QWidget *parent)
|
||||
, m_defSinkInter(nullptr)
|
||||
, m_listView(new DListView(this))
|
||||
, m_model(new QStandardItemModel(m_listView))
|
||||
, m_itemDelegate(new ItemDelegate(m_listView))
|
||||
, m_deviceInfo("")
|
||||
, m_lastPort(nullptr)
|
||||
, m_gsettings(Utils::ModuleSettingsPtr("sound", QByteArray(), this))
|
||||
, m_itemDelegate(new ItemDelegate(m_listView))
|
||||
|
||||
{
|
||||
initUi();
|
||||
}
|
||||
@ -215,7 +214,7 @@ void SoundApplet::initUi()
|
||||
|
||||
m_soundShow->setText(QString("%1%").arg(0));
|
||||
|
||||
m_deviceLabel = new TipsWidget;
|
||||
m_deviceLabel = new TipsWidget(this);
|
||||
m_deviceLabel->setText(tr("Device"));
|
||||
DFontSizeManager::instance()->bind(m_deviceLabel, DFontSizeManager::T4, QFont::Medium);
|
||||
|
||||
@ -263,7 +262,7 @@ void SoundApplet::initUi()
|
||||
}
|
||||
});
|
||||
|
||||
m_centralLayout = new QVBoxLayout;
|
||||
m_centralLayout = new QVBoxLayout(this);
|
||||
m_centralLayout->setMargin(0);
|
||||
m_centralLayout->setSpacing(0);
|
||||
m_centralLayout->addLayout(deviceLineLayout);
|
||||
@ -294,7 +293,7 @@ void SoundApplet::initUi()
|
||||
connect(m_audioInter, &DBusAudio::DefaultSinkChanged, this, static_cast<void (SoundApplet::*)()>(&SoundApplet::defaultSinkChanged));
|
||||
connect(m_audioInter, &DBusAudio::IncreaseVolumeChanged, this, &SoundApplet::increaseVolumeChanged);
|
||||
connect(m_audioInter, &DBusAudio::PortEnabledChanged, [this](uint cardId, QString portId) {
|
||||
portEnableChange(cardId, portId);
|
||||
portEnableChange(cardId, portId);
|
||||
});;
|
||||
connect(m_listView, &DListView::clicked, this, [this](const QModelIndex & idx) {
|
||||
const Port * port = m_listView->model()->data(idx, Qt::WhatsThisPropertyRole).value<const Port *>();
|
||||
|
@ -48,7 +48,7 @@ void SoundPlugin::init(PluginProxyInterface *proxyInter)
|
||||
{
|
||||
m_proxyInter = proxyInter;
|
||||
|
||||
m_soundItem = new SoundItem;
|
||||
m_soundItem.reset(new SoundItem);
|
||||
|
||||
if (!pluginIsDisable())
|
||||
m_proxyInter->itemAdded(this, SOUND_KEY);
|
||||
@ -69,7 +69,7 @@ bool SoundPlugin::pluginIsDisable()
|
||||
QWidget *SoundPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
if (itemKey == SOUND_KEY) {
|
||||
return m_soundItem;
|
||||
return m_soundItem.data();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -54,7 +54,7 @@ private:
|
||||
void refreshPluginItemsVisible();
|
||||
|
||||
private:
|
||||
SoundItem *m_soundItem;
|
||||
QScopedPointer<SoundItem> m_soundItem;
|
||||
};
|
||||
|
||||
#endif // SOUNDPLUGIN_H
|
||||
|
@ -59,9 +59,6 @@ private:
|
||||
bool m_empty;
|
||||
int m_trashItemsCount;
|
||||
|
||||
// Dtk::Widget::DLinkButton *m_openBtn;
|
||||
// Dtk::Widget::DLinkButton *m_clearBtn;
|
||||
|
||||
QFileSystemWatcher *m_fsWatcher;
|
||||
};
|
||||
|
||||
|
@ -73,10 +73,9 @@ void TrashPlugin::init(PluginProxyInterface *proxyInter)
|
||||
|
||||
m_proxyInter = proxyInter;
|
||||
|
||||
if (!m_trashWidget)
|
||||
m_trashWidget = new TrashWidget;
|
||||
if (m_trashWidget.isNull())
|
||||
m_trashWidget.reset(new TrashWidget);
|
||||
|
||||
// DFMGlobal::instance()->installTranslator();
|
||||
displayModeChanged(displayMode());
|
||||
}
|
||||
|
||||
@ -84,7 +83,7 @@ QWidget *TrashPlugin::itemWidget(const QString &itemKey)
|
||||
{
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return m_trashWidget;
|
||||
return m_trashWidget.data();
|
||||
}
|
||||
|
||||
QWidget *TrashPlugin::itemTipsWidget(const QString &itemKey)
|
||||
@ -97,7 +96,7 @@ QWidget *TrashPlugin::itemTipsWidget(const QString &itemKey)
|
||||
else
|
||||
m_tipsLabel->setText(tr("Trash - %1 files").arg(count));
|
||||
|
||||
return m_tipsLabel;
|
||||
return m_tipsLabel.data();
|
||||
}
|
||||
|
||||
QWidget *TrashPlugin::itemPopupApplet(const QString &itemKey)
|
||||
@ -105,7 +104,6 @@ QWidget *TrashPlugin::itemPopupApplet(const QString &itemKey)
|
||||
Q_UNUSED(itemKey);
|
||||
|
||||
return nullptr;
|
||||
// return m_trashWidget->popupApplet();
|
||||
}
|
||||
|
||||
const QString TrashPlugin::itemCommand(const QString &itemKey)
|
||||
@ -171,6 +169,8 @@ void TrashPlugin::setSortKey(const QString &itemKey, const int order)
|
||||
|
||||
void TrashPlugin::displayModeChanged(const Dock::DisplayMode displayMode)
|
||||
{
|
||||
Q_UNUSED(displayMode);
|
||||
|
||||
if (pluginIsDisable()) {
|
||||
return;
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ public:
|
||||
private:
|
||||
void refreshPluginItemsVisible();
|
||||
|
||||
TrashWidget *m_trashWidget;
|
||||
QPointer<Dock::TipsWidget> m_tipsLabel;
|
||||
QScopedPointer<TrashWidget> m_trashWidget;
|
||||
QScopedPointer<Dock::TipsWidget> m_tipsLabel;
|
||||
};
|
||||
|
||||
#endif // TRASHPLUGIN_H
|
||||
|
@ -72,7 +72,6 @@ protected:
|
||||
void setWrapperLayout(QBoxLayout *layout);
|
||||
bool expand() const;
|
||||
Dock::Position dockPosition() const;
|
||||
// QSize wrapperSize() const;
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
|
@ -34,15 +34,14 @@ int FashionTrayItem::TrayWidgetHeight = PLUGIN_BACKGROUND_MAX_SIZE;
|
||||
|
||||
FashionTrayItem::FashionTrayItem(TrayPlugin *trayPlugin, QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_mainBoxLayout(new QBoxLayout(QBoxLayout::Direction::LeftToRight)),
|
||||
m_attentionDelayTimer(new QTimer(this)),
|
||||
m_trayPlugin(trayPlugin),
|
||||
m_controlWidget(new FashionTrayControlWidget(trayPlugin->dockPosition())),
|
||||
m_currentDraggingTray(nullptr),
|
||||
m_normalContainer(new NormalContainer(m_trayPlugin)),
|
||||
m_attentionContainer(new AttentionContainer(m_trayPlugin)),
|
||||
m_holdContainer(new HoldContainer(m_trayPlugin)),
|
||||
m_leftSpace(new QWidget)
|
||||
m_mainBoxLayout(new QBoxLayout(QBoxLayout::Direction::LeftToRight, this))
|
||||
, m_attentionDelayTimer(new QTimer(this))
|
||||
, m_trayPlugin(trayPlugin)
|
||||
, m_controlWidget(new FashionTrayControlWidget(trayPlugin->dockPosition()))
|
||||
, m_normalContainer(new NormalContainer(m_trayPlugin, this))
|
||||
, m_attentionContainer(new AttentionContainer(m_trayPlugin, this))
|
||||
, m_holdContainer(new HoldContainer(m_trayPlugin, this))
|
||||
, m_leftSpace(new QWidget(this))
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
|
||||
|
@ -86,7 +86,6 @@ private:
|
||||
|
||||
TrayPlugin *m_trayPlugin;
|
||||
FashionTrayControlWidget *m_controlWidget; //展开按钮
|
||||
FashionTrayWidgetWrapper *m_currentDraggingTray;
|
||||
|
||||
NormalContainer *m_normalContainer; //左侧可展开窗口
|
||||
AttentionContainer *m_attentionContainer;
|
||||
|
@ -40,14 +40,14 @@
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
FashionTrayWidgetWrapper::FashionTrayWidgetWrapper(const QString &itemKey, AbstractTrayWidget *absTrayWidget, QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_absTrayWidget(absTrayWidget),
|
||||
m_layout(new QVBoxLayout(this)),
|
||||
m_attention(false),
|
||||
m_dragging(false),
|
||||
m_hover(false),
|
||||
m_pressed(false),
|
||||
m_itemKey(itemKey)
|
||||
: QWidget(parent)
|
||||
, m_absTrayWidget(absTrayWidget)
|
||||
, m_layout(new QVBoxLayout(this))
|
||||
, m_attention(false)
|
||||
, m_dragging(false)
|
||||
, m_hover(false)
|
||||
, m_pressed(false)
|
||||
, m_itemKey(itemKey)
|
||||
|
||||
{
|
||||
setStyleSheet("background: transparent;");
|
||||
|
@ -68,6 +68,7 @@ SNITrayWidget::SNITrayWidget(const QString &sniServicePath, QWidget *parent)
|
||||
arrowRectangle->setArrowHeight(10);
|
||||
arrowRectangle->setObjectName("snitraypopup");
|
||||
PopupWindow = arrowRectangle;
|
||||
connect(qApp, &QApplication::aboutToQuit, PopupWindow, &DockPopupWindow::deleteLater);
|
||||
}
|
||||
|
||||
if (m_sniServicePath.startsWith("/") || !m_sniServicePath.contains("/")) {
|
||||
|
@ -66,6 +66,7 @@ SystemTrayItem::SystemTrayItem(PluginsItemInterface *const pluginInter, const QS
|
||||
arrowRectangle->setArrowHeight(10);
|
||||
arrowRectangle->setObjectName("systemtraypopup");
|
||||
PopupWindow = arrowRectangle;
|
||||
connect(qApp, &QApplication::aboutToQuit, PopupWindow, &DockPopupWindow::deleteLater);
|
||||
}
|
||||
|
||||
m_popupTipsDelayTimer->setInterval(500);
|
||||
|
@ -84,7 +84,6 @@ void TrayPlugin::init(PluginProxyInterface *proxyInter)
|
||||
m_systemTraysController = new SystemTraysController(this);
|
||||
m_refreshXEmbedItemsTimer = new QTimer(this);
|
||||
m_refreshSNIItemsTimer = new QTimer(this);
|
||||
m_tipsLabel = new TipsWidget;
|
||||
|
||||
m_refreshXEmbedItemsTimer->setInterval(0);
|
||||
m_refreshXEmbedItemsTimer->setSingleShot(true);
|
||||
@ -92,10 +91,6 @@ void TrayPlugin::init(PluginProxyInterface *proxyInter)
|
||||
m_refreshSNIItemsTimer->setInterval(0);
|
||||
m_refreshSNIItemsTimer->setSingleShot(true);
|
||||
|
||||
m_tipsLabel->setObjectName("tray");
|
||||
m_tipsLabel->setText(tr("System Tray"));
|
||||
m_tipsLabel->setVisible(false);
|
||||
|
||||
connect(m_systemTraysController, &SystemTraysController::pluginItemAdded, this, &TrayPlugin::addTrayWidget);
|
||||
connect(m_systemTraysController, &SystemTraysController::pluginItemRemoved, this, [ = ](const QString & itemKey) { trayRemoved(itemKey); });
|
||||
|
||||
@ -480,7 +475,7 @@ void TrayPlugin::trayIndicatorAdded(const QString &itemKey, const QString &indic
|
||||
|
||||
IndicatorTray *indicatorTray = nullptr;
|
||||
if (!m_indicatorMap.keys().contains(indicatorName)) {
|
||||
indicatorTray = new IndicatorTray(indicatorName);
|
||||
indicatorTray = new IndicatorTray(indicatorName, this);
|
||||
m_indicatorMap[indicatorName] = indicatorTray;
|
||||
} else {
|
||||
indicatorTray = m_indicatorMap[itemKey];
|
||||
|
@ -101,9 +101,8 @@ private:
|
||||
QMap<QString, SNITrayWidget *> m_passiveSNITrayMap; //这个目前好像无用了
|
||||
QMap<QString, IndicatorTray*> m_indicatorMap; //这个有键盘跟license
|
||||
|
||||
Dock::TipsWidget *m_tipsLabel;
|
||||
bool m_pluginLoaded;
|
||||
std::mutex m_sniMutex;
|
||||
std::mutex m_sniMutex;
|
||||
};
|
||||
|
||||
#endif // TRAYPLUGIN_H
|
||||
|
@ -79,6 +79,7 @@ XEmbedTrayWidget::XEmbedTrayWidget(quint32 winId, QWidget *parent)
|
||||
: AbstractTrayWidget(parent)
|
||||
, m_windowId(winId)
|
||||
, m_appName(getAppNameForWindow(winId))
|
||||
, m_valid(true)
|
||||
{
|
||||
wrapWindow();
|
||||
|
||||
|
@ -57,7 +57,6 @@ private:
|
||||
void refershIconImage();
|
||||
|
||||
static QString getAppNameForWindow(quint32 winId);
|
||||
// static int getTrayWidgetKeySuffix(const QString &appName, quint32 winId);
|
||||
|
||||
private slots:
|
||||
void setX11PassMouseEvent(const bool pass);
|
||||
@ -73,7 +72,7 @@ private:
|
||||
|
||||
QTimer *m_updateTimer;
|
||||
QTimer *m_sendHoverEvent;
|
||||
bool m_valid = true;
|
||||
bool m_valid;
|
||||
};
|
||||
|
||||
#endif // XEMBEDTRAYWIDGET_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user