diff --git a/panels/notification/osd/CMakeLists.txt b/panels/notification/osd/CMakeLists.txt index 75957f4d1..687b4be14 100644 --- a/panels/notification/osd/CMakeLists.txt +++ b/panels/notification/osd/CMakeLists.txt @@ -22,3 +22,4 @@ add_subdirectory(audio) add_subdirectory(displaymode) add_subdirectory(kblayout) add_subdirectory(brightness) +add_subdirectory(windoweffect) diff --git a/panels/notification/osd/windoweffect/CMakeLists.txt b/panels/notification/osd/windoweffect/CMakeLists.txt new file mode 100644 index 000000000..be9e3444e --- /dev/null +++ b/panels/notification/osd/windoweffect/CMakeLists.txt @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +add_library(osd-windowEffect SHARED + windoweffectapplet.cpp + windoweffectapplet.h +) + +target_link_libraries(osd-windowEffect PRIVATE + dde-shell-frame +) + +ds_install_package(PACKAGE org.deepin.ds.osd.windoweffect TARGET osd-windowEffect) +ds_handle_package_translation(PACKAGE org.deepin.ds.osd.windoweffect) diff --git a/panels/notification/osd/windoweffect/package/icons/osd_balance_effect.dci b/panels/notification/osd/windoweffect/package/icons/osd_balance_effect.dci new file mode 100644 index 000000000..b0a9d82f5 Binary files /dev/null and b/panels/notification/osd/windoweffect/package/icons/osd_balance_effect.dci differ diff --git a/panels/notification/osd/windoweffect/package/icons/osd_best_visuals.dci b/panels/notification/osd/windoweffect/package/icons/osd_best_visuals.dci new file mode 100644 index 000000000..49891d4f2 Binary files /dev/null and b/panels/notification/osd/windoweffect/package/icons/osd_best_visuals.dci differ diff --git a/panels/notification/osd/windoweffect/package/icons/osd_optimal_performance.dci b/panels/notification/osd/windoweffect/package/icons/osd_optimal_performance.dci new file mode 100644 index 000000000..dfcdef72e Binary files /dev/null and b/panels/notification/osd/windoweffect/package/icons/osd_optimal_performance.dci differ diff --git a/panels/notification/osd/windoweffect/package/main.qml b/panels/notification/osd/windoweffect/package/main.qml new file mode 100644 index 000000000..7e5d92e47 --- /dev/null +++ b/panels/notification/osd/windoweffect/package/main.qml @@ -0,0 +1,133 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.15 +import QtQuick.Window 2.15 + +import org.deepin.ds 1.0 +import org.deepin.dtk 1.0 as D + +AppletItem { + id: control + implicitWidth: childrenRect.width + implicitHeight: childrenRect.height + property int selectIndex: indexByValue(Applet.effectType) + property int checkedIndex: indexByValue(Applet.effectType) + + enum WindowEffectType { + Default = 0, + Best, + Better, + Good, + Normal, + Compatible + } + + Connections { + target: control.Panel + function onVisibleChanged() { + if (!control.Panel.visible) { + Applet.effectType = effectModel.get(selectIndex).value + } + } + } + + function indexByValue(value) { + for (var i = 0; i < effectModel.count; i++) { + if (effectModel.get(i).value === value) { + return i + } + } + return -1 + } + + function update(osdType) + { + if (selectIndex === effectModel.count - 1) { + selectIndex = 0 + } else { + selectIndex++ + } + + if (match(osdType)) { + return true + } + return false + } + + function match(osdType) + { + return osdType === "SwitchWM" + } + + ListView { + id: listview + model: effectModel + height: contentHeight + width: 500 + spacing: 5 + delegate: D.ItemDelegate { + checkable: true + checked: control.selectIndex === index + icon.name: model.icon + icon.width: 64 + icon.height: 64 + width: listview.width + rightPadding: 10 + contentFlow: true + content: RowLayout { + spacing: 10 + ColumnLayout { + D.Label { + text: model.title + font { + family: D.DTK.fontManager.t5.family + pointSize: D.DTK.fontManager.t5.pointSize + bold: true + } + Layout.fillWidth: true + horizontalAlignment: Text.AlignLeft + } + + D.Label { + text: model.description + font: D.DTK.fontManager.t8 + Layout.fillWidth: true + horizontalAlignment: Text.AlignLeft + wrapMode: Text.WordWrap + } + } + D.DciIcon { + visible: control.checkedIndex === index + sourceSize: Qt.size(24, 24) + name: "item_checked" + } + } + } + } + + ListModel { + id: effectModel + ListElement { + value: main.WindowEffectType.Normal + icon: "osd_optimal_performance" + title: qsTr("Optimal performance") + description: qsTr("Optimal performance: Close all interface and window effects to ensure efficient system operation") + } + ListElement { + value: main.WindowEffectType.Better + icon: "osd_balance_effect" + title: qsTr("Balance") + description: qsTr("Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation") + } + ListElement { + value: main.WindowEffectType.Best + icon: "osd_best_visuals" + title: qsTr("Best Visuals") + description: qsTr("Best Visual: Enable all interface and window effects to experience the best visual effects") + } + } +} diff --git a/panels/notification/osd/windoweffect/package/metadata.json b/panels/notification/osd/windoweffect/package/metadata.json new file mode 100644 index 000000000..6c8b9a6e0 --- /dev/null +++ b/panels/notification/osd/windoweffect/package/metadata.json @@ -0,0 +1,8 @@ +{ + "Plugin": { + "Version": "1.0", + "Id": "org.deepin.ds.osd.windoweffect", + "Url": "main.qml", + "Parent": "org.deepin.ds.osd" + } +} diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_az.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_az.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_az.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_bo.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_bo.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_bo.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ca.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ca.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ca.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_es.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_es.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_es.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_fi.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_fi.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_fi.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_fr.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_fr.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_fr.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_hu.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_hu.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_hu.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_it.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_it.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_it.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ja.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ja.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ja.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ko.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ko.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ko.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_nb_NO.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_nb_NO.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_nb_NO.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_pl.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_pl.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_pl.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_pt_BR.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_pt_BR.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_pt_BR.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ru.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ru.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_ru.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_uk.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_uk.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_uk.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_zh_CN.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_zh_CN.ts new file mode 100644 index 000000000..addd708a1 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_zh_CN.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + 最佳性能 + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + 最佳性能: 关闭所有界面和窗口特效,保障系统高效运行 + + + + Balance + 均衡 + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + 均衡: 限制部分窗口特效,保障出色的视觉体验,同时维持系统流畅运行 + + + + Best Visuals + 最佳视觉 + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + 最佳视觉: 启用所有界面和窗口特效,体验最佳视觉效果 + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_zh_HK.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_zh_HK.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_zh_HK.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_zh_TW.ts b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_zh_TW.ts new file mode 100644 index 000000000..61fb73d76 --- /dev/null +++ b/panels/notification/osd/windoweffect/translations/org.deepin.ds.osd.windoweffect_zh_TW.ts @@ -0,0 +1,37 @@ + + + + + main + + + Optimal performance + + + + + Optimal performance: Close all interface and window effects to ensure efficient system operation + + + + + Balance + + + + + Balance: Limit some window effects to ensure excellent visual experience while maintaining smooth system operation + + + + + Best Visuals + + + + + Best Visual: Enable all interface and window effects to experience the best visual effects + + + + diff --git a/panels/notification/osd/windoweffect/windoweffectapplet.cpp b/panels/notification/osd/windoweffect/windoweffectapplet.cpp new file mode 100644 index 000000000..9238b4709 --- /dev/null +++ b/panels/notification/osd/windoweffect/windoweffectapplet.cpp @@ -0,0 +1,46 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "windoweffectapplet.h" + +#include "pluginfactory.h" + +const QString ORG_KDE_KWIN = QStringLiteral("org.kde.kwin"); +const QString ORG_KDE_KWIN_COMPOSITING = QStringLiteral("org.kde.kwin.compositing"); +const QString WINDOW_EFFECT_TYPE_KEY = QStringLiteral("user_type"); + +namespace osd { + +WindowEffectApplet::WindowEffectApplet(QObject *parent) + : DApplet(parent) + , m_wmConfig(DConfig::create(ORG_KDE_KWIN, ORG_KDE_KWIN_COMPOSITING, "", this)) +{ + connect(m_wmConfig, &DConfig::valueChanged, this, &WindowEffectApplet::onWmConfigChanged); + onWmConfigChanged(WINDOW_EFFECT_TYPE_KEY); +} + +void WindowEffectApplet::setEffectType(WindowEffectType effectType) +{ + m_wmConfig->setValue(WINDOW_EFFECT_TYPE_KEY, effectType); +} + +WindowEffectApplet::WindowEffectType WindowEffectApplet::effectType() const +{ + return m_effectType; +} + +void WindowEffectApplet::onWmConfigChanged(const QString &key) +{ + if (key == WINDOW_EFFECT_TYPE_KEY) { + auto value = m_wmConfig->value(WINDOW_EFFECT_TYPE_KEY).toInt(); + m_effectType = static_cast(value); + Q_EMIT effectTypeChanged(m_effectType); + } +} + +D_APPLET_CLASS(WindowEffectApplet) + +} + +#include "windoweffectapplet.moc" diff --git a/panels/notification/osd/windoweffect/windoweffectapplet.h b/panels/notification/osd/windoweffect/windoweffectapplet.h new file mode 100644 index 000000000..463a25e15 --- /dev/null +++ b/panels/notification/osd/windoweffect/windoweffectapplet.h @@ -0,0 +1,43 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "applet.h" +#include + +DCORE_USE_NAMESPACE + +namespace osd { +class WindowEffectApplet : public DS_NAMESPACE::DApplet +{ + Q_OBJECT + Q_PROPERTY(WindowEffectType effectType READ effectType WRITE setEffectType NOTIFY effectTypeChanged FINAL) +public: + enum WindowEffectType { + Default = 0, + Best, + Better, + Good, + Normal, + Compatible + }; + Q_ENUM(WindowEffectType) + + explicit WindowEffectApplet(QObject *parent = nullptr); + + void setEffectType(WindowEffectType effectType); + WindowEffectType effectType() const; + +Q_SIGNALS: + void effectTypeChanged(WindowEffectType value); + +private: + void onWmConfigChanged(const QString &key); + +private: + WindowEffectType m_effectType; + DConfig* m_wmConfig; +}; +}