Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Build-Depends:
libqt6svg6,
libdtk6declarative, qml6-module-qtquick-controls2-styles-chameleon, qt6-declarative-private-dev,
libyaml-cpp-dev,
qt6-l10n-tools, qt6-svg-dev, dde-tray-loader-dev (> 1.99.8),
qt6-l10n-tools, qt6-svg-dev, dde-tray-loader-dev (> 1.99.14),
dde-application-manager-api (> 1.2.23), dde-control-center-dev (>= 6.0.73)
Standards-Version: 3.9.8
Homepage: http://www.deepin.org
Expand Down
50 changes: 50 additions & 0 deletions panels/dock/pluginmanagerextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@
#include "pluginmanagerintegration_p.h"
#include "constants.h"

#include <DGuiApplicationHelper>

Check warning on line 9 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DGuiApplicationHelper> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DPlatformTheme>

Check warning on line 10 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DPlatformTheme> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <cstdint>

Check warning on line 12 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <cstdint> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <QtWaylandCompositor/QWaylandSurface>

Check warning on line 14 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtWaylandCompositor/QWaylandSurface> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QtWaylandCompositor/QWaylandResource>
#include <QtWaylandCompositor/QWaylandCompositor>

#include <QJsonObject>

Check warning on line 18 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QJsonObject> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QJsonParseError>

Check warning on line 19 in panels/dock/pluginmanagerextension.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QJsonParseError> not found. Please note: Cppcheck does not need standard library headers to get proper results.

DGUI_USE_NAMESPACE

PluginScaleManager::PluginScaleManager(QWaylandCompositor *compositor)
: QWaylandCompositorExtensionTemplate(compositor)
, m_compositor(compositor)
Expand Down Expand Up @@ -376,6 +381,13 @@
PluginManager::PluginManager(QWaylandCompositor *compositor)
: QWaylandCompositorExtensionTemplate(compositor)
{
auto theme = DGuiApplicationHelper::instance()->applicationTheme();
QObject::connect(theme, &DPlatformTheme::fontNameChanged, this, &PluginManager::onFontChanged);
QObject::connect(theme, &DPlatformTheme::fontPointSizeChanged, this, &PluginManager::onFontChanged);
QObject::connect(theme, &DPlatformTheme::activeColorChanged, this, &PluginManager::onActiveColorChanged);
QObject::connect(theme, &DPlatformTheme::darkActiveColorChanged, this, &PluginManager::onActiveColorChanged);
QObject::connect(theme, &DPlatformTheme::themeNameChanged, this, &PluginManager::onThemeChanged);
QObject::connect(theme, &DPlatformTheme::iconThemeNameChanged, this, &PluginManager::onThemeChanged);
}

void PluginManager::initialize()
Expand Down Expand Up @@ -485,6 +497,10 @@

send_position_changed(resource->handle, m_dockPosition);
send_color_theme_changed(resource->handle, m_dockColorTheme);
auto theme = DGuiApplicationHelper::instance()->applicationTheme();
send_active_color_changed(resource->handle, theme->activeColor().name(), theme->darkActiveColor().name());
send_font_changed(resource->handle, theme->fontName(), theme->fontPointSize());
send_theme_changed(resource->handle, theme->themeName(), theme->iconThemeName());

auto plugin = new PluginSurface(this, pluginId, itemKey, display_name, plugin_flags, type, size_policy, qwaylandSurface, shellSurfaceResource);
m_pluginSurfaces << plugin;
Expand Down Expand Up @@ -573,6 +589,40 @@
m_pluginSurfaces.removeAll(plugin);
}

void PluginManager::onFontChanged()
{
foreachPluginSurface([this](Resource *source) {
auto theme = DGuiApplicationHelper::instance()->applicationTheme();
send_font_changed(source->handle, theme->fontName(), theme->fontPointSize());
});
}

void PluginManager::onActiveColorChanged()
{
foreachPluginSurface([this](Resource *source) {
auto theme = DGuiApplicationHelper::instance()->applicationTheme();
send_active_color_changed(source->handle, theme->activeColor().name(), theme->darkActiveColor().name());
});
}

void PluginManager::onThemeChanged()
{
foreachPluginSurface([this](Resource *source) {
auto theme = DGuiApplicationHelper::instance()->applicationTheme();
send_active_color_changed(source->handle, theme->themeName(), theme->iconThemeName());
});
}

void PluginManager::foreachPluginSurface(PluginSurfaceCallback callback)
{
foreach (PluginSurface *plugin, m_pluginSurfaces) {
Resource *target = resourceMap().value(plugin->surface()->waylandClient());
if (target) {
callback(target);
}
}
}

QString PluginManager::dockSizeMsg() const
{
if (m_dockSize.isEmpty())
Expand Down
7 changes: 7 additions & 0 deletions panels/dock/pluginmanagerextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
void dockSizeChanged();
void requestShutdown(const QString &type);

private Q_SLOTS:

Check warning on line 87 in panels/dock/pluginmanagerextension_p.h

View workflow job for this annotation

GitHub Actions / cppcheck

There is an unknown macro here somewhere. Configuration is required. If Q_SLOTS is a macro then please configure it.
void onFontChanged();
void onActiveColorChanged();
void onThemeChanged();

protected:
virtual void plugin_manager_v1_request_message(Resource *resource, const QString &plugin_id, const QString &item_key, const QString &msg) override;
virtual void plugin_manager_v1_create_popup_at(Resource *resource, const QString &plugin_id, const QString &item_key, int32_t type, int32_t x, int32_t y, struct ::wl_resource *surface, uint32_t id) override;
Expand All @@ -96,6 +101,8 @@
void sendEventMsg(Resource *target, const QString &msg);
QString dockSizeMsg() const;
QString popupMinHeightMsg() const;
using PluginSurfaceCallback = std::function<void(Resource *)>;
void foreachPluginSurface(PluginSurfaceCallback callback);

private:
QList<PluginSurface*> m_pluginSurfaces;
Expand Down