Commit Graph

12 Commits

Author SHA1 Message Date
YeShanShan 271edf81b1 feat: Add isDefaultValue for DConfig
Add isDefaultValue function.

Issue: https://github.com/linuxdeepin/dtk/issues/3
2023-09-15 16:55:13 +08:00
ck 0ef910387a chore: add some unit test
- DDBusInterface DNotifySender DDBusExtendedAbstractInterface
- DExpected && DError
- DSysInfo/DLicenseInfo/DSingleton ut split from ut_dutil.cpp
- DSGApplication DStandardPaths DCapManager
- DThreadUtils warnings
- DLogManager
2023-07-21 10:45:08 +08:00
yeshanshan 072dd9562d
feat: Add generic configuration support for DConfig (#236)
All application can use same configuration by generic
  configuration.
    Loading cache file can fallback to noappid's directory when not
using appid or not find cache file.
    one application writes configuration.
    ```c++
    auto config = DConfig::createGeneric(FileName);
    config->setValue("common-configuration", true);
    ```
    other applications read configration can give appid or not to
get the configuration.

    Set empty string for DBus caller when using acquireManager.

Log: 配置策略支持应用无关配置,缓存精准匹配到meta是否使用appid
Influence: none

Change-Id: I78b331f9c455617d5dfea6df087b1f4828390974
2023-02-16 09:41:28 +00:00
guoyao c6629ebb55 chore: adapt REUSE license header
开源合规

Log: 开源合规
2022-08-11 14:02:36 +08:00
Ye ShanShan a54b317ca5 fix: application crash when dconfig is invalid
Add invalid check for all DConfig's method(avoid null pointer dereference).
fallback to FileBackend when DBusBackend can't be created.

set correct environment value in unit test.

Log:
Influence: all application crash when dconfig is invalid but still
call other method expect isValid.

Change-Id: I7395f44518989cb14a09306fcfd4db380608a24e
2022-05-10 20:38:39 +08:00
Ye ShanShan 4d0cb3fc1b fix: modify loading order of application meta path
for application meta path loads order change from
/usr/share/dsg/apps/${appid}/confgis to
/usr/share/dsg/configs/${appid} or /usr/share/dsg/configs;
replace DStandardPaths::paths to DStandardPaths::path.
modify saved path。

Log:
Influence: all application's configuration would not be loaded
unless updating dtkcommon and it's application package.

Change-Id: Ia8212618fd2d4a5ecf67f05aad32a92d934ea01d
2022-04-11 16:53:06 +08:00
Ye ShanShan 72cc33ec0a feat: Add interface for Dconfig
add reset function;
add Dconfig construct containing appId, to keep compatible,we use
a static function to avoid ambiguous, construct function calls
no appid's. it is useful to access other application's configure
timely in DBusBackend.

Log:
Influence: user can access other application's configure and
reset value for the key.

Change-Id: Id707a96ba1216b406b5c6f724ba5d715cfb053db
2022-04-11 16:48:54 +08:00
Ye ShanShan 3c80a88052 fix: Can't access QStringList type data for DConfig
it's occur in DBusBackend, and we directly to get meta value that not
exist cache.
normal value type is automatic casted from QDBusVariant to QVariant,
and QVariantList type need to cast explicitly, it's value type is
QDBusArgument.
because our data store backend is using QJsonValue to resolve, so
we only case QVariantList and QVariantMap, it maybe error in lastly.

Log: 
Influence: DConfig is not access stringlist data type.
Change-Id: I81dbc2ea6b7933154d26ddba70def95ef79240d6
2022-04-11 16:47:38 +08:00
zorowk 3891b1bdae fix: ut link error in dtk.
the member definition need to be separate in some build environment.

Log:
Influence: build error.
Signed-off-by: zorowk <pengwenhao@uniontech.com>
Change-Id: Idd982f0e0a17efa50e170c4590c83ea75abaa031
2022-04-11 16:32:43 +08:00
Ye ShanShan b5de9328a2 fix: modify loading order of application meta path
for application meta path loads order change from
/usr/share/dsg/apps/${appid}/confgis to
/usr/share/dsg/configs/${appid} or /usr/share/dsg/configs;
replace DStandardPaths::paths to DStandardPaths::path.
modify saved path。

Log:
Influence: all application's configuration would not be loaded
unless updating dtkcommon and it's application package.

Change-Id: Ia8212618fd2d4a5ecf67f05aad32a92d934ea01d
2022-03-12 12:34:37 +08:00
Ye ShanShan 592f0e3acb fix: ut link error in community.
the member definition need to be separate in some build environment.

Log: 
Influence: build error in community.
Change-Id: Ia1724f44ee1cd7a27a067f128f9c0da93656ec7a
2021-11-25 18:54:56 +08:00
Ye ShanShan 23beccfc00 refactor: 重构DConf Class并适配DBus service开发。
重构DConfig类的实现,按类型处理不同的程序配置实现;
调整DConfig class接口来适配dbusservice开发;
添加客户端请求资源释放请求;
增加通过环境变量来初始化后端类型;
修改翻译解析方式;
添加单元测试;
loadOverride函数的局部变量path名称与成员变量因同名被隐藏。

Log: 
Change-Id: I48206c666068e8a85feca6a35639059fc6112be0
2021-10-14 15:35:42 +08:00