feat: 配置项规范化

配置项规范化

Log:
Influence: 无
Task: https://pms.uniontech.com/task-view-104239.html
Change-Id: I08595e09292e055396c18998d035fde1f2223482
This commit is contained in:
Fan PengCheng 2022-03-11 21:38:12 +08:00
parent 627422b0b6
commit acff30b1e8
7 changed files with 51 additions and 51 deletions

View File

@ -2,10 +2,10 @@
"magic":"dsg.config.meta", "magic":"dsg.config.meta",
"version":"1.0", "version":"1.0",
"contents":{ "contents":{
"Dock_Show_Window_name":{ "showWindowName":{
"value":0, "value":0,
"serial":0, "serial":0,
"flags":"", "flags":[],
"name":"小窗口显示窗口名称", "name":"小窗口显示窗口名称",
"name[zh_CN]":"小窗口显示窗口名称", "name[zh_CN]":"小窗口显示窗口名称",
"description[zh_CN]":" \ "description[zh_CN]":" \
@ -14,7 +14,7 @@
", ",
"description":"0 Mouse over show;1 Always show; 2 Always hide", "description":"0 Mouse over show;1 Always show; 2 Always hide",
"permissions":"readwrite", "permissions":"readwrite",
"visibility":"public" "visibility":"private"
} }
} }
} }

View File

@ -667,9 +667,9 @@ void AppItem::showPreview()
connect(m_appPreviewTips, &PreviewContainer::requestHidePopup, this, &AppItem::onResetPreview); connect(m_appPreviewTips, &PreviewContainer::requestHidePopup, this, &AppItem::onResetPreview);
// 预览标题显示方式的配置 // 预览标题显示方式的配置
DConfig config(QString("com.deepin.dde.dock.dconfig"), QString()); DConfig config(QString("org.deepin.dock"), QString());
if (config.isValid() && config.keyList().contains("Dock_Show_Window_name")) if (config.isValid() && config.keyList().contains("showWindowName"))
m_appPreviewTips->setTitleDisplayMode(config.value("Dock_Show_Window_name").toInt()); m_appPreviewTips->setTitleDisplayMode(config.value("showWindowName").toInt());
showPopupWindow(m_appPreviewTips, true); showPopupWindow(m_appPreviewTips, true);
} }

View File

@ -47,7 +47,7 @@ add_custom_target(translations ALL DEPENDS ${QM_FILES})
install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations) install(FILES ${QM_FILES} DESTINATION share/${PLUGIN_NAME}/translations)
# dconfig # 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}) dconfig_meta_files(APPID dde-control-center FILES ${DCONFIG_FILES})
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-control-center/modules) install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-control-center/modules)

View File

@ -74,7 +74,7 @@ ModuleWidget::ModuleWidget(QWidget *parent)
, m_pluginModel(new QStandardItemModel(this)) , m_pluginModel(new QStandardItemModel(this))
, m_daemonDockInter(new DBusDock("com.deepin.dde.daemon.Dock", "/com/deepin/dde/daemon/Dock", QDBusConnection::sessionBus(), 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_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) , m_sliderPressed(false)
{ {
//~ contents_path /personalization/Dock //~ contents_path /personalization/Dock
@ -132,7 +132,7 @@ void ModuleWidget::initUI()
m_modeComboxWidget->setCurrentText(g_modeMap.key(mode)); m_modeComboxWidget->setCurrentText(g_modeMap.key(mode));
}); });
layout->addWidget(m_modeComboxWidget); layout->addWidget(m_modeComboxWidget);
m_dconfigWatcher->bind("Control-Center_Dock_Model", m_modeComboxWidget); m_dconfigWatcher->bind("dockModel", m_modeComboxWidget);
} else { } else {
m_modeComboxWidget->setVisible(false); m_modeComboxWidget->setVisible(false);
} }
@ -161,7 +161,7 @@ void ModuleWidget::initUI()
m_positionComboxWidget->setCurrentText(g_positionMap.key(pos)); m_positionComboxWidget->setCurrentText(g_positionMap.key(pos));
}); });
layout->addWidget(m_positionComboxWidget); layout->addWidget(m_positionComboxWidget);
m_dconfigWatcher->bind("Control-Center_Dock_Location", m_positionComboxWidget); m_dconfigWatcher->bind("dockLocation", m_positionComboxWidget);
} else { } else {
m_positionComboxWidget->setVisible(false); m_positionComboxWidget->setVisible(false);
} }
@ -189,7 +189,7 @@ void ModuleWidget::initUI()
m_stateComboxWidget->setCurrentText(g_stateMap.key(mode)); m_stateComboxWidget->setCurrentText(g_stateMap.key(mode));
}); });
layout->addWidget(m_stateComboxWidget); layout->addWidget(m_stateComboxWidget);
m_dconfigWatcher->bind("Control-Center_Dock_State", m_stateComboxWidget); m_dconfigWatcher->bind("dockState", m_stateComboxWidget);
} else { } else {
m_stateComboxWidget->setVisible(false); m_stateComboxWidget->setVisible(false);
} }
@ -223,7 +223,7 @@ void ModuleWidget::initUI()
}); });
updateSliderValue(); updateSliderValue();
m_dconfigWatcher->bind("Control-Center_Dock_Size", m_sizeSlider); m_dconfigWatcher->bind("dockSize", m_sizeSlider);
layout->addWidget(m_sizeSlider); layout->addWidget(m_sizeSlider);
@ -263,8 +263,8 @@ void ModuleWidget::initUI()
m_screenSettingComboxWidget->blockSignals(false); m_screenSettingComboxWidget->blockSignals(false);
}); });
layout->addWidget(m_screenSettingComboxWidget); layout->addWidget(m_screenSettingComboxWidget);
m_dconfigWatcher->bind("Control-Center_Dock_Multi-screen", m_screenSettingTitle); m_dconfigWatcher->bind("multiscreen", m_screenSettingTitle);
m_dconfigWatcher->bind("Control-Center_Dock_Multi-screen", m_screenSettingComboxWidget); m_dconfigWatcher->bind("multiscreen", m_screenSettingComboxWidget);
} else { } else {
m_screenSettingTitle->setVisible(false); m_screenSettingTitle->setVisible(false);
m_screenSettingComboxWidget->setVisible(false); m_screenSettingComboxWidget->setVisible(false);
@ -293,7 +293,7 @@ void ModuleWidget::initUI()
if (plugins.size() != 0) { if (plugins.size() != 0) {
layout->addSpacing(10); layout->addSpacing(10);
layout->addWidget(m_pluginAreaTitle); 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); DFontSizeManager::instance()->bind(m_pluginTips, DFontSizeManager::T8);
m_pluginTips->adjustSize(); m_pluginTips->adjustSize();
@ -301,7 +301,7 @@ void ModuleWidget::initUI()
m_pluginTips->setContentsMargins(10, 5, 10, 5); m_pluginTips->setContentsMargins(10, 5, 10, 5);
m_pluginTips->setAlignment(Qt::AlignLeft); m_pluginTips->setAlignment(Qt::AlignLeft);
layout->addWidget(m_pluginTips); 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->setAccessibleName("pluginList");
m_pluginView->setBackgroundType(DStyledItemDelegate::BackgroundType::ClipCornerBackground); m_pluginView->setBackgroundType(DStyledItemDelegate::BackgroundType::ClipCornerBackground);
@ -325,7 +325,7 @@ void ModuleWidget::initUI()
m_pluginView->setModel(m_pluginModel); m_pluginView->setModel(m_pluginModel);
layout->addWidget(m_pluginView); layout->addWidget(m_pluginView);
m_dconfigWatcher->bind("Control-Center_Dock_Plugins", m_pluginView); m_dconfigWatcher->bind("dockPlugins", m_pluginView);
for (auto name : plugins) { for (auto name : plugins) {
DStandardItem *item = new DStandardItem(name); DStandardItem *item = new DStandardItem(name);

View File

@ -2,71 +2,71 @@
"magic":"dsg.config.meta", "magic":"dsg.config.meta",
"version":"1.0", "version":"1.0",
"contents":{ "contents":{
"Control-Center_Dock_Model":{ "dockModel":{
"value":"Enabled", "value":"Enabled",
"serial":0, "serial":0,
"flags":"", "flags":[],
"name":"Model", "name":"Model",
"name[zh_CN]":"模式", "name[zh_CN]":"模式",
"description[zh_CN]":"此配置为模式选择功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description[zh_CN]":"此配置为模式选择功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;",
"description":"", "description":"",
"permissions":"readwrite", "permissions":"readwrite",
"visibility":"public" "visibility":"private"
}, },
"Control-Center_Dock_Location":{ "dockLocation":{
"value":"Enabled", "value":"Enabled",
"serial":0, "serial":0,
"flags":"", "flags":[],
"name":"Location", "name":"Location",
"name[zh_CN]":"位置", "name[zh_CN]":"位置",
"description[zh_CN]":"此配置为位置选择功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description[zh_CN]":"此配置为位置选择功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;",
"description":"", "description":"",
"permissions":"readwrite", "permissions":"readwrite",
"visibility":"public" "visibility":"private"
}, },
"Control-Center_Dock_State":{ "dockState":{
"value":"Enabled", "value":"Enabled",
"serial":0, "serial":0,
"flags":"", "flags":[],
"name":"State", "name":"State",
"name[zh_CN]":"状态", "name[zh_CN]":"状态",
"description[zh_CN]":"此配置为状态选择功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description[zh_CN]":"此配置为状态选择功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;",
"description":"", "description":"",
"permissions":"readwrite", "permissions":"readwrite",
"visibility":"public" "visibility":"private"
}, },
"Control-Center_Dock_Size":{ "dockSize":{
"value":"Enabled", "value":"Enabled",
"serial":0, "serial":0,
"flags":"", "flags":[],
"name":"Size", "name":"Size",
"name[zh_CN]":"调整大小", "name[zh_CN]":"调整大小",
"description[zh_CN]":"此配置为调整大小功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description[zh_CN]":"此配置为调整大小功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;",
"description":"", "description":"",
"permissions":"readwrite", "permissions":"readwrite",
"visibility":"public" "visibility":"private"
}, },
"Control-Center_Dock_Multi-screen":{ "multiscreen":{
"value":"Enabled", "value":"Enabled",
"serial":0, "serial":0,
"flags":"", "flags":[],
"name":"Multi-screen", "name":"Multi-screen",
"name[zh_CN]":"多屏显示设置", "name[zh_CN]":"多屏显示设置",
"description[zh_CN]":"此配置为多屏显示设置项功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description[zh_CN]":"此配置为多屏显示设置项功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;",
"description":"", "description":"",
"permissions":"readwrite", "permissions":"readwrite",
"visibility":"public" "visibility":"private"
}, },
"Control-Center_Dock_Plugins":{ "dockPlugins":{
"value":"Enabled", "value":"Enabled",
"serial":0, "serial":0,
"flags":"", "flags":[],
"name":"Plugins", "name":"Plugins",
"name[zh_CN]":"插件", "name[zh_CN]":"插件",
"description[zh_CN]":"此配置为插件显示功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;", "description[zh_CN]":"此配置为插件显示功能的是否启用,默认为启用;当配置为启用时,该设置项可以设置;当配置为禁用时,该设置项置灰;当配置为隐藏时,该设置项隐藏;",
"description":"", "description":"",
"permissions":"readwrite", "permissions":"readwrite",
"visibility":"public" "visibility":"private"
} }
} }
} }

View File

@ -34,7 +34,7 @@ SettingsModule::SettingsModule()
: QObject() : QObject()
, ModuleInterface() , ModuleInterface()
, m_moduleWidget(nullptr) , 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); QTranslator *translator = new QTranslator(this);
translator->load(QString("/usr/share/dcc-dock-plugin/translations/dcc-dock-plugin_%1.qm").arg(QLocale::system().name())); 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("Mode"), visibleState("dockModel"));
m_frameProxy->setDetailVisible(module, dock, tr("Location"), visibleState("Control-Center_Dock_Location")); m_frameProxy->setDetailVisible(module, dock, tr("Location"), visibleState("dockLocation"));
m_frameProxy->setDetailVisible(module, dock, tr("Status"), visibleState("Control-Center_Dock_State")); m_frameProxy->setDetailVisible(module, dock, tr("Status"), visibleState("dockState"));
m_frameProxy->setDetailVisible(module, dock, tr("Size"), visibleState("Control-Center_Dock_Size")); m_frameProxy->setDetailVisible(module, dock, tr("Size"), visibleState("dockSize"));
m_frameProxy->setDetailVisible(module, dock, tr("Show Dock"), visibleState("Control-Center_Dock_Multi-screen")); m_frameProxy->setDetailVisible(module, dock, tr("Show Dock"), visibleState("multiscreen"));
m_frameProxy->setDetailVisible(module, dock, tr("Plugin Area"), visibleState("Control-Center_Dock_Plugins")); m_frameProxy->setDetailVisible(module, dock, tr("Plugin Area"), visibleState("dockPlugins"));
m_frameProxy->updateSearchData(module); m_frameProxy->updateSearchData(module);
} }

View File

@ -11,11 +11,11 @@ class Test_GSettingWatcher : public QObject, public ::testing::Test
TEST_F(Test_GSettingWatcher, bind) TEST_F(Test_GSettingWatcher, bind)
{ {
ConfigWatcher watcher("dde.dock.plugin.dconfig"); ConfigWatcher watcher("org.deepin.dock.plugin");
QWidget widget; QWidget widget;
watcher.bind("Control-Center_Dock_Plugins", &widget); watcher.bind("dockPlugins", &widget);
watcher.bind("Control-Center_Dock_Plugins", nullptr); watcher.bind("dockPlugins", nullptr);
watcher.bind("invalid", &widget); watcher.bind("invalid", &widget);
watcher.bind("", &widget); watcher.bind("", &widget);
watcher.bind("", nullptr); watcher.bind("", nullptr);
@ -23,20 +23,20 @@ TEST_F(Test_GSettingWatcher, bind)
TEST_F(Test_GSettingWatcher, setStatus) TEST_F(Test_GSettingWatcher, setStatus)
{ {
ConfigWatcher watcher("dde.dock.plugin.dconfig"); ConfigWatcher watcher("org.deepin.dock.plugin");
QWidget widget; QWidget widget;
watcher.bind("Control-Center_Dock_Plugins", &widget); watcher.bind("dockPlugins", &widget);
watcher.setStatus("Control-Center_Dock_Plugins", &widget); watcher.setStatus("dockPlugins", &widget);
} }
TEST_F(Test_GSettingWatcher, onStatusModeChanged) TEST_F(Test_GSettingWatcher, onStatusModeChanged)
{ {
ConfigWatcher watcher("dde.dock.plugin.dconfig"); ConfigWatcher watcher("org.deepin.dock.plugin");
QWidget widget; QWidget widget;
watcher.bind("Control-Center_Dock_Plugins", &widget); watcher.bind("dockPlugins", &widget);
watcher.onStatusModeChanged("Control-Center_Dock_Plugins"); watcher.onStatusModeChanged("dockPlugins");
watcher.onStatusModeChanged("invalid"); watcher.onStatusModeChanged("invalid");
watcher.onStatusModeChanged(""); watcher.onStatusModeChanged("");
} }