From ab1ab1e7d5a7a76c98c589a064e39c8ddabcb4a8 Mon Sep 17 00:00:00 2001 From: AbelTian <2407223896@qq.com> Date: Tue, 24 Apr 2018 11:57:14 +0800 Subject: [PATCH 1/3] close example --- QQt.pro | 2 +- QQtExample.pro | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/QQt.pro b/QQt.pro index cd6a5302..e2a5b764 100644 --- a/QQt.pro +++ b/QQt.pro @@ -6,4 +6,4 @@ TEMPLATE = subdirs CONFIG += ordered SUBDIRS = src/qqt.pro -SUBDIRS += QQtExample.pro +#SUBDIRS += QQtExample.pro diff --git a/QQtExample.pro b/QQtExample.pro index 55b7e945..7f930def 100644 --- a/QQtExample.pro +++ b/QQtExample.pro @@ -48,13 +48,11 @@ SUBDIRS += examples/qqtaudioexample #必开 客户端的 basic SUBDIRS += examples/qqtnetworkexample #这边是个组合项,客户端和服务器一起的。 -contains(DEFINES, __HIGHGRADE__) { - SUBDIRS += examples/qqtclientexample - SUBDIRS += demo/QQtClientCreator - #服务器的 highgrade - SUBDIRS += examples/qqtserverexample - SUBDIRS += demo/QQtServerCreator -} +#SUBDIRS += examples/qqtclientexample +#SUBDIRS += demo/QQtClientCreator +#服务器的 highgrade +#SUBDIRS += examples/qqtserverexample +#SUBDIRS += demo/QQtServerCreator #greaterThan(QT_VERSION, 4.6.0):SUBDIRS += test/voicetest #mac:lessThan(QT_MAJOR_VERSION , 5):SUBDIRS -= test/voicetest From 195c81bb3147aa8e938e9ebdf9b2b6218222098e Mon Sep 17 00:00:00 2001 From: tianduanrui Date: Wed, 25 Apr 2018 14:48:46 +0800 Subject: [PATCH 2/3] update dict --- QQtExample.pro | 1 + src/core/qqtdictionary.cpp | 17 +++++++++-------- src/core/qqtdictionary.h | 13 ++++++------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/QQtExample.pro b/QQtExample.pro index 7f930def..75f27cab 100644 --- a/QQtExample.pro +++ b/QQtExample.pro @@ -80,6 +80,7 @@ SUBDIRS += examples/qqtnetworkexample #SUBDIRS += test/treeviewtest #SUBDIRS += test/qqtdicttest #必开 +# SUBDIRS += test/qqtdicttest2 #SUBDIRS += test/bytearraytest #!contains(QKIT_PRIVATE, iOS|iOSSimulator){ diff --git a/src/core/qqtdictionary.cpp b/src/core/qqtdictionary.cpp index 1ee43dfa..f5be307c 100644 --- a/src/core/qqtdictionary.cpp +++ b/src/core/qqtdictionary.cpp @@ -1,11 +1,15 @@ #include "qqtdictionary.h" -QQtDictNode::QQtDictNode ( QObject* parent ) : - QObject ( parent ) +QQtDictNode::QQtDictNode () { m_type = DictMax; } +QQtDictNode::~QQtDictNode() +{ + +} + bool QQtDictNode::isValue() const { bool is = false; @@ -248,14 +252,12 @@ void QQtDictNode::remove ( const QString& key ) m_map.remove ( key ); } -QQtDictNode::QQtDictNode ( const QQtDictNode& other, QObject* parent ) : - QObject ( parent ) +QQtDictNode::QQtDictNode ( const QQtDictNode& other ) { *this = other; } -QQtDictNode::QQtDictNode ( const QQtDictNode::EDictType type, QObject* parent ) : - QObject ( parent ) +QQtDictNode::QQtDictNode ( const QQtDictNode::EDictType type ) { m_type = type; } @@ -270,8 +272,7 @@ const QQtDictNode& QQtDictNode::operator[] ( int index ) const return m_list[index]; } -QQtDictNode::QQtDictNode ( const QVariant& value, QObject* parent ) : - QObject ( parent ) +QQtDictNode::QQtDictNode ( const QVariant& value ) { m_type = DictValue; *this = value; diff --git a/src/core/qqtdictionary.h b/src/core/qqtdictionary.h index d437198e..0183438e 100644 --- a/src/core/qqtdictionary.h +++ b/src/core/qqtdictionary.h @@ -33,9 +33,8 @@ typedef QMutableListIterator QQtDictNodeMutableListIterator; * QVariant 不能直接获取到真实数据,改变必须使用临时变量。 * 而且,接口设计也不够灵活,存入和取出都不太方便。 */ -class QQTSHARED_EXPORT QQtDictNode : public QObject +class QQTSHARED_EXPORT QQtDictNode { - Q_OBJECT Q_ENUMS ( EDictType ) public: @@ -51,8 +50,8 @@ public: } EDictType; /*explicit 函数只能作为构造函数,不能作为拷贝构造函数,拷贝构造函数不可加*/ - explicit QQtDictNode ( QObject* parent = 0 ); - virtual ~QQtDictNode() {} + explicit QQtDictNode (); + virtual ~QQtDictNode (); bool isNull() const; bool isValid() const; @@ -119,9 +118,9 @@ public: void remove ( const QString& key ); /*深拷贝*/ - QQtDictNode ( const QQtDictNode& other, QObject* parent = 0 ); - QQtDictNode ( const QVariant& value, QObject* parent = 0 ); - QQtDictNode ( const EDictType type, QObject* parent = 0 ); + QQtDictNode ( const QQtDictNode& other ); + QQtDictNode ( const QVariant& value ); + QQtDictNode ( const EDictType type ); /*操作符*/ /*警告:可读、可写*/ From 1d537a525fc0c33bd572ecd5db9ec8e64a0acc58 Mon Sep 17 00:00:00 2001 From: AbelTian <2407223896@qq.com> Date: Thu, 26 Apr 2018 16:37:54 +0800 Subject: [PATCH 3/3] update qqt dictionary --- demo/QtSdkManager/qqtqtiowebpageparser.h | 2 +- examples/console_app/main.cpp | 2 +- src/core/qqtdictionary.cpp | 116 +++++++++++------------ src/core/qqtdictionary.h | 80 ++++++++-------- src/multimedia/qqtaudiomanager.h | 30 +++++- src/qqt_3rdparty.pri | 2 +- src/qqt_header.pri | 5 +- test/qqtdicttest/tst_qqtdicttesttest.cpp | 4 +- test/qqtdicttest2/main.cpp | 40 ++++---- 9 files changed, 153 insertions(+), 128 deletions(-) diff --git a/demo/QtSdkManager/qqtqtiowebpageparser.h b/demo/QtSdkManager/qqtqtiowebpageparser.h index ab8f93cb..4090e5bf 100644 --- a/demo/QtSdkManager/qqtqtiowebpageparser.h +++ b/demo/QtSdkManager/qqtqtiowebpageparser.h @@ -60,7 +60,7 @@ private: /*过去有用这种自定义的,有用xml的,有用json的,留作纪念*/ QList sdkGroup; /*现在用QQtDict*/ - QQtDictNode m_sdkGroup; + QQtDictionary m_sdkGroup; /*格式:["5.7"]["5.7.3"][0-3]*/ QTimer* m_timer; QTime m_time; diff --git a/examples/console_app/main.cpp b/examples/console_app/main.cpp index ae8dd0a7..f8cd4dc2 100644 --- a/examples/console_app/main.cpp +++ b/examples/console_app/main.cpp @@ -10,7 +10,7 @@ int main ( int argc, char* argv[] ) qDebug() << "ccc"; - QQtDictNode dict; + QQtDictionary dict; dict[0][1][2][3][4]["my name"][5][6] = "a string"; pline() << dict[0][1][2][3][4]["my name"][5][6].getValue().toString(); diff --git a/src/core/qqtdictionary.cpp b/src/core/qqtdictionary.cpp index f5be307c..e47640a0 100644 --- a/src/core/qqtdictionary.cpp +++ b/src/core/qqtdictionary.cpp @@ -1,16 +1,16 @@ #include "qqtdictionary.h" -QQtDictNode::QQtDictNode () +QQtDictionary::QQtDictionary () { m_type = DictMax; } -QQtDictNode::~QQtDictNode() +QQtDictionary::~QQtDictionary() { } -bool QQtDictNode::isValue() const +bool QQtDictionary::isValue() const { bool is = false; @@ -20,12 +20,12 @@ bool QQtDictNode::isValue() const return is; } -QQtDictNode::EDictType QQtDictNode::getType() const +QQtDictionary::EDictType QQtDictionary::getType() const { return m_type; } -QString QQtDictNode::getTypeName() const +QString QQtDictionary::getTypeName() const { QString type = "Invalid"; if ( DictValue == m_type ) @@ -38,35 +38,35 @@ QString QQtDictNode::getTypeName() const return type; } -void QQtDictNode::setType ( QQtDictNode::EDictType type ) +void QQtDictionary::setType ( QQtDictionary::EDictType type ) { m_type = type; } -void QQtDictNode::setChild ( const QVariant& value ) +void QQtDictionary::setChild ( const QVariant& value ) { m_type = DictValue; m_value = value; } -void QQtDictNode::setChild ( const QList& list ) +void QQtDictionary::setChild ( const QList& list ) { m_type = DictList; m_list = list; } -void QQtDictNode::setChild ( const QMap& map ) +void QQtDictionary::setChild ( const QMap& map ) { m_type = DictMap; m_map = map; } -void QQtDictNode::appendChild ( const QString& value ) +void QQtDictionary::appendChild ( const QString& value ) { - appendChild ( QQtDictNode ( QVariant ( value ) ) ); + appendChild ( QQtDictionary ( QVariant ( value ) ) ); } -void QQtDictNode::appendChild ( const QQtDictNode& dict ) +void QQtDictionary::appendChild ( const QQtDictionary& dict ) { m_type = DictList; //list类 @@ -77,18 +77,18 @@ void QQtDictNode::appendChild ( const QQtDictNode& dict ) m_list.push_back ( dict ); } -void QQtDictNode::insertChild ( const QString& key, const QQtDictNode& dict ) +void QQtDictionary::insertChild ( const QString& key, const QQtDictionary& dict ) { m_type = DictMap; m_map.insert ( key, dict ); } -void QQtDictNode::insertChild ( int index, const QString& value ) +void QQtDictionary::insertChild ( int index, const QString& value ) { - insertChild ( index, QQtDictNode ( QVariant ( value ) ) ); + insertChild ( index, QQtDictionary ( QVariant ( value ) ) ); } -void QQtDictNode::insertChild ( int index, const QQtDictNode& dict ) +void QQtDictionary::insertChild ( int index, const QQtDictionary& dict ) { m_type = DictList; //list类 @@ -112,12 +112,12 @@ void QQtDictNode::insertChild ( int index, const QQtDictNode& dict ) this->operator [] ( index ) = dict; } -void QQtDictNode::insertChild ( const QString& key, const QString& value ) +void QQtDictionary::insertChild ( const QString& key, const QString& value ) { - insertChild ( key, QQtDictNode ( QVariant ( value ) ) ); + insertChild ( key, QQtDictionary ( QVariant ( value ) ) ); } -int QQtDictNode::count() const +int QQtDictionary::count() const { int cnt = -1; @@ -131,7 +131,7 @@ int QQtDictNode::count() const return cnt; } -bool QQtDictNode::isNull() const +bool QQtDictionary::isNull() const { if ( m_type == DictMax ) return true; @@ -139,11 +139,11 @@ bool QQtDictNode::isNull() const return false; } -bool QQtDictNode::isValid() const +bool QQtDictionary::isValid() const { return isNull(); } -bool QQtDictNode::isEmpty() const +bool QQtDictionary::isEmpty() const { bool isEmpty = true; @@ -175,7 +175,7 @@ bool QQtDictNode::isEmpty() const } -bool QQtDictNode::isList() const +bool QQtDictionary::isList() const { bool is = false; @@ -185,7 +185,7 @@ bool QQtDictNode::isList() const return is; } -bool QQtDictNode::isMap() const +bool QQtDictionary::isMap() const { bool is = false; @@ -196,7 +196,7 @@ bool QQtDictNode::isMap() const } -bool QQtDictNode::hasChild ( const QString& key ) const +bool QQtDictionary::hasChild ( const QString& key ) const { bool has = false; @@ -206,7 +206,7 @@ bool QQtDictNode::hasChild ( const QString& key ) const return has; } -bool QQtDictNode::hasChild ( const QQtDictNode& value ) const +bool QQtDictionary::hasChild ( const QQtDictionary& value ) const { bool has = false; @@ -217,68 +217,68 @@ bool QQtDictNode::hasChild ( const QQtDictNode& value ) const return has; } -void QQtDictNode::modValue ( const QVariant& value ) +void QQtDictionary::modValue ( const QVariant& value ) { m_type = DictValue; m_value = value; } -void QQtDictNode::modChild ( int index, const QQtDictNode& value ) +void QQtDictionary::modChild ( int index, const QQtDictionary& value ) { m_type = DictList; m_list[index] = value; } -void QQtDictNode::modChild ( QString key, const QQtDictNode& value ) +void QQtDictionary::modChild ( QString key, const QQtDictionary& value ) { m_type = DictMap; m_map[key] = value; } -void QQtDictNode::clear() +void QQtDictionary::clear() { m_value.clear(); m_list.clear(); m_map.clear(); } -void QQtDictNode::remove ( int index ) +void QQtDictionary::remove ( int index ) { m_list.removeAt ( index ); } -void QQtDictNode::remove ( const QString& key ) +void QQtDictionary::remove ( const QString& key ) { m_map.remove ( key ); } -QQtDictNode::QQtDictNode ( const QQtDictNode& other ) +QQtDictionary::QQtDictionary ( const QQtDictionary& other ) { *this = other; } -QQtDictNode::QQtDictNode ( const QQtDictNode::EDictType type ) +QQtDictionary::QQtDictionary ( const QQtDictionary::EDictType type ) { m_type = type; } -const QQtDictNode QQtDictNode::operator[] ( const QString& key ) const +const QQtDictionary QQtDictionary::operator[] ( const QString& key ) const { return m_map[key]; } -const QQtDictNode& QQtDictNode::operator[] ( int index ) const +const QQtDictionary& QQtDictionary::operator[] ( int index ) const { return m_list[index]; } -QQtDictNode::QQtDictNode ( const QVariant& value ) +QQtDictionary::QQtDictionary ( const QVariant& value ) { m_type = DictValue; *this = value; } -QQtDictNode& QQtDictNode::operator [] ( int index ) +QQtDictionary& QQtDictionary::operator [] ( int index ) { m_type = DictList; @@ -293,33 +293,33 @@ QQtDictNode& QQtDictNode::operator [] ( int index ) /*相差的数量*///count -> index+1 = index+1 - count for ( int i = 0; i < index + 1 - cnt; i++ ) - m_list.append ( QQtDictNode() ); + m_list.append ( QQtDictionary() ); } - return ( QQtDictNode& ) m_list.operator [] ( index ); + return ( QQtDictionary& ) m_list.operator [] ( index ); } -QQtDictNode& QQtDictNode::operator [] ( const QString& key ) +QQtDictionary& QQtDictionary::operator [] ( const QString& key ) { m_type = DictMap; return m_map.operator [] ( key ); } -QQtDictNode& QQtDictNode::operator = ( const QMap& map ) +QQtDictionary& QQtDictionary::operator = ( const QMap& map ) { m_type = DictMap; m_map = map; return *this; } -QQtDictNode& QQtDictNode::operator = ( const QList& list ) +QQtDictionary& QQtDictionary::operator = ( const QList& list ) { m_type = DictList; m_list = list; return *this; } -QQtDictNode& QQtDictNode::operator = ( const QQtDictNode& other ) +QQtDictionary& QQtDictionary::operator = ( const QQtDictionary& other ) { EDictType type = other.getType(); @@ -347,14 +347,14 @@ QQtDictNode& QQtDictNode::operator = ( const QQtDictNode& other ) return *this; } -QQtDictNode& QQtDictNode::operator = ( const QVariant& value ) +QQtDictionary& QQtDictionary::operator = ( const QVariant& value ) { m_type = DictValue; m_value = value; return *this; } -bool QQtDictNode::operator == ( const QQtDictNode& other ) const +bool QQtDictionary::operator == ( const QQtDictionary& other ) const { if ( m_type == other.getType() && other.getList() == m_list && @@ -365,36 +365,36 @@ bool QQtDictNode::operator == ( const QQtDictNode& other ) const return false; } -QMap& QQtDictNode::getMap() const +QMap& QQtDictionary::getMap() const { - return ( QMap& ) m_map; + return ( QMap& ) m_map; } -QList& QQtDictNode::getList() const +QList& QQtDictionary::getList() const { - return ( QList& ) m_list; + return ( QList& ) m_list; } -QVariant& QQtDictNode::getValue() const +QVariant& QQtDictionary::getValue() const { return ( QVariant& ) m_value; } -QQtDictNode& QQtDictNode::getChild ( int index ) +QQtDictionary& QQtDictionary::getChild ( int index ) { return m_list[index]; } -QQtDictNode& QQtDictNode::getChild ( const QString& key ) +QQtDictionary& QQtDictionary::getChild ( const QString& key ) { return m_map[key]; } -QDebug& operator<< ( QDebug& dbg, const QQtDictNode& d ) +QDebug& operator<< ( QDebug& dbg, const QQtDictionary& d ) { - if ( d.getType() == QQtDictNode::DictMax ) + if ( d.getType() == QQtDictionary::DictMax ) { dbg << "\n{" << "\n" @@ -403,7 +403,7 @@ QDebug& operator<< ( QDebug& dbg, const QQtDictNode& d ) << " Value:" << d.getValue() << "\n}"; } - else if ( d.getType() == QQtDictNode::DictValue ) + else if ( d.getType() == QQtDictionary::DictValue ) { dbg << "\n{" << "\n" @@ -420,7 +420,7 @@ QDebug& operator<< ( QDebug& dbg, const QQtDictNode& d ) << "\n" << " Count:" << d.count(); - if ( d.getType() == QQtDictNode::DictList ) + if ( d.getType() == QQtDictionary::DictList ) { dbg << "\n" << " List:" << "{"; @@ -432,7 +432,7 @@ QDebug& operator<< ( QDebug& dbg, const QQtDictNode& d ) dbg << "\n" << " }"; } - else if ( d.getType() == QQtDictNode::DictMap ) + else if ( d.getType() == QQtDictionary::DictMap ) { dbg << "\n" << " Map:" << "{"; diff --git a/src/core/qqtdictionary.h b/src/core/qqtdictionary.h index 0183438e..5faafe19 100644 --- a/src/core/qqtdictionary.h +++ b/src/core/qqtdictionary.h @@ -11,14 +11,14 @@ * 简化使用 * 遍历时 */ -class QQtDictNode; -typedef QMap QQtDictNodeMap; -typedef QMapIterator QQtDictNodeMapIterator; -typedef QMutableMapIterator QQtDictNodeMutableMapIterator; +class QQtDictionary; +typedef QMap QQtDictionaryMap; +typedef QMapIterator QQtDictionaryMapIterator; +typedef QMutableMapIterator QQtDictionaryMutableMapIterator; -typedef QList QQtDictNodeList; -typedef QListIterator QQtDictNodeListIterator; -typedef QMutableListIterator QQtDictNodeMutableListIterator; +typedef QList QQtDictionaryList; +typedef QListIterator QQtDictionaryListIterator; +typedef QMutableListIterator QQtDictionaryMutableListIterator; /** * @brief The QQtDictionary class @@ -33,7 +33,7 @@ typedef QMutableListIterator QQtDictNodeMutableListIterator; * QVariant 不能直接获取到真实数据,改变必须使用临时变量。 * 而且,接口设计也不够灵活,存入和取出都不太方便。 */ -class QQTSHARED_EXPORT QQtDictNode +class QQTSHARED_EXPORT QQtDictionary { Q_ENUMS ( EDictType ) @@ -50,8 +50,8 @@ public: } EDictType; /*explicit 函数只能作为构造函数,不能作为拷贝构造函数,拷贝构造函数不可加*/ - explicit QQtDictNode (); - virtual ~QQtDictNode (); + explicit QQtDictionary (); + virtual ~QQtDictionary (); bool isNull() const; bool isValid() const; @@ -65,17 +65,21 @@ public: int count() const; bool hasChild ( const QString& key ) const; - bool hasChild ( const QQtDictNode& value ) const; + bool hasChild ( const QQtDictionary& value ) const; /*获取数据*/ /*获取全部数据*/ - QMap& getMap() const; - QList& getList() const ; + /*获取当前字典的全部数据*/ + /*保存为[key]=[value]的*/ + QMap& getMap() const; + /*保存为index=[value]*/ + QList& getList() const ; /*获取单个数据*/ + /*保存为value的*/ QVariant& getValue() const; - QQtDictNode& getChild ( int index ); - QQtDictNode& getChild ( const QString& key ); + QQtDictionary& getChild ( int index ); + QQtDictionary& getChild ( const QString& key ); /*获取一个个孩子*/ /*类型*/ @@ -90,27 +94,27 @@ public: void setChild ( const QVariant& value ); /*自己本身有孩子,添加全部孩子*/ /*whole value list*/ - void setChild ( const QList& list ); + void setChild ( const QList& list ); /*whole value map*/ - void setChild ( const QMap& map ); + void setChild ( const QMap& map ); /*自己本身没有孩子,添加一个个的孩子*/ /*index = int*/ void appendChild ( const QString& value ); - void appendChild ( const QQtDictNode& dict ); + void appendChild ( const QQtDictionary& dict ); /*自己本身有孩子,添加一个个的孩子*/ /*index = int, 会在之前之后插入,现更改为会替换存在的index*/ /*index = string, 会替换存在的index*/ void insertChild ( int index, const QString& value ); - void insertChild ( int index, const QQtDictNode& dict ); + void insertChild ( int index, const QQtDictionary& dict ); void insertChild ( const QString& key, const QString& value ); - void insertChild ( const QString& key, const QQtDictNode& dict ); + void insertChild ( const QString& key, const QQtDictionary& dict ); /*操作数据,改变数据*/ void modValue ( const QVariant& value ); - void modChild ( int index, const QQtDictNode& value ); - void modChild ( QString key, const QQtDictNode& value ); + void modChild ( int index, const QQtDictionary& value ); + void modChild ( QString key, const QQtDictionary& value ); /*删除数据*/ void clear ( ); @@ -118,23 +122,23 @@ public: void remove ( const QString& key ); /*深拷贝*/ - QQtDictNode ( const QQtDictNode& other ); - QQtDictNode ( const QVariant& value ); - QQtDictNode ( const EDictType type ); + QQtDictionary ( const QQtDictionary& other ); + QQtDictionary ( const QVariant& value ); + QQtDictionary ( const EDictType type ); /*操作符*/ /*警告:可读、可写*/ /*don't out of range? no, it is ok now.*/ - QQtDictNode& operator [] ( int index ); - const QQtDictNode& operator[] ( int index ) const; - QQtDictNode& operator [] ( const QString& key ); - const QQtDictNode operator[] ( const QString& key ) const; + QQtDictionary& operator [] ( int index ); + const QQtDictionary& operator[] ( int index ) const; + QQtDictionary& operator [] ( const QString& key ); + const QQtDictionary operator[] ( const QString& key ) const; - QQtDictNode& operator = ( const QMap& map ); - QQtDictNode& operator = ( const QList& list ); - QQtDictNode& operator = ( const QQtDictNode& other ); - QQtDictNode& operator = ( const QVariant& value ); - bool operator == ( const QQtDictNode& other ) const; + QQtDictionary& operator = ( const QMap& map ); + QQtDictionary& operator = ( const QList& list ); + QQtDictionary& operator = ( const QQtDictionary& other ); + QQtDictionary& operator = ( const QVariant& value ); + bool operator == ( const QQtDictionary& other ) const; /*与其他数据结构兼容*/ QString toXML(); @@ -148,7 +152,7 @@ public: return *this == QVariant ( inst ); } bool operator == ( const QVariant& var ) const { - return *this == QQtDictNode ( var ); + return *this == QQtDictionary ( var ); } //内部类型转换 @@ -168,13 +172,13 @@ private: QVariant m_value; /*不是叶子列表,是个叶子列表,是个叶子列表的值*/ /*列表保存在这里*//*不如仅仅使用map方便*/ - QList m_list; //[index] + QList m_list; //[index] /*不是叶子映射,是个子字典,是个叶子,是个叶子的值组合*/ /*映射保存在这里,QStirng可以升级为QVariant*/ - QMap m_map; + QMap m_map; /*是个列表和子字典,这是错误的,不可能的*/ }; -QDebug& operator<< ( QDebug& dbg, const QQtDictNode& d ); +QDebug& operator<< ( QDebug& dbg, const QQtDictionary& d ); #endif // QQTDICTIONARY_H diff --git a/src/multimedia/qqtaudiomanager.h b/src/multimedia/qqtaudiomanager.h index d38df641..52dd210d 100644 --- a/src/multimedia/qqtaudiomanager.h +++ b/src/multimedia/qqtaudiomanager.h @@ -1,4 +1,4 @@ -#ifndef QQTAUDIOMANAGER_H +#ifndef QQTAUDIOMANAGER_H #define QQTAUDIOMANAGER_H #include @@ -61,12 +61,28 @@ public: explicit QQtAudioManager ( QObject* parent = nullptr ); ~QQtAudioManager(); + + /** + * 选择输入、输出设备 + */ + /*输入、输出音频设备列表,用于显示*/ static QList availableInputDevices(); static QList availableOutputDevices(); + /*当前正在使用的默认输入、输出设备的信息*/ static QAudioDeviceInfo defaultInputDevice(); static QAudioDeviceInfo defaultOutputDevice(); + /*Manager的输入、输出设备的信息,用于切换Manager使用的输入、输出设备*/ + /*读取和修改输入、输出设备。default为默认输入、输出设备*/ + QAudioDeviceInfo& inputDeviceInfo(); + QAudioDeviceInfo& outputDeviceInfo(); + + + /** + * 选择音频流的格式 + */ + /*一般建议设置一个AudioFormat,然后这个format和设置的相等。default为preffered格式*/ //这里保证输入、输出使用格式相等 或者 不同 //如果格式不同,在mac电脑上本地输入输出设备是可以使用的,但是对于连接的语音蓝牙话筒,却是不可以使用的,原因未知。 @@ -75,9 +91,10 @@ public: QAudioFormat& inputAudioFormat ( void ); QAudioFormat& outputAudioFormat ( void ); - /*读取和修改输入、输出设备。default为默认输入、输出设备*/ - QAudioDeviceInfo& inputDeviceInfo(); - QAudioDeviceInfo& outputDeviceInfo(); + + /** + * 操作输入、输出设备 + */ /*对输入设备进行操作*/ /*带输入形参的接口,和这个接口功能相同,忽略那个。*/ @@ -86,6 +103,7 @@ public: QByteArray readAll(); QByteArray read ( qint64 maxlen ); QAudioInput* inputManager(); + //输入设备流句柄,用于对其读取数据。和上边的read函数一样的效果。 QIODevice* inputDevice(); /*对输出设备进行操作*/ @@ -93,9 +111,11 @@ public: void stopOutput(); void write ( const QByteArray& bytes ); QAudioOutput* outputManager(); + //输出设备流句柄,用于对其写入数据。和上边的write函数一样的效果。 QIODevice* outputDevice(); - //这是个方便 + //这是个方便,操作默认输入、输出设备的开关 + //用上边的stop等函数关闭。 //如果使用这个函数,建议:设置公共的AudioFormat,比如输出的format,或者输入、输出都支持的Format。 //这个Format不会跟随默认设备的改变而改变,有初始值,但是用户在使用过程中,有必要关注和更改。 //prefer和nearest并不是default,所以还是需要用户设置。 diff --git a/src/qqt_3rdparty.pri b/src/qqt_3rdparty.pri index 1020b324..cf83f3d6 100644 --- a/src/qqt_3rdparty.pri +++ b/src/qqt_3rdparty.pri @@ -4,7 +4,7 @@ #------------------------------------------------------- #pluginsupport #注释:在qqt_header.pri打开 DEFINES += __PLUGINSUPPORT__ -#TODO: macOS crash +#TODO: macOS runtime crash contains (DEFINES, __PLUGINSUPPORT__) { contains(QKIT_PRIVATE, WIN32|WIN64) { contains (DEFINES, QQT_LIBRARY) { diff --git a/src/qqt_header.pri b/src/qqt_header.pri index dbaf2874..fd833fc6 100644 --- a/src/qqt_header.pri +++ b/src/qqt_header.pri @@ -80,7 +80,7 @@ isEmpty(OBJECTS_DIR):OBJECTS_DIR = obj isEmpty(MOC_DIR):MOC_DIR = obj/moc.cpp isEmpty(UI_DIR):UI_DIR = obj/ui.h isEmpty(RCC_DIR):RCC_DIR = qrc -#这样做保持了App工程和LibQQt工程目录的一致性,但是并不必要。 +#这样做保持了App工程和LibQQt工程中间目录的一致性,但是并不必要。 isEmpty(DESTDIR):DESTDIR = bin ################################################################ @@ -214,7 +214,7 @@ contains (DEFINES, __NETWORKSUPPORT__) { lessThan(QT_MAJOR_VERSION, 5): CONFIG += bluetooth } - ##################WebSocket Module############################### + ##################RawSocket Module############################### #raw socket, 这个是常用的,不要关,dont close。... DEFINES += __TCPUDPSOCKET__ @@ -242,6 +242,7 @@ contains (DEFINES, __NETWORKSUPPORT__) { contains (DEFINES, __WEBENGINESUPPORT__) { } + ##################WebSocket Module############################### #Multi New Protocol 全双工 QWebSocket #if you use QWebSocketSupport , open this annotation DEFINES += __WEBSOCKETSUPPORT__ diff --git a/test/qqtdicttest/tst_qqtdicttesttest.cpp b/test/qqtdicttest/tst_qqtdicttesttest.cpp index 0efa4d00..97c4c2dd 100644 --- a/test/qqtdicttest/tst_qqtdicttesttest.cpp +++ b/test/qqtdicttest/tst_qqtdicttesttest.cpp @@ -19,7 +19,7 @@ private Q_SLOTS: void testCase2(); private: - QQtDictNode dict; + QQtDictionary dict; }; QqtdicttestTest::QqtdicttestTest() @@ -50,7 +50,7 @@ void QqtdicttestTest::testCase1() dict[data] = result; QVERIFY2 ( dict[data].getValue() == result, "Failure" ); - QQtDictNode dict; + QQtDictionary dict; dict["CC"]["DD"]["EE"][0] = "This is a value"; qDebug() << dict["CC"]["DD"]["EE"][0].getValue().toString(); } diff --git a/test/qqtdicttest2/main.cpp b/test/qqtdicttest2/main.cpp index 72583924..a1597f75 100644 --- a/test/qqtdicttest2/main.cpp +++ b/test/qqtdicttest2/main.cpp @@ -22,27 +22,27 @@ int main ( int argc, char* argv[] ) QQtObjectManager::registerObject ( obj ); */ - //对QQtDictNode的使用进行测试。 - QQtDictNode d0; + //对QQtDictionary的使用进行测试。 + QQtDictionary d0; d0["cc"] = "dd"; pline() << d0["cc"].getValue(); - QQtDictNode d1; - QQtDictNode d2 ( QVariant ( "CCCC" ) ); + QQtDictionary d1; + QQtDictionary d2 ( QVariant ( "CCCC" ) ); d1.appendChild ( d2 ); pline() << d1[0].getValue(); d1[0] = "ff"; pline() << d1[0].getValue(); - QQtDictNode d3; + QQtDictionary d3; d3["cc"]["dd"] = "ee"; pline() << d3["cc"]["dd"].getValue().toString(); - QQtDictNode d4; + QQtDictionary d4; for ( int i = 0; i < 5; i++ ) { - QQtDictNode d ( QVariant ( QString::number ( i ) ) ); + QQtDictionary d ( QVariant ( QString::number ( i ) ) ); d4.appendChild ( d ); } @@ -53,7 +53,7 @@ int main ( int argc, char* argv[] ) pline() << d4[i].getValue().toString(); } - QQtDictNode d5; + QQtDictionary d5; /*后续有map操作,这一步就没有用了*/ d5.appendChild ( "5.7" ); @@ -75,7 +75,7 @@ int main ( int argc, char* argv[] ) //pline() << "\n" << d5; pline() << "\n" << d5["5.7"]; - QQtDictNodeMapIterator itor ( d5["5.7"].getMap() ); + QQtDictionaryMapIterator itor ( d5["5.7"].getMap() ); while ( itor.hasNext() ) { @@ -92,7 +92,7 @@ int main ( int argc, char* argv[] ) } pline() << d5["5.7"]["5.7.4"][0]; - QQtDictNode node = d5; + QQtDictionary node = d5; pline() << node["5.7"]["5.7.4"][0][0].getValue().toString(); /*在这里有list操作,前边"5.7"的map就没有用了*/ @@ -114,15 +114,15 @@ int main ( int argc, char* argv[] ) //Widget w; //w.show(); - //QQtDictNode appendChild函数存在一个问题,在这里测试是否解决。 + //QQtDictionary appendChild函数存在一个问题,在这里测试是否解决。 //内部实现使用list的append函数,会引用外部的类实例,这导致在free空间的时候,存在很多莫名其妙的二次free,尤其外部实例和QObject关联的时候。 - //现在内部实现使用push_back,这里检测QQtDictNode还有没有二次free这个bug。 - QQtDictNode* n0 = new QQtDictNode ( QVariant ( "This is a value" ) ); + //现在内部实现使用push_back,这里检测QQtDictionary还有没有二次free这个bug。 + QQtDictionary* n0 = new QQtDictionary ( QVariant ( "This is a value" ) ); //这里打印一下n0的值和地址 pline() << n0->getValue().value(); pline() << hex << n0->getValue().constData(); - QQtDictNode t0; + QQtDictionary t0; //这里appendChild,t0变成一个list。 t0.appendChild ( *n0 ); @@ -145,23 +145,23 @@ int main ( int argc, char* argv[] ) pline() << "检测内部空间的地址:" << hex << t0[0].getValue().constData() ; //windows - //经过测试,QQtDictNode内部空间成功和外部空间分离,bug清除。 + //经过测试,QQtDictionary内部空间成功和外部空间分离,bug清除。 - //测试QQtDictNode的打印能力 - QQtDictNode v00; + //测试QQtDictionary的打印能力 + QQtDictionary v00; pline() << v00; - QQtDictNode v0 ( "This is a value" ); + QQtDictionary v0 ( "This is a value" ); pline() << v0; - QQtDictNode v1; + QQtDictionary v1; v1.appendChild ( "CCCC" ); v1.appendChild ( "DDDD" ); v1[0].appendChild ( "2-CCCC" ); pline() << v1; pline() << v1[0]; - QQtDictNode v2; + QQtDictionary v2; v2["AAAA"] = "NNNN"; v2["BBBB"] = "MMMM"; pline() << v2;