feat: add xsettings plugin implementation - #35
Merged
Merged
Conversation
caixr23
force-pushed
the
master
branch
4 times, most recently
from
December 4, 2025 07:23
30890ee to
b2924f6
Compare
1. Added new xsettings plugin module for deepin-service-manager 2. Implemented XSettings protocol support with DConfig integration 3. Added XCB utilities for X11 property management 4. Implemented scale factor management and DPI calculation 5. Added Firefox DPI configuration support 6. Included Plymouth theme scaling support 7. Added comprehensive configuration file handling Log: Added XSettings plugin for system configuration management Influence: 1. Test XSettings property retrieval and modification via D-Bus 2. Verify scale factor changes affect system DPI and cursor size 3. Check Firefox DPI configuration updates 4. Test Plymouth theme scaling during boot 5. Verify XResources updates for cursor theme and DPI settings 6. Test individual screen scaling factors configuration 7. Validate configuration file persistence and error handling feat: 添加 xsettings 插件实现 1. 新增 deepin-service-manager 的 xsettings 插件模块 2. 实现 XSettings 协议支持并与 DConfig 集成 3. 添加 XCB 工具类用于 X11 属性管理 4. 实现缩放因子管理和 DPI 计算 5. 添加 Firefox DPI 配置支持 6. 包含 Plymouth 主题缩放支持 7. 添加完整的配置文件处理功能 Log: 新增系统配置管理的 XSettings 插件 Influence: 1. 测试通过 D-Bus 获取和修改 XSettings 属性 2. 验证缩放因子变化对系统 DPI 和光标大小的影响 3. 检查 Firefox DPI 配置更新 4. 测试启动时 Plymouth 主题缩放效果 5. 验证光标主题和 DPI 设置的 XResources 更新 6. 测试独立屏幕缩放因子配置 7. 验证配置文件持久化和错误处理 PMS: TASK-381269
deepin pr auto review我来对这个代码变更进行审查。这是一个新的xsettings插件的实现,主要包含配置管理、X11设置处理、缩放因子管理等功能。我将从多个角度进行分析:
具体改进建议:
// XcbUtils.h
class XcbUtils {
private:
static std::mutex instanceMutex;
static XcbUtils* instance;
public:
static XcbUtils& getInstance() {
std::lock_guard<std::mutex> lock(instanceMutex);
if (!instance) {
instance = new XcbUtils();
}
return *instance;
}
};
class DconfInfos {
private:
QMap<QString, QSharedPointer<DconfInfo>> dconfKeyMap;
QMap<QString, QSharedPointer<DconfInfo>> xsKeyMap;
public:
QSharedPointer<DconfInfo> getByDconfKey(const QString &dconfKey) {
return dconfKeyMap.value(dconfKey);
}
};
bool XSettingsManager::updateFirefoxDPI() {
try {
QString homeDir = Utils::getUserHomeDir();
if (homeDir.isEmpty()) {
qWarning() << "Failed to get user home directory";
return false;
}
// ... 其他代码
} catch (const std::exception& e) {
qCritical() << "Error updating Firefox DPI:" << e.what();
return false;
}
return true;
}
bool XSettingsManager::setString(const QString &prop, const QString &v) {
if (!hasWritePermission()) {
qWarning() << "No write permission for property:" << prop;
return false;
}
// ... 其他代码
}
void XSettingsManager::updateGreeterQtTheme(KeyFile &keyFile) {
QFile file("/tmp/startdde-qt-theme-");
if (!file.open(QIODevice::ReadWrite)) {
qWarning() << "Failed to open temporary file:" << file.errorString();
return;
}
// 使用QSaveFile确保原子性写入
QSaveFile saveFile(file.fileName());
if (!saveFile.open(QIODevice::WriteOnly)) {
qWarning() << "Failed to open save file:" << saveFile.errorString();
return;
}
// ... 写入操作
if (!saveFile.commit()) {
qWarning() << "Failed to save file:" << saveFile.errorString();
return;
}
}
bool XSettingsManager::validateConfig(const QString& configPath) {
QFileInfo info(configPath);
if (!info.exists() || !info.isReadable()) {
qWarning() << "Config file is not accessible:" << configPath;
return false;
}
if (info.size() > MAX_CONFIG_SIZE) {
qWarning() << "Config file too large:" << configPath;
return false;
}
return true;
}
class XSettingsManager {
private:
QThreadPool workerPool;
public:
XSettingsManager(QObject *parent)
: QObject(parent)
, workerPool(this) // 设置父对象,确保自动清理
{
workerPool.setMaxThreadCount(1);
// ... 其他初始化代码
}
~XSettingsManager() {
workerPool.waitForDone(5000); // 等待任务完成
}
};
class XSettingsManager {
private:
void logOperation(const QString& operation, const QString& details) {
QLoggingCategory category("xsettings");
qCDebug(category) << operation << ":" << details;
}
};这些改进建议主要关注代码的健壮性、安全性和性能。建议分阶段实施这些改进,优先处理线程安全和错误处理相关的问题。 |
fly602
approved these changes
Dec 4, 2025
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: caixr23, fly602 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/forcemerge |
|
This pr force merged! (status: blocked) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log: Added XSettings plugin for system configuration management
Influence:
feat: 添加 xsettings 插件实现
Log: 新增系统配置管理的 XSettings 插件
Influence:
PMS: TASK-381269