mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
feat: 配置项规范化
配置项规范化 Log: Influence: 无 Task: https://pms.uniontech.com/task-view-104239.html Change-Id: I08595e09292e055396c18998d035fde1f2223482
This commit is contained in:
parent
627422b0b6
commit
acff30b1e8
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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("");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user