+<a name="2.0.9.14"></a>
+## 2.0.9.14 (2019-01-02)
+
+
+
+
+<a name="2.0.9.13"></a>
+## 2.0.9.13 (2018-12-28)
+
+
+
+
+<a name="2.0.9.12"></a>
+## 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))
+
+
+
<a name="2.0.9.11"></a>
## 2.0.9.11 (2018-12-14)
--- /dev/null
+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')
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<ExampleSingleton>
+ {
+ Q_OBJECT
+ friend class DSingleton<ExampleSingleton>;
+ };
+```
+
+ * \note: for Qt, "public DSingleton<ExampleSingleton>" must be after QObject.
+ */
+
+
+/*!
+ * \~chinese 通过c++11的特性实现的单例模板
*
- * class ExampleSingleton : public QObject, public Dtk::DSingleton<ExampleSingleton>
- * {
- * Q_OBJECT
- * friend class DSingleton<ExampleSingleton>;
- * };
- *
- * Warning: for Qt, "public DSingleton<LyricService>" must be after QObject.
+ * 使用示例:
+
+```
+ class ExampleSingleton : public QObject, public Dtk::DSingleton<ExampleSingleton>
+ {
+ Q_OBJECT
+ friend class DSingleton<ExampleSingleton>;
+ };
+```
+
+ * \note 对于Qt程序 public DSingleton<ExampleSingleton>" 必须在卸载QObject后面出现。
*/
template <class T>
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
m_path = QDir(path).absolutePath();
}
+DPathBuf::DPathBuf()
+ : DPathBuf(QString())
+{
+
+}
+
DCORE_END_NAMESPACE
class LIBDTKCORESHARED_EXPORT DPathBuf
{
public:
+ DPathBuf();
DPathBuf(const QString &path);
/*!
* 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
/**
* \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
*
* \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.
*
* \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.
};
/*!
- * \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))
{
}
+
+/*!
+ * \~english \brief Get direct parent group of this group.
+ * \return
+ */
/*!
- * \brief Get direct parent group of this group.
+ * \~chinese \brief 获取当前组的父组。
* \return
*/
QPointer<DSettingsGroup> 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<DSettingsGroup> 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);
}
/*!
- * \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
{
}
/*!
- * \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);
}
/*!
- * \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> DSettingsGroup::childGroup(const QString &groupKey) const
{
}
/*!
- * \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<DSettingsOption> 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<QPointer<DSettingsGroup> > 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<QPointer<DSettingsOption> > 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<QPointer<DSettingsOption> > 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<DSettingsOption> Dtk::Core::DSettingsGroup::parseJson(const QString &prefixKey, const QJsonObject &json)
*/
+/*!
+ * \~chinese \brief 将json对象转化为DSettingsGroup
+ * \param prefixKey 组键值前缀
+ * \param json 待反序列化的json对象
+ * \sa QPointer<DSettingsOption> Dtk::Core::DSettingsGroup::parseJson(const QString &prefixKey, const QJsonObject &json)
+ */
QPointer<DSettingsGroup> DSettingsGroup::fromJson(const QString &prefixKey, const QJsonObject &group)
{
auto groupPtr = QPointer<DSettingsGroup>(new DSettingsGroup);
}
/*!
- * \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<DSettingsOption> Dtk::Core::DSettingsGroup::fromJson(const QString &prefixKey, const QJsonObject &json)
*/
+/*!
+ * \~chinese \brief 将json对象转化为DSettingsGroup
+ * \param prefixKey 组键值前缀
+ * \param json 待反序列化的json对象
+ * \sa QPointer<DSettingsOption> Dtk::Core::DSettingsGroup::fromJson(const QString &prefixKey, const QJsonObject &json)
+ */
void DSettingsGroup::parseJson(const QString &prefixKey, const QJsonObject &group)
{
Q_D(DSettingsGroup);
};
/*!
- * \class DSettingsOption
+ * \~english \class DSettingsOption
* \brief DSettingsOption is the base key/value item of DSettings.
*
* \fn void DSettingsOption::valueChanged(QVariant value);
* \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))
{
}
/*!
- * \brief Get direct parent group of this option.
+ * \~english \brief Get direct parent group of this option.
+ * \return
+ */
+/*!
+ * \~chinese \brief 当前选项的直接上级组。
* \return
*/
QPointer<DSettingsGroup> 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<DSettingsGroup> parentGroup)
{
Q_D(DSettingsOption);
}
/*!
- * \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
}
/*!
- * \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
}
/*!
- * \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);
}
/*!
- * \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
}
/*!
- * \brief Get current value of option.
+ * \~english \brief Get current value of option.
+ * \return
+ */
+/*!
+ * \~chinese \brief 选项的当前值。
* \return
*/
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);
}
/*!
- * \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
*/
}
/*!
- * \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);
}
/*!
- * \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> DSettingsOption::fromJson(const QString &prefixKey, const QJsonObject &json)
{
auto optionPtr = QPointer<DSettingsOption>(new DSettingsOption);
}
/*!
- * \brief Set current value of option
+ * \~english \brief Set current value of option.
+ * \param value
+ */
+/*!
+ * \~chinese \brief 设置选项的当前值。
* \param value
*/
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);
}
/*!
- * \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<DSettingsOption> Dtk::Core::DSettingsOption::fromJson(const QString &prefixKey, const QJsonObject &json)
*/
+/*!
+ * \~chinese \brief 从json对象中反序列化,并设置自身的值。
+ * \param 选项的前缀
+ * \param 待反序列化的json对象
+ * \sa QPointer<DSettingsOption> Dtk::Core::DSettingsOption::fromJson(const QString &prefixKey, const QJsonObject &json)
+ */
void DSettingsOption::parseJson(const QString &prefixKey, const QJsonObject &option)
{
Q_D(DSettingsOption);
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