From acff30b1e876c488adf7a75b98c4d0c1e2ed554d Mon Sep 17 00:00:00 2001 From: Fan PengCheng Date: Fri, 11 Mar 2022 21:38:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E9=A1=B9=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 配置项规范化 Log: Influence: 无 Task: https://pms.uniontech.com/task-view-104239.html Change-Id: I08595e09292e055396c18998d035fde1f2223482 --- ...dock.dconfig.json => org.deepin.dock.json} | 6 ++-- frame/item/appitem.cpp | 6 ++-- plugins/dcc-dock-plugin/CMakeLists.txt | 2 +- plugins/dcc-dock-plugin/module_widget.cpp | 20 +++++------ ...onfig.json => org.deepin.dock.plugin.json} | 36 +++++++++---------- plugins/dcc-dock-plugin/settings_module.cpp | 14 ++++---- .../ut_gsettings_watcher.cpp | 18 +++++----- 7 files changed, 51 insertions(+), 51 deletions(-) rename configs/{com.deepin.dde.dock.dconfig.json => org.deepin.dock.json} (89%) rename plugins/dcc-dock-plugin/{dde.dock.plugin.dconfig.json => org.deepin.dock.plugin.json} (82%) diff --git a/configs/com.deepin.dde.dock.dconfig.json b/configs/org.deepin.dock.json similarity index 89% rename from configs/com.deepin.dde.dock.dconfig.json rename to configs/org.deepin.dock.json index 19c01ddcd..1656b5df2 100644 --- a/configs/com.deepin.dde.dock.dconfig.json +++ b/configs/org.deepin.dock.json @@ -2,10 +2,10 @@ "magic":"dsg.config.meta", "version":"1.0", "contents":{ - "Dock_Show_Window_name":{ + "showWindowName":{ "value":0, "serial":0, - "flags":"", + "flags":[], "name":"小窗口显示窗口名称", "name[zh_CN]":"小窗口显示窗口名称", "description[zh_CN]":"提供鼠标悬停小窗口标题显示配置,默认为悬停显示: \ @@ -14,7 +14,7 @@ 当配置为不显示时,鼠标悬停应用位置和预览小窗口位置时都不显示标题信息;", "description":"0 Mouse over show;1 Always show; 2 Always hide", "permissions":"readwrite", - "visibility":"public" + "visibility":"private" } } } \ No newline at end of file diff --git a/frame/item/appitem.cpp b/frame/item/appitem.cpp index 8d43562d9..f51ec4c90 100644 --- a/frame/item/appitem.cpp +++ b/frame/item/appitem.cpp @@ -667,9 +667,9 @@ void AppItem::showPreview() connect(m_appPreviewTips, &PreviewContainer::requestHidePopup, this, &AppItem::onResetPreview); // 预览标题显示方式的配置 - DConfig config(QString("com.deepin.dde.dock.dconfig"), QString()); - if (config.isValid() && config.keyList().contains("Dock_Show_Window_name")) - m_appPreviewTips->setTitleDisplayMode(config.value("Dock_Show_Window_name").toInt()); + DConfig config(QString("org.deepin.dock"), QString()); + if (config.isValid() && config.keyList().contains("showWindowName")) + m_appPreviewTips->setTitleDisplayMode(config.value("showWindowName").toInt()); showPopupWindow(m_appPreviewTips, true); } diff --git a/plugins/dcc-dock-plugin/CMakeLists.txt b/plugins/dcc-dock-plugin/CMakeLists.txt index 0c5144277..23225a318 100644 --- a/plugins/dcc-dock-plugin/CMakeLists.txt +++ b/plugins/dcc-dock-plugin/CMakeLists.txt @@ -47,7 +47,7 @@ add_custom_target(translations ALL DEPENDS ${QM_FILES}) install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations) # dconfig -file(GLOB DCONFIG_FILES "dde.dock.plugin.dconfig.json") +file(GLOB DCONFIG_FILES "org.deepin.dock.plugin.json") dconfig_meta_files(APPID dde-control-center FILES ${DCONFIG_FILES}) install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-control-center/modules) diff --git a/plugins/dcc-dock-plugin/module_widget.cpp b/plugins/dcc-dock-plugin/module_widget.cpp index 6a07361e2..4cfb6f0e8 100644 --- a/plugins/dcc-dock-plugin/module_widget.cpp +++ b/plugins/dcc-dock-plugin/module_widget.cpp @@ -74,7 +74,7 @@ ModuleWidget::ModuleWidget(QWidget *parent) , m_pluginModel(new QStandardItemModel(this)) , m_daemonDockInter(new DBusDock("com.deepin.dde.daemon.Dock", "/com/deepin/dde/daemon/Dock", QDBusConnection::sessionBus(), this)) , m_dockInter(new DBusInter("com.deepin.dde.Dock", "/com/deepin/dde/Dock", QDBusConnection::sessionBus(), this)) - , m_dconfigWatcher(new ConfigWatcher("dde.dock.plugin.dconfig", this)) + , m_dconfigWatcher(new ConfigWatcher("org.deepin.dock.plugin", this)) , m_sliderPressed(false) { //~ contents_path /personalization/Dock @@ -132,7 +132,7 @@ void ModuleWidget::initUI() m_modeComboxWidget->setCurrentText(g_modeMap.key(mode)); }); layout->addWidget(m_modeComboxWidget); - m_dconfigWatcher->bind("Control-Center_Dock_Model", m_modeComboxWidget); + m_dconfigWatcher->bind("dockModel", m_modeComboxWidget); } else { m_modeComboxWidget->setVisible(false); } @@ -161,7 +161,7 @@ void ModuleWidget::initUI() m_positionComboxWidget->setCurrentText(g_positionMap.key(pos)); }); layout->addWidget(m_positionComboxWidget); - m_dconfigWatcher->bind("Control-Center_Dock_Location", m_positionComboxWidget); + m_dconfigWatcher->bind("dockLocation", m_positionComboxWidget); } else { m_positionComboxWidget->setVisible(false); } @@ -189,7 +189,7 @@ void ModuleWidget::initUI() m_stateComboxWidget->setCurrentText(g_stateMap.key(mode)); }); layout->addWidget(m_stateComboxWidget); - m_dconfigWatcher->bind("Control-Center_Dock_State", m_stateComboxWidget); + m_dconfigWatcher->bind("dockState", m_stateComboxWidget); } else { m_stateComboxWidget->setVisible(false); } @@ -223,7 +223,7 @@ void ModuleWidget::initUI() }); updateSliderValue(); - m_dconfigWatcher->bind("Control-Center_Dock_Size", m_sizeSlider); + m_dconfigWatcher->bind("dockSize", m_sizeSlider); layout->addWidget(m_sizeSlider); @@ -263,8 +263,8 @@ void ModuleWidget::initUI() m_screenSettingComboxWidget->blockSignals(false); }); layout->addWidget(m_screenSettingComboxWidget); - m_dconfigWatcher->bind("Control-Center_Dock_Multi-screen", m_screenSettingTitle); - m_dconfigWatcher->bind("Control-Center_Dock_Multi-screen", m_screenSettingComboxWidget); + m_dconfigWatcher->bind("multiscreen", m_screenSettingTitle); + m_dconfigWatcher->bind("multiscreen", m_screenSettingComboxWidget); } else { m_screenSettingTitle->setVisible(false); m_screenSettingComboxWidget->setVisible(false); @@ -293,7 +293,7 @@ void ModuleWidget::initUI() if (plugins.size() != 0) { layout->addSpacing(10); layout->addWidget(m_pluginAreaTitle); - m_dconfigWatcher->bind("Control-Center_Dock_Plugins", m_pluginAreaTitle); + m_dconfigWatcher->bind("dockPlugins", m_pluginAreaTitle); DFontSizeManager::instance()->bind(m_pluginTips, DFontSizeManager::T8); m_pluginTips->adjustSize(); @@ -301,7 +301,7 @@ void ModuleWidget::initUI() m_pluginTips->setContentsMargins(10, 5, 10, 5); m_pluginTips->setAlignment(Qt::AlignLeft); layout->addWidget(m_pluginTips); - m_dconfigWatcher->bind("Control-Center_Dock_Plugins", m_pluginTips); + m_dconfigWatcher->bind("dockPlugins", m_pluginTips); m_pluginView->setAccessibleName("pluginList"); m_pluginView->setBackgroundType(DStyledItemDelegate::BackgroundType::ClipCornerBackground); @@ -325,7 +325,7 @@ void ModuleWidget::initUI() m_pluginView->setModel(m_pluginModel); layout->addWidget(m_pluginView); - m_dconfigWatcher->bind("Control-Center_Dock_Plugins", m_pluginView); + m_dconfigWatcher->bind("dockPlugins", m_pluginView); for (auto name : plugins) { DStandardItem *item = new DStandardItem(name); diff --git a/plugins/dcc-dock-plugin/dde.dock.plugin.dconfig.json b/plugins/dcc-dock-plugin/org.deepin.dock.plugin.json similarity index 82% rename from plugins/dcc-dock-plugin/dde.dock.plugin.dconfig.json rename to plugins/dcc-dock-plugin/org.deepin.dock.plugin.json index 2400142eb..565c10e2d 100644 --- a/plugins/dcc-dock-plugin/dde.dock.plugin.dconfig.json +++ b/plugins/dcc-dock-plugin/org.deepin.dock.plugin.json @@ -2,71 +2,71 @@ "magic":"dsg.config.meta", "version":"1.0", "contents":{ - "Control-Center_Dock_Model":{ + "dockModel":{ "value":"Enabled", "serial":0, - "flags":"", + "flags":[], "name":"Model", "name[zh_CN]":"模式", "description[zh_CN]":"此配置为模式选择功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description":"", "permissions":"readwrite", - "visibility":"public" + "visibility":"private" }, - "Control-Center_Dock_Location":{ + "dockLocation":{ "value":"Enabled", "serial":0, - "flags":"", + "flags":[], "name":"Location", "name[zh_CN]":"位置", "description[zh_CN]":"此配置为位置选择功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description":"", "permissions":"readwrite", - "visibility":"public" + "visibility":"private" }, - "Control-Center_Dock_State":{ + "dockState":{ "value":"Enabled", "serial":0, - "flags":"", + "flags":[], "name":"State", "name[zh_CN]":"状态", "description[zh_CN]":"此配置为状态选择功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description":"", "permissions":"readwrite", - "visibility":"public" + "visibility":"private" }, - "Control-Center_Dock_Size":{ + "dockSize":{ "value":"Enabled", "serial":0, - "flags":"", + "flags":[], "name":"Size", "name[zh_CN]":"调整大小", "description[zh_CN]":"此配置为调整大小功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description":"", "permissions":"readwrite", - "visibility":"public" + "visibility":"private" }, - "Control-Center_Dock_Multi-screen":{ + "multiscreen":{ "value":"Enabled", "serial":0, - "flags":"", + "flags":[], "name":"Multi-screen", "name[zh_CN]":"多屏显示设置", "description[zh_CN]":"此配置为多屏显示设置项功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description":"", "permissions":"readwrite", - "visibility":"public" + "visibility":"private" }, - "Control-Center_Dock_Plugins":{ + "dockPlugins":{ "value":"Enabled", "serial":0, - "flags":"", + "flags":[], "name":"Plugins", "name[zh_CN]":"插件", "description[zh_CN]":"此配置为插件显示功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description":"", "permissions":"readwrite", - "visibility":"public" + "visibility":"private" } } } \ No newline at end of file diff --git a/plugins/dcc-dock-plugin/settings_module.cpp b/plugins/dcc-dock-plugin/settings_module.cpp index 9483ab447..1986ea960 100644 --- a/plugins/dcc-dock-plugin/settings_module.cpp +++ b/plugins/dcc-dock-plugin/settings_module.cpp @@ -34,7 +34,7 @@ SettingsModule::SettingsModule() : QObject() , ModuleInterface() , m_moduleWidget(nullptr) - , m_config(new DConfig("dde.dock.plugin.dconfig", QString(), this)) + , m_config(new DConfig("org.deepin.dock.plugin", QString(), this)) { QTranslator *translator = new QTranslator(this); translator->load(QString("/usr/share/dcc-dock-plugin/translations/dcc-dock-plugin_%1.qm").arg(QLocale::system().name())); @@ -141,11 +141,11 @@ void SettingsModule::onStatusChanged() }; // 三级菜单显示状态设置 - m_frameProxy->setDetailVisible(module, dock, tr("Mode"), visibleState("Control-Center_Dock_Model")); - m_frameProxy->setDetailVisible(module, dock, tr("Location"), visibleState("Control-Center_Dock_Location")); - m_frameProxy->setDetailVisible(module, dock, tr("Status"), visibleState("Control-Center_Dock_State")); - m_frameProxy->setDetailVisible(module, dock, tr("Size"), visibleState("Control-Center_Dock_Size")); - m_frameProxy->setDetailVisible(module, dock, tr("Show Dock"), visibleState("Control-Center_Dock_Multi-screen")); - m_frameProxy->setDetailVisible(module, dock, tr("Plugin Area"), visibleState("Control-Center_Dock_Plugins")); + m_frameProxy->setDetailVisible(module, dock, tr("Mode"), visibleState("dockModel")); + m_frameProxy->setDetailVisible(module, dock, tr("Location"), visibleState("dockLocation")); + m_frameProxy->setDetailVisible(module, dock, tr("Status"), visibleState("dockState")); + m_frameProxy->setDetailVisible(module, dock, tr("Size"), visibleState("dockSize")); + m_frameProxy->setDetailVisible(module, dock, tr("Show Dock"), visibleState("multiscreen")); + m_frameProxy->setDetailVisible(module, dock, tr("Plugin Area"), visibleState("dockPlugins")); m_frameProxy->updateSearchData(module); } diff --git a/tests/plugins/dcc-dock-settings-plugin/ut_gsettings_watcher.cpp b/tests/plugins/dcc-dock-settings-plugin/ut_gsettings_watcher.cpp index 8c262d744..b3a92983a 100644 --- a/tests/plugins/dcc-dock-settings-plugin/ut_gsettings_watcher.cpp +++ b/tests/plugins/dcc-dock-settings-plugin/ut_gsettings_watcher.cpp @@ -11,11 +11,11 @@ class Test_GSettingWatcher : public QObject, public ::testing::Test TEST_F(Test_GSettingWatcher, bind) { - ConfigWatcher watcher("dde.dock.plugin.dconfig"); + ConfigWatcher watcher("org.deepin.dock.plugin"); QWidget widget; - watcher.bind("Control-Center_Dock_Plugins", &widget); - watcher.bind("Control-Center_Dock_Plugins", nullptr); + watcher.bind("dockPlugins", &widget); + watcher.bind("dockPlugins", nullptr); watcher.bind("invalid", &widget); watcher.bind("", &widget); watcher.bind("", nullptr); @@ -23,20 +23,20 @@ TEST_F(Test_GSettingWatcher, bind) TEST_F(Test_GSettingWatcher, setStatus) { - ConfigWatcher watcher("dde.dock.plugin.dconfig"); + ConfigWatcher watcher("org.deepin.dock.plugin"); QWidget widget; - watcher.bind("Control-Center_Dock_Plugins", &widget); - watcher.setStatus("Control-Center_Dock_Plugins", &widget); + watcher.bind("dockPlugins", &widget); + watcher.setStatus("dockPlugins", &widget); } TEST_F(Test_GSettingWatcher, onStatusModeChanged) { - ConfigWatcher watcher("dde.dock.plugin.dconfig"); + ConfigWatcher watcher("org.deepin.dock.plugin"); QWidget widget; - watcher.bind("Control-Center_Dock_Plugins", &widget); - watcher.onStatusModeChanged("Control-Center_Dock_Plugins"); + watcher.bind("dockPlugins", &widget); + watcher.onStatusModeChanged("dockPlugins"); watcher.onStatusModeChanged("invalid"); watcher.onStatusModeChanged(""); }