mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
perf: 启动速度优化
任务栏插件加载的配置改成只在用到的时候创建一次,加速启动的时间,同时也减小了内存;启动器部分的提示框延迟创建。 Log: 优化启动速度 Influence: 任务栏启动时间 Task: https://pms.uniontech.com/zentao/task-view-95700.html Change-Id: I187100f24cf9ac932b1e143c7671beb0841b3fce
This commit is contained in:
parent
a8becc02df
commit
f830885be5
@ -54,7 +54,6 @@ AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSetti
|
|||||||
, m_appSettings(appSettings)
|
, m_appSettings(appSettings)
|
||||||
, m_activeAppSettings(activeAppSettings)
|
, m_activeAppSettings(activeAppSettings)
|
||||||
, m_dockedAppSettings(dockedAppSettings)
|
, m_dockedAppSettings(dockedAppSettings)
|
||||||
, m_appNameTips(new TipsWidget(this))
|
|
||||||
, m_appPreviewTips(nullptr)
|
, m_appPreviewTips(nullptr)
|
||||||
, m_itemEntryInter(new DockEntryInter("com.deepin.dde.daemon.Dock", entry.path(), QDBusConnection::sessionBus(), this))
|
, m_itemEntryInter(new DockEntryInter("com.deepin.dde.daemon.Dock", entry.path(), QDBusConnection::sessionBus(), this))
|
||||||
, m_swingEffectView(nullptr)
|
, m_swingEffectView(nullptr)
|
||||||
@ -70,7 +69,6 @@ AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSetti
|
|||||||
, m_retryObtainIconTimer(new QTimer(this))
|
, m_retryObtainIconTimer(new QTimer(this))
|
||||||
, m_refershIconTimer(new QTimer(this))
|
, m_refershIconTimer(new QTimer(this))
|
||||||
, m_themeType(DGuiApplicationHelper::instance()->themeType())
|
, m_themeType(DGuiApplicationHelper::instance()->themeType())
|
||||||
, m_config(new DConfig(QString("com.deepin.dde.dock.dconfig"), QString(), this))
|
|
||||||
{
|
{
|
||||||
QHBoxLayout *centralLayout = new QHBoxLayout;
|
QHBoxLayout *centralLayout = new QHBoxLayout;
|
||||||
centralLayout->setMargin(0);
|
centralLayout->setMargin(0);
|
||||||
@ -83,10 +81,6 @@ AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSetti
|
|||||||
m_id = m_itemEntryInter->id();
|
m_id = m_itemEntryInter->id();
|
||||||
m_active = m_itemEntryInter->isActive();
|
m_active = m_itemEntryInter->isActive();
|
||||||
|
|
||||||
m_appNameTips->setObjectName(m_itemEntryInter->name());
|
|
||||||
m_appNameTips->setVisible(false);
|
|
||||||
m_appNameTips->installEventFilter(this);
|
|
||||||
|
|
||||||
m_updateIconGeometryTimer->setInterval(500);
|
m_updateIconGeometryTimer->setInterval(500);
|
||||||
m_updateIconGeometryTimer->setSingleShot(true);
|
m_updateIconGeometryTimer->setSingleShot(true);
|
||||||
|
|
||||||
@ -476,22 +470,24 @@ const QString AppItem::contextMenu() const
|
|||||||
|
|
||||||
QWidget *AppItem::popupTips()
|
QWidget *AppItem::popupTips()
|
||||||
{
|
{
|
||||||
if (checkGSettingsControl()) {
|
if (checkGSettingsControl())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
if (m_dragging)
|
if (m_dragging)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
static TipsWidget appNameTips(topLevelWidget());
|
||||||
|
appNameTips.setVisible(false);
|
||||||
|
|
||||||
if (!m_windowInfos.isEmpty()) {
|
if (!m_windowInfos.isEmpty()) {
|
||||||
const quint32 currentWindow = m_itemEntryInter->currentWindow();
|
const quint32 currentWindow = m_itemEntryInter->currentWindow();
|
||||||
Q_ASSERT(m_windowInfos.contains(currentWindow));
|
Q_ASSERT(m_windowInfos.contains(currentWindow));
|
||||||
m_appNameTips->setText(m_windowInfos[currentWindow].title.simplified());
|
appNameTips.setText(m_windowInfos[currentWindow].title.simplified());
|
||||||
} else {
|
} else {
|
||||||
m_appNameTips->setText(m_itemEntryInter->name().simplified());
|
appNameTips.setText(m_itemEntryInter->name().simplified());
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_appNameTips;
|
return &appNameTips;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppItem::startDrag()
|
void AppItem::startDrag()
|
||||||
@ -672,8 +668,9 @@ void AppItem::showPreview()
|
|||||||
connect(m_appPreviewTips, &PreviewContainer::requestHidePopup, this, &AppItem::onResetPreview);
|
connect(m_appPreviewTips, &PreviewContainer::requestHidePopup, this, &AppItem::onResetPreview);
|
||||||
|
|
||||||
// 预览标题显示方式的配置
|
// 预览标题显示方式的配置
|
||||||
if (m_config->isValid() && m_config->keyList().contains("Dock_Show_Window_name"))
|
DConfig config(QString("com.deepin.dde.dock.dconfig"), QString());
|
||||||
m_appPreviewTips->setTitleDisplayMode(m_config->value("Dock_Show_Window_name").toInt());
|
if (config.isValid() && config.keyList().contains("Dock_Show_Window_name"))
|
||||||
|
m_appPreviewTips->setTitleDisplayMode(config.value("Dock_Show_Window_name").toInt());
|
||||||
|
|
||||||
showPopupWindow(m_appPreviewTips, true);
|
showPopupWindow(m_appPreviewTips, true);
|
||||||
}
|
}
|
||||||
@ -766,7 +763,6 @@ void AppItem::onThemeTypeChanged(DGuiApplicationHelper::ColorType themeType)
|
|||||||
AppItem::~AppItem()
|
AppItem::~AppItem()
|
||||||
{
|
{
|
||||||
stopSwingEffect();
|
stopSwingEffect();
|
||||||
m_appNameTips->deleteLater();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppItem::showEvent(QShowEvent *e)
|
void AppItem::showEvent(QShowEvent *e)
|
||||||
|
@ -39,10 +39,6 @@
|
|||||||
using DockEntryInter = com::deepin::dde::daemon::dock::Entry;
|
using DockEntryInter = com::deepin::dde::daemon::dock::Entry;
|
||||||
class QGSettings;
|
class QGSettings;
|
||||||
|
|
||||||
DCORE_BEGIN_NAMESPACE
|
|
||||||
class DConfig;
|
|
||||||
DCORE_END_NAMESPACE
|
|
||||||
|
|
||||||
class AppItem : public DockItem
|
class AppItem : public DockItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -114,7 +110,6 @@ private:
|
|||||||
const QGSettings *m_activeAppSettings;
|
const QGSettings *m_activeAppSettings;
|
||||||
const QGSettings *m_dockedAppSettings;
|
const QGSettings *m_dockedAppSettings;
|
||||||
|
|
||||||
TipsWidget *m_appNameTips;
|
|
||||||
PreviewContainer *m_appPreviewTips;
|
PreviewContainer *m_appPreviewTips;
|
||||||
DockEntryInter *m_itemEntryInter;
|
DockEntryInter *m_itemEntryInter;
|
||||||
|
|
||||||
@ -148,7 +143,6 @@ private:
|
|||||||
DGuiApplicationHelper::ColorType m_themeType;
|
DGuiApplicationHelper::ColorType m_themeType;
|
||||||
|
|
||||||
static QPoint MousePressPos;
|
static QPoint MousePressPos;
|
||||||
DTK_CORE_NAMESPACE::DConfig *m_config;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPITEM_H
|
#endif // APPITEM_H
|
||||||
|
@ -22,26 +22,24 @@
|
|||||||
#include "launcheritem.h"
|
#include "launcheritem.h"
|
||||||
#include "themeappicon.h"
|
#include "themeappicon.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "../widgets/tipswidget.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QGSettings>
|
#include <QGSettings>
|
||||||
|
#include <QDBusInterface>
|
||||||
|
#include <QDBusPendingCall>
|
||||||
|
#include <DDBusSender>
|
||||||
|
#include <QDBusPendingReply>
|
||||||
|
|
||||||
DCORE_USE_NAMESPACE
|
DCORE_USE_NAMESPACE
|
||||||
|
|
||||||
LauncherItem::LauncherItem(QWidget *parent)
|
LauncherItem::LauncherItem(QWidget *parent)
|
||||||
: DockItem(parent)
|
: DockItem(parent)
|
||||||
, m_launcherInter(new LauncherInter("com.deepin.dde.Launcher", "/com/deepin/dde/Launcher", QDBusConnection::sessionBus(), this))
|
|
||||||
, m_tips(new TipsWidget(this))
|
|
||||||
, m_gsettings(Utils::ModuleSettingsPtr("launcher", QByteArray(), this))
|
, m_gsettings(Utils::ModuleSettingsPtr("launcher", QByteArray(), this))
|
||||||
{
|
{
|
||||||
m_launcherInter->setSync(true, false);
|
|
||||||
|
|
||||||
m_tips->setVisible(false);
|
|
||||||
m_tips->setObjectName("launcher");
|
|
||||||
|
|
||||||
if (m_gsettings) {
|
if (m_gsettings) {
|
||||||
connect(m_gsettings, &QGSettings::changed, this, &LauncherItem::onGSettingsChanged);
|
connect(m_gsettings, &QGSettings::changed, this, &LauncherItem::onGSettingsChanged);
|
||||||
}
|
}
|
||||||
@ -102,9 +100,14 @@ void LauncherItem::mouseReleaseEvent(QMouseEvent *e)
|
|||||||
if (e->button() != Qt::LeftButton)
|
if (e->button() != Qt::LeftButton)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_launcherInter->IsVisible()) {
|
DDBusSender dbusSender = DDBusSender()
|
||||||
m_launcherInter->Show();
|
.service("com.deepin.dde.Launcher")
|
||||||
}
|
.path("/com/deepin/dde/Launcher")
|
||||||
|
.interface("com.deepin.dde.Launcher");
|
||||||
|
|
||||||
|
QDBusPendingReply<bool> visibleReply = dbusSender.property("Visible").get();
|
||||||
|
if (!visibleReply.value())
|
||||||
|
dbusSender.method("Show").call();
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *LauncherItem::popupTips()
|
QWidget *LauncherItem::popupTips()
|
||||||
@ -113,8 +116,10 @@ QWidget *LauncherItem::popupTips()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_tips.reset(new TipsWidget(this));
|
||||||
|
m_tips->setVisible(false);
|
||||||
m_tips->setText(tr("Launcher"));
|
m_tips->setText(tr("Launcher"));
|
||||||
return m_tips;
|
return m_tips.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherItem::onGSettingsChanged(const QString& key) {
|
void LauncherItem::onGSettingsChanged(const QString& key) {
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
#define LAUNCHERITEM_H
|
#define LAUNCHERITEM_H
|
||||||
|
|
||||||
#include "dockitem.h"
|
#include "dockitem.h"
|
||||||
#include "../widgets/tipswidget.h"
|
|
||||||
|
|
||||||
#include <com_deepin_dde_launcher.h>
|
namespace Dock {
|
||||||
|
class TipsWidget;
|
||||||
|
}
|
||||||
|
|
||||||
using LauncherInter = com::deepin::dde::Launcher;
|
|
||||||
class QGSettings;
|
class QGSettings;
|
||||||
class LauncherItem : public DockItem
|
class LauncherItem : public DockItem
|
||||||
{
|
{
|
||||||
@ -57,9 +57,8 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QPixmap m_icon;
|
QPixmap m_icon;
|
||||||
LauncherInter *m_launcherInter;
|
|
||||||
TipsWidget *m_tips;
|
|
||||||
const QGSettings *m_gsettings;
|
const QGSettings *m_gsettings;
|
||||||
|
QSharedPointer<TipsWidget> m_tips;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LAUNCHERITEM_H
|
#endif // LAUNCHERITEM_H
|
||||||
|
@ -153,10 +153,9 @@ void MainWindow::launch()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_launched = true;
|
m_launched = true;
|
||||||
qApp->processEvents();
|
|
||||||
setVisible(true);
|
|
||||||
m_multiScreenWorker->initShow();
|
m_multiScreenWorker->initShow();
|
||||||
m_shadowMaskOptimizeTimer->start();
|
m_shadowMaskOptimizeTimer->start();
|
||||||
|
QTimer::singleShot(0, this, [ this ] { this->setVisible(true); });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user