Commit Graph

134 Commits

Author SHA1 Message Date
wangfei 9c3e18ebf3 chore: add flag UserPublic
add flag UserPublic to Meta file for managing permission among users.

Issue: https://github.com/linuxdeepin/developer-center/issues/5928
2023-10-23 10:26:11 +08:00
ck 844a68df95 fix(build): skip failed unit test
- gsettings schema remvove from dtkcommon, Skip
- if DSYSINFO_PREFIX empty, Skip
- add_definitions ==> target_compile_definitions
- setting cache variable move to dtkcore.cmake
2023-09-19 16:56:18 +08:00
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 b9cf2a22be chore: tweak CMakeLists
- use DtkBuildHelper functions
- tests/CMakeLists.txt tweak
2023-08-16 09:28:02 +08:00
ck 4c50be9afb chore: ut linked dtkcore instead of source code
- use linked dtkcore target instead of source code
- test-revoverage.sh tweak
- setup_code_coverage && check_and_add_definitions functions(will move to dtkcommon)
2023-08-15 15:17:32 +08:00
ck 5e2b16c51f fix: FileAppender log level not set
log level not set, spdlog default is Info
fix FileAppender ut failed
2023-08-14 17:22:26 +08:00
ck 24a29a0f9f feat: use spdlog reimplement dlog
reimplement dlog
use `DLogHelper` instead of `CuteMessageLogger` `LoggerTimingHelper`
keep CuteMessage symbol for compatibility (fix undefined symbol: _ZNK3Dtk4Core17CuteMessageLogger5writeEPKcz)
2023-08-14 09:00:43 +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
ck 3a661dfff0 chore: add ut for DDbusSender
- tweek FakeDBusService. add method and read/write propery
- test DDbusSender. call dbus method and get/set dbus property
2023-07-11 13:30:15 +08:00
ck d0b7680edb chore: make test-recoverage.sh runable again
- set -e : exit if command has a non-zero exit status
- fix test target name ut-DtkCore
2023-07-11 13:30:15 +08:00
ck 868218a1db refactor!: deprecate some interfaces in dtk6
- dconfig_meta_files/dconfig_override_files remove in dtk6
- not install deprecated class headers
- remove deprecated interfaces in dtk6
2023-07-05 10:19:56 +08:00
heyuming 2df5ca70dd feat: add DThreadUtils class
Log: 添加DThreadUtils类
2023-06-16 14:15:25 +08:00
ck f5fd6cf9a8 feat: support dtk6core build
cmake -DDVERSION=6.0.0 to build libdtk6core
install qdbusxml2cpp-fix to DCore/bin to avoid conficts
do not build doc when build dtk6
remove Core5Compat depends
DVERSION ==> DTK_VERSION
tools install to CMAKE_INSTALL_LIBEXECDIR
2023-06-16 08:32:50 +08:00
renbin 475671232e fix: DTextEncoding ut failed in Qt6.
1. Fix DTextEncoding muti-byte encoding calculation error.
2. Replace QTextCodec with QStringConverter in Qt6 env.
3. Add convertTextEncodinigEx() interface.

Log: Fix DTextEncoding ut failed in Qt6.
2023-06-08 17:26:52 +08:00
ck 05d45d0eda fix: ut_dfilewater failed on Qt6
QFile::rename changed on Qt6
rename does not emit fileMoved
2023-06-07 17:14:49 +08:00
chenhongtao 4630b5c621 fix(ut): failed ut
Log: fix failed ut
2023-06-02 10:17:31 +08:00
YeShanShan 1a16c38d77 fix: DConfig's `subpathIsValid` produces error
It's correctly even if subpath is not exist, so we can't use
`QDir::canonicalPath` to adjust subpath.
  Add ut.
2023-06-01 13:45:52 +08:00
chenhongtao db8fd1bf7b fix(dccinterface): fix cannot get the right type
Log: fix cannot get the right type
2023-05-31 07:46:03 +00:00
wangyixue d8c7f501a0 fix(cmake): wrong use of option and wrong macro
* BUILD_VERSION should be a string, not a boolean option;
 * Should use CMAKE_INSTALL_PREFIX as DSG_PREFIX_PATH in test,
   CMAKE_PREFIX_PATH might be a list. And there's difference between
   two variables;
 * Trim some trailing spaces.

Log: fix wrong use of option and wrong macro
2023-05-22 16:44:37 +08:00
YeShanShan f7a7a3b1fc feat: DConfig add check for no existed item when override
We shouldn't add the item when override file has no existed
item in meta items.
2023-05-17 13:38:09 +08:00
wangfei 5b650fb843 feat: add license infomation feature
1. add dlicenseinfo interface
2. add dlicenseinfo unit test
3. add dlicenseinfo document

Log: add license information feature
2023-05-09 16:30:56 +08:00
guoyao 4c6390cd5b chore: remove build warning
as title

Log:
2023-04-27 08:54:19 +08:00
Ye ShanShan 3ace2e4fa7 feat: Support cache to be relocated for DConfigFile
Add setCachePrefix function to support that cache can be relocated
by caller, It's default value doesn't changed, and we can refer to
`配置文件规范` in https://github.com/linuxdeepin/deepin-specifications.
  Permissions is left to the caller.
  For DConfig's FileBackend, we use it's default value.

Issue: https://github.com/linuxdeepin/dtkcore/issues/271
2023-03-20 14:19:20 +08:00
heyuming 64731fb083 fix!: remove DCapFSFileEngine
由于在开启Relocatable的Qt上,
注册DCapFileEngine会影响到Qt内部代码产生错误的结果,
并且并没有很好的办法判断某个文件是否应该由DCapFileEngine作为后端,
所以移除

Log: 移除DCapFSFileEngine
2023-03-10 16:57:38 +08:00
heyuming 6954ff2ba9 fix: Fix incomplete copy of Vtable
1. 修复了因不完整拷贝引起的rtti信息丢失的问题
2. 对于虚表结尾判断增加了新的限制条件
3. 增加了调整虚表指针的方法,
   后续可以考虑取消对于函数指针和对象指针类型一致的限制

Log: 修复不完整的虚表拷贝
2023-03-06 13:09:36 +08:00
heyuming 2b73ff6f92 fix: fix bug of unit test under clang
Log: 修复单元测试在clang下的错误
2023-02-28 09:30:17 +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
heyuming d1605f7da2 feat: support Qt6
Log: 支持Qt6
2023-02-14 13:22:03 +08:00
Ye ShanShan 33de26ff1c fix: Losing dconfig info when compiling and packaging
Add adjust for linux when compile.
  Add `D_DSG_APP_DATA_FALLBACK` macro when packaging.
  see the commit: 7b13e5c4b8

Log: none
Influence: none
Change-Id: Ie047dbd2d8158ed5242dfb5bcc7fa4e02ee1d925
2023-02-03 08:52:09 +00:00
ck 4cfda53c9c feat: add chinese2pinyin polyphonic support
1. update dpinyin.dict with polyphonic support
2. add pinyin and firstLetters function
3. add ch2py tools to convert Chinese to Pinyin

dict data reference https://github.com/mozillazg/pinyin-data (zdict.txt MIT)
Bug: https://pms.uniontech.com/bug-view-143063.html,https://pms.uniontech.com/bug-view-182013.html

Log: Chinese2Pinyin polyphonic support
Influence: Chinese to Pinyin
Change-Id: I5fd05c071f68908949e2b1abbbd11feed302abd4
2023-01-18 17:36:05 +08:00
heyuming c65d974733 test: fix DVtableHook and DConfig's unit testing
Log: 修复DVtableHook和DConfig的单元测试
2023-01-17 09:46:12 +08:00
xzl 245dbab5b7 feat: update file watcher manager
添加列出当前监控的文件列表的接口
添加删除全部监控的接口

Log:
2023-01-16 16:03:37 +08:00
renbin 64bbdc979b feat: Add DTextEncoding class.
1. Add DTextEncoding class, provides encoding detection and encoding conversion.
2. Add interface unit test cases, example and comment document.
3. DTextEncoding dynamically loads libuchardet.so and libicuuc.so to support
   extended text encodings.

Log: Add DTextEncoding class.
Influence: Add build dependencies libuchardet-dev and libicu-dev.
2022-12-20 01:25:33 +00:00
wangyixue 49e782de47 chore: label DAsync as deprecated
Label DAsync as deprecated, delete all unit tests for it.

Log: label DAsync as deprecated
2022-12-07 22:17:55 +08:00
chenhongtao 068a6d9688 fix(shell): wrong target
A mistake, since the target name changed, the target name in shell
should also change

Log: fix recoveryshell
2022-09-06 06:16:31 +00:00
chenhongtao 552c42794e chore(package): unit test, coverage
use better optionname and use test , make test link to -lgcov , then
coverage can be caculated. And use ctest , the cmake command to run
tests

fix test-recoverage bash scipts

Log: option name changed , use ctest command, fix test-recoverage script
2022-08-30 08:14:36 +00:00
Chen Bin 9cdc9e7741 feat: add the permission management for files
Use DCapManager class to unify privilege management on
whether to open files or not.

By registering a special file engine, the scope of action
after registration is global unless called the unregister
function manually.

By default, the application can still access some directories
and files with permissions after it is started, but when it
access files beyond the scope of these directories, it will
not get any information.

The default directory includes: Home path; Cache path; DSG path
XDG path etc.

Log:
Influence: null
Change-Id: I0fed6051addc56001b382fc34f73b046c0e4aca2
2022-08-26 11:45:17 +08:00
ShootingStarDragons db5ae947fe feat(tocmake): tocmake
Change the build system to cmake

Log: use cmake
2022-08-16 07:50:54 +00:00
guoyao c6629ebb55 chore: adapt REUSE license header
开源合规

Log: 开源合规
2022-08-11 14:02:36 +08:00
zccrs 7b13e5c4b8 fix: fallback to the user directory if no a valid global config directory
In the not supported for DSG_APP_DATA environment, we can't get a valid
directory for the global config, then falied when saving data. In order
not to lose data, we can only fallback to storing it to the user
directory.

Also, allows to specify a fallback directory for DSG_APP_DATA on
compile, in order to never fallback to the user directory.

Log:
2022-08-04 14:30:03 +08:00
ck 6008c019ff feat: Merge branch 'develop/snipe'
merge develop/snipe

Log:
Influence: none
Change-Id: I0e035f79a4a84039cb1ff865fed907951e468a9b
2022-07-18 15:46:07 +08:00
wang fei 903db8a019 feat: os-version中增加对abc字段的适配
如果有abc字段,buildVersion返回加上abc字段

Log:
Task: https://pms.uniontech.com/task-view-144645.html
Influence: os-version字段
2022-06-08 18:02:31 +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 91447e5d39 fix: DSetting unit error and crash randomly
DSettingsBackend::doSetOption is executing when `DSettings` has
been destroyed, because `doSetOption` is connected in `QueuedConnection`
way, this would be ensure `backendWriteThread`'seventloop is exited
when `DSetting` destoryed.

we ensure `DSettings` is released before `SettingBackend`, so that
`SettingBackend`'s slot would be executed when `DSetting` destoryed.

we also should ensure `SettinBackend` is thread safely, because os
`DSettings` has backendWriteThread to execute doSetOption, and getOption,
is execute in main thread.

remove link of libdtkcore in qmake, because we compile it's source code
in unit test.

Log:
Influence: none
Change-Id: I35fcb8dff2145aec74255889dbd84b5a0525bffb
2022-05-10 20:37:52 +08:00
Ye ShanShan 305f97a724 fix: dconfig can't support embed complex data type
using recursion to parse QDBusArgument.

Log: 
Influence: none
Change-Id: I483721fb761eae1e735aa36fd38fe93cbd2d1529
2022-05-10 20:29:18 +08:00
Ye ShanShan 9c9c027209 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-04-29 08:03:57 +00:00
Ye ShanShan 3d8c5c1b9d chore: unit error in loongarch64
QSettingsBackend unit is error in loongarch64

Log: 
Influence: none
Change-Id: I364ed6a9601688a7348c12bb740bf964a5f1ab98
2022-04-11 16:53:06 +08:00
Ye ShanShan 044955459a chore: unit error in loongarch64
QSettingsBackend unit is error in loongarch64

Log: 
Influence: none
Change-Id: Ibd656196db2e3f9d73642943b4eb79c3d477084f
2022-04-11 16:53:06 +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