From: Boyuan Yang Date: Thu, 3 Jan 2019 15:17:08 +0000 (-0500) Subject: New upstream version 2.0.9.14 X-Git-Tag: archive/raspbian/5.7.12-2+rpi1^2~3^2~23 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8b00966f077a00829d2696508549d5677cc7679e;p=dtkcore.git New upstream version 2.0.9.14 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 56527ae..7db426e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,29 @@ + +## 2.0.9.14 (2019-01-02) + + + + + +## 2.0.9.13 (2018-12-28) + + + + + +## 2.0.9.12 (2018-12-24) + + +#### Bug Fixes + +* **DPathBuf:** missing default constructor ([74374cb4](https://github.com/linuxdeepin/dtkcore/commit/74374cb4cf0245ab1fe73f62fe0d13566f945db3)) + +#### Features + +* support connan build ([ba2d213f](https://github.com/linuxdeepin/dtkcore/commit/ba2d213fd6c7e36e118288305e5892c339250623)) + + + ## 2.0.9.11 (2018-12-14) diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..3a6161f --- /dev/null +++ b/conanfile.py @@ -0,0 +1,87 @@ +from conans import ConanFile, tools + + +class DtkcoreConan(ConanFile): + name = 'dtkcore' + version = '2.0.9' + license = 'GPL' + author = 'Iceyer me@iceyer.net' + url = 'https://github.com/linuxdeepin/dtkcore' + description = 'cross platform ui library' + topics = ('qt', 'dtk') + settings = 'os', 'compiler', 'build_type', 'arch' + options = {'shared': [True, False]} + default_options = 'shared=False' + generators = 'qmake' + exports_sources = '*' + requires = 'jom_installer/1.1.2@bincrafters/stable', 'qt/5.6.3@iceyer/stable' + + def extend_include_path(self): + return '%s/include/libdtk-%s/DCore' % (self.package_folder, self.version) + + # def source(self): + # self.run('git clone https://github.com/linuxdeepin/dtkcore.git source') + # self.run('cd source && git checkout 2.0.9.9') + + def build(self): + outdir = self.build_folder + # includedir = outdir + '/include' + mkspecsdir = outdir + '/mkspecs' + # libdir = outdir + '/lib' + + env_vars = tools.vcvars_dict(self.settings) + env_vars['_CL_'] = '/utf-8' + with tools.environment_append(env_vars): + command = 'qmake -r' + command += ' VERSION=%s' % self.version + # command += ' CONFIG-=debug_and_release' + # command += ' CONFIG-=debug_and_release_target' + command += ' CONFIG+=release' + command += ' PREFIX=%s' % outdir + command += ' MKSPECS_INSTALL_DIR=%s' % mkspecsdir + command += ' DTK_STATIC_LIB=YES' + command += ' DTK_STATIC_TRANSLATION=YES' + command += ' DTK_NO_MULTIMEDIA=YES' + command += ' %s' % self.source_folder + self.run(command) + self.run('jom clean') + self.run('jom') + self.run('jom install') + + def package(self): + self.deploy() + + outdir = self.build_folder + self.copy('*', dst='include', src=outdir+'/include') + self.copy('*.lib', dst='lib', src=outdir+'/lib') + self.copy('*', dst='mkspecs', src=outdir+'/mkspecs') + + def package_info(self): + self.cpp_info.libs = ['dtkcore'] + self.cpp_info.includedirs.append(self.extend_include_path()) + self.env_info.QMAKEPATH = self.cpp_info.rootpath + self.env_info.QMAKEFEATURES = self.cpp_info.rootpath + '/mkspecs/features' + + def deploy(self): + try: + content = [] + module_pri = self.build_folder + '/mkspecs/modules/qt_lib_dtkcore.pri' + s = open(module_pri) + for line in s.readlines(): + if line.startswith('QT.dtkcore.tools'): + line = 'QT.dtkcore.tools = %s\n' % ( + self.package_folder + '/bin') + elif line.startswith('QT.dtkcore.libs'): + line = 'QT.dtkcore.libs = %s\n' % ( + self.package_folder + '/lib') + elif line.startswith('QT.dtkcore.includes'): + line = 'QT.dtkcore.includes = %s\n' % ( + self.extend_include_path()) + content.append(line) + s.close() + + # print('create module file', content) + s = open(module_pri, 'w') + s.writelines(content) + except FileNotFoundError: + print('skip update qt module file') diff --git a/src/base/dsingleton.h b/src/base/dsingleton.h index 6c0e37e..f404da2 100644 --- a/src/base/dsingleton.h +++ b/src/base/dsingleton.h @@ -23,17 +23,36 @@ DCORE_BEGIN_NAMESPACE /*! - * a simple singleton template for std c++ 11 or later. + * \~english a simple singleton template for std c++ 11 or later. * * example: + +``` + class ExampleSingleton : public QObject, public Dtk::DSingleton + { + Q_OBJECT + friend class DSingleton; + }; +``` + + * \note: for Qt, "public DSingleton" must be after QObject. + */ + + +/*! + * \~chinese 通过c++11的特性实现的单例模板 * - * class ExampleSingleton : public QObject, public Dtk::DSingleton - * { - * Q_OBJECT - * friend class DSingleton; - * }; - * - * Warning: for Qt, "public DSingleton" must be after QObject. + * 使用示例: + +``` + class ExampleSingleton : public QObject, public Dtk::DSingleton + { + Q_OBJECT + friend class DSingleton; + }; +``` + + * \note 对于Qt程序 public DSingleton" 必须在卸载QObject后面出现。 */ template diff --git a/src/dtk_module.prf b/src/dtk_module.prf index d26330d..b42934d 100644 --- a/src/dtk_module.prf +++ b/src/dtk_module.prf @@ -99,7 +99,11 @@ write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.") QT_HOST_DATA=$$system(qmake -query QT_HOST_DATA) qt_module.files = $$MODULE_PRI -qt_module.path = $${QT_HOST_DATA}/mkspecs/modules + +isEmpty(MKSPECS_INSTALL_DIR) { + MKSPECS_INSTALL_DIR=$${QT_HOST_DATA}/mkspecs +} +qt_module.path = $${MKSPECS_INSTALL_DIR}/modules INSTALLS += qt_module diff --git a/src/filesystem/dpathbuf.cpp b/src/filesystem/dpathbuf.cpp index cd5aa62..c36195d 100644 --- a/src/filesystem/dpathbuf.cpp +++ b/src/filesystem/dpathbuf.cpp @@ -27,4 +27,10 @@ DPathBuf::DPathBuf(const QString &path) m_path = QDir(path).absolutePath(); } +DPathBuf::DPathBuf() + : DPathBuf(QString()) +{ + +} + DCORE_END_NAMESPACE diff --git a/src/filesystem/dpathbuf.h b/src/filesystem/dpathbuf.h index aa5c997..bceb389 100644 --- a/src/filesystem/dpathbuf.h +++ b/src/filesystem/dpathbuf.h @@ -26,6 +26,7 @@ DCORE_BEGIN_NAMESPACE class LIBDTKCORESHARED_EXPORT DPathBuf { public: + DPathBuf(); DPathBuf(const QString &path); /*! diff --git a/src/log/AbstractAppender.cpp b/src/log/AbstractAppender.cpp index a4fe340..0498695 100644 --- a/src/log/AbstractAppender.cpp +++ b/src/log/AbstractAppender.cpp @@ -43,7 +43,7 @@ DCORE_BEGIN_NAMESPACE * imagine. * * For the simple non-structured plain text logging (for example, to a plain text file or to the console output) you may - * like to subclass the AbstractStringAppender instead of AbstractAppender, which will give you a more convinient way to + * like to subclass the AbstractStringAppender instead of AbstractAppender, which will give you a more convenient way to * control the format of the log output. * * \sa AbstractStringAppender diff --git a/src/log/AbstractStringAppender.cpp b/src/log/AbstractStringAppender.cpp index 1757303..ef6ee8f 100644 --- a/src/log/AbstractStringAppender.cpp +++ b/src/log/AbstractStringAppender.cpp @@ -29,10 +29,10 @@ DCORE_BEGIN_NAMESPACE /** * \class AbstractStringAppender * - * \brief The AbstractStringAppender class provides a convinient base for appenders working with plain text formatted + * \brief The AbstractStringAppender class provides a convenient base for appenders working with plain text formatted * logs. * - * AbstractSringAppender is the simple extension of the AbstractAppender class providing the convinient way to create + * AbstractSringAppender is the simple extension of the AbstractAppender class providing the convenient way to create * custom log appenders working with a plain text formatted log targets. * * It have the formattedString() protected function that formats the logging arguments according to a format set with diff --git a/src/log/Logger.cpp b/src/log/Logger.cpp index 72b6935..d482d5e 100644 --- a/src/log/Logger.cpp +++ b/src/log/Logger.cpp @@ -62,11 +62,11 @@ DCORE_BEGIN_NAMESPACE * * \brief Writes the trace log record * - * This macro is the convinient way to call Logger::write(). It uses the common preprocessor macros \c __FILE__, + * This macro is the convenient way to call Logger::write(). It uses the common preprocessor macros \c __FILE__, * \c __LINE__ and the standard Qt \c Q_FUNC_INFO macros to automatically determine the needed parameters to call * Logger::write(). * - * \note This and other (dInfo() etc...) macros uses the variadic macro arguments to give convinient usage form for + * \note This and other (dInfo() etc...) macros uses the variadic macro arguments to give convenient usage form for * the different versions of Logger::write() (using the QString or const char* argument or returning the QDebug class * instance). Not all compilers will support this. Please, consider reviewing your compiler documentation to ensure * it support __VA_ARGS__ macro. @@ -293,7 +293,7 @@ DCORE_BEGIN_NAMESPACE * * \brief Check the assertion * - * This macro is a convinient and recommended to use way to call Logger::writeAssert() function. It uses the + * This macro is a convenient and recommended to use way to call Logger::writeAssert() function. It uses the * preprocessor macros (as the dDebug() does) to fill the necessary arguments of the Logger::writeAssert() call. It * also uses undocumented but rather mature and stable \c qt_noop() function (which does nothing) when the assertion * is true. diff --git a/src/settings/dsettingsgroup.cpp b/src/settings/dsettingsgroup.cpp index 1b49d88..5bfbfbe 100644 --- a/src/settings/dsettingsgroup.cpp +++ b/src/settings/dsettingsgroup.cpp @@ -48,10 +48,15 @@ public: }; /*! - * \class DSettingsGroup + * \~english \class DSettingsGroup * \brief A group of DSettingsOption and DSettingsGroup. * DSettingsGroup can contain a lost option and subgroup. */ +/*! + * \chinese \class DSettingsGroup + * \brief 一组DSettings选项的集合,也可以包含子组。 + */ + DSettingsGroup::DSettingsGroup(QObject *parent) : QObject(parent), dd_ptr(new DSettingsGroupPrivate(this)) @@ -63,8 +68,13 @@ DSettingsGroup::~DSettingsGroup() { } + +/*! + * \~english \brief Get direct parent group of this group. + * \return + */ /*! - * \brief Get direct parent group of this group. + * \~chinese \brief 获取当前组的父组。 * \return */ QPointer DSettingsGroup::parentGroup() const @@ -74,8 +84,10 @@ QPointer DSettingsGroup::parentGroup() const } /*! - * \brief Change the direct parent group of this group. - * \param parentGroup + * \~english \brief Change the direct parent group of this group. + */ +/*! + * \~chinese \brief 设置但前组的父组。 */ void DSettingsGroup::setParentGroup(QPointer parentGroup) { @@ -84,9 +96,12 @@ void DSettingsGroup::setParentGroup(QPointer parentGroup) } /*! - * \brief Return the full key of this group, include all parent. + * \~english \brief Return the full key of this group, include all parent. * \return */ +/*! + * \~chinese \brief 返回这个组的键,会包含全部的父组的键。 + */ QString DSettingsGroup::key() const { Q_D(const DSettingsGroup); @@ -94,8 +109,10 @@ QString DSettingsGroup::key() const } /*! - * \brief Get display name of this group, it may be translated. - * \return + * \~english \brief Get display name of this group, it may be translated. + */ +/*! + * \~chinese \brief 返回这个组名称。 */ QString DSettingsGroup::name() const { @@ -104,9 +121,13 @@ QString DSettingsGroup::name() const } /*! - * \brief Check this group will show on DSettings dialog. + * \~english \brief Check this group will show on DSettings dialog. * \return true if group not bind to ui element. */ +/*! + * \~chinese \brief 检查这个选项组是否会在界面上显示。 + * \return true 表示则这个选项组会显示出来。 + */ bool DSettingsGroup::isHidden() const { Q_D(const DSettingsGroup); @@ -114,9 +135,12 @@ bool DSettingsGroup::isHidden() const } /*! - * \brief Get the child group of groupKey + * \~english \brief Get the child group of groupKey * \param groupKey is child group key - * \return + */ +/*! + * \~chinese \brief 返回给定键在选项组中对应的子组。 + * \param groupKey 子组的键 */ QPointer DSettingsGroup::childGroup(const QString &groupKey) const { @@ -125,9 +149,12 @@ QPointer DSettingsGroup::childGroup(const QString &groupKey) con } /*! - * \brief Get the child option of key + * \~english \brief Get the child option of key * \param key is child option key - * \return + */ +/*! + * \~chinese \brief 根据键值获取选项。 + * \param key 选项的完整键 */ QPointer DSettingsGroup::option(const QString &key) const { @@ -136,8 +163,10 @@ QPointer DSettingsGroup::option(const QString &key) const } /*! - * \brief Enum all direct child group of this group - * \return + * \~english \brief Enum all direct child group of this group + */ +/*! + * \~chinese \brief 列出组下面所有的直接子组。 */ QList > DSettingsGroup::childGroups() const { @@ -150,7 +179,11 @@ QList > DSettingsGroup::childGroups() const } /*! - * \brief Enum all direct child option with the raw order in json description file. + * \~english \brief Enum all direct child option with the raw order in json description file. + * \return + */ +/*! + * \~chinese \brief 列出组下面所有的直接选项。 * \return */ QList > DSettingsGroup::childOptions() const @@ -164,7 +197,11 @@ QList > DSettingsGroup::childOptions() const } /*! - * \brief Enum all direct child option of this group. + * \~english \brief Enum all direct child option of this group. + * \return + */ +/*! + * \~chinese \brief 列出组下面所有的选项。 * \return */ QList > DSettingsGroup::options() const @@ -174,11 +211,17 @@ QList > DSettingsGroup::options() const } /*! - * \brief Convert QJsonObject to DSettingsGroup. + * \~english \brief Convert QJsonObject to DSettingsGroup. * \param prefixKey instead parse prefix key from parent. * \param json is an QJsonObejct instance. * \sa QPointer Dtk::Core::DSettingsGroup::parseJson(const QString &prefixKey, const QJsonObject &json) */ +/*! + * \~chinese \brief 将json对象转化为DSettingsGroup + * \param prefixKey 组键值前缀 + * \param json 待反序列化的json对象 + * \sa QPointer Dtk::Core::DSettingsGroup::parseJson(const QString &prefixKey, const QJsonObject &json) + */ QPointer DSettingsGroup::fromJson(const QString &prefixKey, const QJsonObject &group) { auto groupPtr = QPointer(new DSettingsGroup); @@ -187,11 +230,17 @@ QPointer DSettingsGroup::fromJson(const QString &prefixKey, cons } /*! - * \brief Parse QJsonObject to DSettingsGroup. + * \~english \brief Parse QJsonObject to DSettingsGroup. * \param prefixKey instead parse prefix key from parent. * \param json is an QJsonObejct instance. * \sa QPointer Dtk::Core::DSettingsGroup::fromJson(const QString &prefixKey, const QJsonObject &json) */ +/*! + * \~chinese \brief 将json对象转化为DSettingsGroup + * \param prefixKey 组键值前缀 + * \param json 待反序列化的json对象 + * \sa QPointer Dtk::Core::DSettingsGroup::fromJson(const QString &prefixKey, const QJsonObject &json) + */ void DSettingsGroup::parseJson(const QString &prefixKey, const QJsonObject &group) { Q_D(DSettingsGroup); diff --git a/src/settings/dsettingsoption.cpp b/src/settings/dsettingsoption.cpp index 82419f9..1a6cd69 100644 --- a/src/settings/dsettingsoption.cpp +++ b/src/settings/dsettingsoption.cpp @@ -46,7 +46,7 @@ public: }; /*! - * \class DSettingsOption + * \~english \class DSettingsOption * \brief DSettingsOption is the base key/value item of DSettings. * * \fn void DSettingsOption::valueChanged(QVariant value); @@ -56,11 +56,27 @@ public: * \brief Emit when option data change. * * - * \property DSettingsOption::value * \brief Current value of this option. */ + +/*! + * \~chinese \class DSettingsOption + * \brief DSettingsOption是DSettings的基本单元,用于存放一对键-值数据。 + * + * \fn void DSettingsOption::valueChanged(QVariant value); + * \brief 选项的数据变化时发出改信息 + * + * \fn void DSettingsOption::dataChanged(const QString &dataType, QVariant value); + * \brief 选项的附件的额外数据变化时发出改信息,可以看作这个值的属性发生变化。 + * + * + * \property DSettingsOption::value + * \brief 选项的当前值。 + */ + + DSettingsOption::DSettingsOption(QObject *parent) : QObject(parent), dd_ptr(new DSettingsOptionPrivate(this)) { @@ -72,7 +88,11 @@ DSettingsOption::~DSettingsOption() } /*! - * \brief Get direct parent group of this option. + * \~english \brief Get direct parent group of this option. + * \return + */ +/*! + * \~chinese \brief 当前选项的直接上级组。 * \return */ QPointer DSettingsOption::parentGroup() const @@ -82,9 +102,13 @@ QPointer DSettingsOption::parentGroup() const } /*! - * \brief Change the direct parent group of this option. + * \~english \brief Change the direct parent group of this option. * \param parentGroup */ +/*! + * \~chinese \brief 修改但前选项的上级组。 + * \return + */ void DSettingsOption::setParentGroup(QPointer parentGroup) { Q_D(DSettingsOption); @@ -92,7 +116,11 @@ void DSettingsOption::setParentGroup(QPointer parentGroup) } /*! - * \brief Return the full key of this option, include all parent. + * \~english \brief Return the full key of this option, include all parent. + * \return + */ +/*! + * \~chinese \brief 但前选项的键值。 * \return */ QString DSettingsOption::key() const @@ -102,7 +130,11 @@ QString DSettingsOption::key() const } /*! - * \brief Get display name of the option, it may be translated. + * \~english \brief Get display name of the option, it may be translated. + * \return + */ +/*! + * \~chinese \brief 但前选项的名称。 * \return */ QString DSettingsOption::name() const @@ -112,10 +144,14 @@ QString DSettingsOption::name() const } /*! - * \brief Check this option can be reset to default value. if false, reset action will not take effect. + * \~english \brief Check this option can be reset to default value. if false, reset action will not take effect. * \return true if can be reset. * \sa Dtk::Core::DSettings::reset */ +/*! + * \~chinese \brief 选项是否可以重置,如果可以重置,在调用reset方法后,选项的值会变成初始值。 + * \return + */ bool DSettingsOption::canReset() const { Q_D(const DSettingsOption); @@ -123,7 +159,11 @@ bool DSettingsOption::canReset() const } /*! - * \brief Default value of this option, must config in this json desciption file. + * \~english \brief Default value of this option, must config in this json desciption file. + * \return + */ +/*! + * \~chinese \brief 选项的默认值。 * \return */ QVariant DSettingsOption::defaultValue() const @@ -133,7 +173,11 @@ QVariant DSettingsOption::defaultValue() const } /*! - * \brief Get current value of option. + * \~english \brief Get current value of option. + * \return + */ +/*! + * \~chinese \brief 选项的当前值。 * \return */ QVariant DSettingsOption::value() const @@ -143,12 +187,18 @@ QVariant DSettingsOption::value() const } /*! - * \brief Custom data of option, like QObject::property. + * \~english \brief Custom data of option, like QObject::property. * \param dataType * \return * \sa QObject::property * \sa Dtk::Core::DSettingsOption::setData */ +/*! + * \~chinese \brief 选项的附件data,用于未选项设置一些额外的辅助属性。 + * \return + * \sa QObject::property + * \sa Dtk::Core::DSettingsOption::setData + */ QVariant DSettingsOption::data(const QString &dataType) const { Q_D(const DSettingsOption); @@ -156,7 +206,12 @@ QVariant DSettingsOption::data(const QString &dataType) const } /*! - * \brief UI widget type of this option + * \~english \brief UI widget type of this option + * \return + * \sa Dtk::Widget::DSettingsWidgetFactory + */ +/*! + * \~chinese \brief 选项的控件类型。 * \return * \sa Dtk::Widget::DSettingsWidgetFactory */ @@ -167,9 +222,13 @@ QString DSettingsOption::viewType() const } /*! - * \brief Check this option will show on DSettings dialog. + * \~english \brief Check this option will show on DSettings dialog. * \return true if option not bind to ui element. */ +/*! + * \~chinese \brief 检查选项是否会在界面上显示。 + * \return 如果显示则返回true,否则返回false。 + */ bool DSettingsOption::isHidden() const { Q_D(const DSettingsOption); @@ -177,11 +236,17 @@ bool DSettingsOption::isHidden() const } /*! - * \brief Convert QJsonObject to DSettingsOption. + * \~english \brief Convert QJsonObject to DSettingsOption. * \param prefixKey instead parse prefix key from parent. * \param json is an QJsonObejct instance. * \return */ +/*! + * \~chinese \brief 从json对象中反序列化出一个选项对象。 + * \param 选项的前缀 + * \param 待反序列化的json对象 + * \return + */ QPointer DSettingsOption::fromJson(const QString &prefixKey, const QJsonObject &json) { auto optionPtr = QPointer(new DSettingsOption); @@ -190,7 +255,11 @@ QPointer DSettingsOption::fromJson(const QString &prefixKey, co } /*! - * \brief Set current value of option + * \~english \brief Set current value of option. + * \param value + */ +/*! + * \~chinese \brief 设置选项的当前值。 * \param value */ void DSettingsOption::setValue(QVariant value) @@ -216,11 +285,17 @@ void DSettingsOption::setValue(QVariant value) //} /*! - * \brief Set custom data + * \~english \brief Set custom data * \param dataType is data id, just a unique string. * \param value of the data id. * \sa Dtk::Core::DSettingsOption::data */ +/*! + * \~chinese \brief 为选项添加自定义属性。 + * \param dataType 选项的扎属性数据id,对每个选项必须唯一 + * \param value 选项id对应的值 + * \sa Dtk::Core::DSettingsOption::data + */ void DSettingsOption::setData(const QString &dataType, QVariant value) { Q_D(DSettingsOption); @@ -235,11 +310,17 @@ void DSettingsOption::setData(const QString &dataType, QVariant value) } /*! - * \brief Parse QJsonObject to DSettingsOption. + * \~english \brief Parse QJsonObject to DSettingsOption. * \param prefixKey instead parse prefix key from parent. * \param json is an QJsonObejct instance. * \sa QPointer Dtk::Core::DSettingsOption::fromJson(const QString &prefixKey, const QJsonObject &json) */ +/*! + * \~chinese \brief 从json对象中反序列化,并设置自身的值。 + * \param 选项的前缀 + * \param 待反序列化的json对象 + * \sa QPointer Dtk::Core::DSettingsOption::fromJson(const QString &prefixKey, const QJsonObject &json) + */ void DSettingsOption::parseJson(const QString &prefixKey, const QJsonObject &option) { Q_D(DSettingsOption); diff --git a/src/src.pro b/src/src.pro index 75ad2a8..6fcf407 100644 --- a/src/src.pro +++ b/src/src.pro @@ -102,7 +102,11 @@ include(dtk_cmake.prf) include(dtk_module.prf) prf.files+= $$PWD/*.prf -prf.path = $${QT_HOST_DATA}/mkspecs/features + +isEmpty(MKSPECS_INSTALL_DIR) { + MKSPECS_INSTALL_DIR=$${QT_HOST_DATA}/mkspecs +} +prf.path = $${MKSPECS_INSTALL_DIR}/features linux { # dtk for qmake