diff --git a/README.md b/README.md index eb02eb4b..342527d7 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,9 @@ LibQQt现进行正式发布版本v2.1.6.0,欢迎工程师们使用。 6. 解决Qt4.8.7在嵌入式屏幕上QGraphics系统不正常绘画的问题 7. QQt输入法 - 重写了UI,适配多种屏幕 -8. Qt对象工厂,允许注册、生成、查找和删除所有来自QObject以及QWidget的类。 +8. Qt对象管理器 + - 用于管理已经生成的Qt对象实例,objectName是唯一查找索引。 + - 含有QQtObjectFactory,用于动态注册、生成来自QObject和QWidget的类。 9. 嵌入式视频播放器,模拟端口实时预览器 0. QQt打印机,支持打印pdf 2. QQtWord,支持doc文档编写,输出pdf格式。 diff --git a/examples/animationframe/animationmanager.cpp b/examples/animationframe/animationmanager.cpp index bd8d1783..97e89906 100644 --- a/examples/animationframe/animationmanager.cpp +++ b/examples/animationframe/animationmanager.cpp @@ -16,12 +16,12 @@ AnimationManager* AnimationManager::Instance(QObject* parent) AnimationManager::AnimationManager(QObject* parent) : QObject(parent) { //init app's all animation - QPushButton* pushButton = (QPushButton*)QQtObjectParcel::registeredObject("pushButton"); - QPushButton* pushButton_2 = (QPushButton*)QQtObjectParcel::registeredObject("pushButton_2"); - QPushButton* pushButton_3 = (QPushButton*)QQtObjectParcel::registeredObject("pushButton_3"); - QPushButton* pushButton_4 = (QPushButton*)QQtObjectParcel::registeredObject("pushButton_4"); - QPushButton* pushButton_5 = (QPushButton*)QQtObjectParcel::registeredObject("pushButton_5"); - QPushButton* pushButton_6 = (QPushButton*)QQtObjectParcel::registeredObject("pushButton_6"); + QPushButton* pushButton = (QPushButton*)QQtObjectManager::registeredObject("pushButton"); + QPushButton* pushButton_2 = (QPushButton*)QQtObjectManager::registeredObject("pushButton_2"); + QPushButton* pushButton_3 = (QPushButton*)QQtObjectManager::registeredObject("pushButton_3"); + QPushButton* pushButton_4 = (QPushButton*)QQtObjectManager::registeredObject("pushButton_4"); + QPushButton* pushButton_5 = (QPushButton*)QQtObjectManager::registeredObject("pushButton_5"); + QPushButton* pushButton_6 = (QPushButton*)QQtObjectManager::registeredObject("pushButton_6"); QQtAnimation* ani = new QQtAnimation(this); QSequentialAnimationGroup* sa = new QSequentialAnimationGroup(ani); diff --git a/examples/animationframe/qqtwindow.cpp b/examples/animationframe/qqtwindow.cpp index c710f0a5..3f84b226 100644 --- a/examples/animationframe/qqtwindow.cpp +++ b/examples/animationframe/qqtwindow.cpp @@ -14,7 +14,7 @@ QQTWindow::QQTWindow(QWidget* parent) : { ui->setupUi(this); - QQtObjectParcel::registerObject(this); + QQtObjectManager::registerObject(this); #ifdef __EMBEDDED_LINUX__ /* @@ -29,12 +29,12 @@ QQTWindow::QQTWindow(QWidget* parent) : setFixedSize(1024, 600); moveCenter(this); - QQtObjectParcel::registerObject(ui->pushButton); - QQtObjectParcel::registerObject(ui->pushButton_2); - QQtObjectParcel::registerObject(ui->pushButton_3); - QQtObjectParcel::registerObject(ui->pushButton_4); - QQtObjectParcel::registerObject(ui->pushButton_5); - QQtObjectParcel::registerObject(ui->pushButton_6); + QQtObjectManager::registerObject(ui->pushButton); + QQtObjectManager::registerObject(ui->pushButton_2); + QQtObjectManager::registerObject(ui->pushButton_3); + QQtObjectManager::registerObject(ui->pushButton_4); + QQtObjectManager::registerObject(ui->pushButton_5); + QQtObjectManager::registerObject(ui->pushButton_6); /** * @brief QQtAnimationManager::Instance diff --git a/examples/qqtframe/qqtwindow.cpp b/examples/qqtframe/qqtwindow.cpp index 0ef3e944..1b108f0e 100644 --- a/examples/qqtframe/qqtwindow.cpp +++ b/examples/qqtframe/qqtwindow.cpp @@ -11,7 +11,7 @@ QQTWindow::QQTWindow(QWidget *parent) : { ui->setupUi(this); - QQtObjectParcel::registerObject(this); + QQtObjectManager::registerObject(this); #ifdef __EMBEDDED_LINUX__ /* diff --git a/src/core/qqtobjectfactory.cpp b/src/core/qqtobjectfactory.cpp deleted file mode 100644 index 4b71ae85..00000000 --- a/src/core/qqtobjectfactory.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "qqtobjectfactory.h" diff --git a/src/core/qqtobjectmanager.cpp b/src/core/qqtobjectmanager.cpp new file mode 100644 index 00000000..fb2c04f7 --- /dev/null +++ b/src/core/qqtobjectmanager.cpp @@ -0,0 +1 @@ +#include "qqtobjectmanager.h" diff --git a/src/core/qqtobjectfactory.h b/src/core/qqtobjectmanager.h similarity index 96% rename from src/core/qqtobjectfactory.h rename to src/core/qqtobjectmanager.h index e6b65a45..3f60552f 100644 --- a/src/core/qqtobjectfactory.h +++ b/src/core/qqtobjectmanager.h @@ -1,5 +1,5 @@ -#ifndef QQTOBJECTFACTORY_H -#define QQTOBJECTFACTORY_H +#ifndef QQTOBJECTMANAGER_H +#define QQTOBJECTMANAGER_H #include #include @@ -122,10 +122,12 @@ private: }; /** - * @brief The QQtObjectParcel class - * QQt 对象管理器 工厂模式 + * @brief The QQtObjectManager class + * QQt 对象管理器 + * 用于管理Qt对象实例。 + * 曾用名 QQtObjectParcel */ -class QQTSHARED_EXPORT QQtObjectParcel +class QQTSHARED_EXPORT QQtObjectManager { public: /** @@ -295,4 +297,4 @@ private: }; #endif -#endif // QQTOBJECTFACTORY_H +#endif // QQTOBJECTMANAGER_H diff --git a/src/frame/qqtprogressdialog.cpp b/src/frame/qqtprogressdialog.cpp index fde5357f..359bfd03 100644 --- a/src/frame/qqtprogressdialog.cpp +++ b/src/frame/qqtprogressdialog.cpp @@ -33,8 +33,8 @@ QQtProgressDialog::QQtProgressDialog(QWidget* parent) : "./skin/default/bk_progress_chunk.png"); #endif - QQtObjectParcel::registerObject(this); - QQtObjectParcel::registerObject(ui->btnCancel); + QQtObjectManager::registerObject(this); + QQtObjectManager::registerObject(ui->btnCancel); } QQtProgressDialog::~QQtProgressDialog() diff --git a/src/highgrade/qqttcpserver.h b/src/highgrade/qqttcpserver.h index 8fa362d8..06cf5d66 100644 --- a/src/highgrade/qqttcpserver.h +++ b/src/highgrade/qqttcpserver.h @@ -7,6 +7,10 @@ #include "qqt-local.h" #include "qqtcore.h" +/** + * @brief The QQtTcpServer class + * 这个类相当于QQtTcpClient管理器,相当于Socket管理器,它包含很多Socket。 + */ class QQTSHARED_EXPORT QQtTcpServer : public QTcpServer { Q_OBJECT diff --git a/src/network/qqttcpclient.cpp b/src/network/qqttcpclient.cpp index 6ddd8614..4c6ed98f 100644 --- a/src/network/qqttcpclient.cpp +++ b/src/network/qqttcpclient.cpp @@ -134,22 +134,22 @@ void QQtTcpClient::socketStateChanged ( QAbstractSocket::SocketState eSocketStat switch ( eSocketState ) { - case QAbstractSocket::HostLookupState: - case QAbstractSocket::ConnectingState: - break; + case QAbstractSocket::HostLookupState: + case QAbstractSocket::ConnectingState: + break; - case QAbstractSocket::ConnectedState: - break; + case QAbstractSocket::ConnectedState: + break; - case QAbstractSocket::ClosingState: - break; + case QAbstractSocket::ClosingState: + break; - case QAbstractSocket::UnconnectedState: - eConType++; - break; + case QAbstractSocket::UnconnectedState: + eConType++; + break; - default: - break; + default: + break; } } @@ -167,13 +167,13 @@ void QQtTcpClient::socketErrorOccured ( QAbstractSocket::SocketError e ) switch ( e ) { - case QAbstractSocket::RemoteHostClosedError: - break; + case QAbstractSocket::RemoteHostClosedError: + break; - case QAbstractSocket::HostNotFoundError: - default: - emit signalConnectFail(); - break; + case QAbstractSocket::HostNotFoundError: + default: + emit signalConnectFail(); + break; } } @@ -217,6 +217,7 @@ void QQtTcpClient::connectToSingelHost() void QQtTcpClient::readyReadData() { + //self, protocol, message QByteArray bytes; bytes = readAll(); m_protocol->translator ( bytes ); diff --git a/src/qqt_source.pri b/src/qqt_source.pri index e121a0a8..e1a88e74 100644 --- a/src/qqt_source.pri +++ b/src/qqt_source.pri @@ -41,11 +41,11 @@ contains (QKIT_PRIVATE, WIN32||WIN64) { SOURCES += \ $$PWD/core/qqtcore.cpp \ $$PWD/core/qqtdictionary.cpp \ - $$PWD/core/qqtobjectfactory.cpp + $$PWD/core/qqtobjectmanager.cpp HEADERS += \ $$PWD/core/qqtcore.h \ $$PWD/core/qqtdictionary.h \ - $$PWD/core/qqtobjectfactory.h + $$PWD/core/qqtobjectmanager.h #后台进程支持,这个只有ios不支持,这个支持在源文件pri里处理。 DEFINES += __PROCESSMODULE__ diff --git a/test/qqtdicttest2/main.cpp b/test/qqtdicttest2/main.cpp index 62889afc..72583924 100644 --- a/test/qqtdicttest2/main.cpp +++ b/test/qqtdicttest2/main.cpp @@ -19,7 +19,7 @@ int main ( int argc, char* argv[] ) pline() << obj->inherits ( "QObject" ); obj->setObjectName ( "bbb" ); pline() << obj->objectName(); - QQtObjectParcel::registerObject ( obj ); + QQtObjectManager::registerObject ( obj ); */ //对QQtDictNode的使用进行测试。 diff --git a/test/qqtffmpegplayer/qqtwindow.cpp b/test/qqtffmpegplayer/qqtwindow.cpp index 0ef3e944..1b108f0e 100644 --- a/test/qqtffmpegplayer/qqtwindow.cpp +++ b/test/qqtffmpegplayer/qqtwindow.cpp @@ -11,7 +11,7 @@ QQTWindow::QQTWindow(QWidget *parent) : { ui->setupUi(this); - QQtObjectParcel::registerObject(this); + QQtObjectManager::registerObject(this); #ifdef __EMBEDDED_LINUX__ /* diff --git a/test/qqtliveplayer/animationmanager.cpp b/test/qqtliveplayer/animationmanager.cpp index 9f996ea9..9ee0c7d9 100644 --- a/test/qqtliveplayer/animationmanager.cpp +++ b/test/qqtliveplayer/animationmanager.cpp @@ -25,7 +25,7 @@ AnimationManager::AnimationManager(QObject *parent) : QObject(parent) * user can't decate qqtwindow */ QQTWindow* qqtwindow = (QQTWindow*) - QQtObjectParcel::registeredObject("QQTWindow"); + QQtObjectManager::registeredObject("QQTWindow"); QQtAnimation* ani = new QQtAnimation(this); QSequentialAnimationGroup* sani = new QSequentialAnimationGroup(ani); QParallelAnimationGroup* pani = new QParallelAnimationGroup(ani); diff --git a/test/qqtliveplayer/qqtwindow.cpp b/test/qqtliveplayer/qqtwindow.cpp index 9cff0fe4..fd5f3867 100644 --- a/test/qqtliveplayer/qqtwindow.cpp +++ b/test/qqtliveplayer/qqtwindow.cpp @@ -22,7 +22,7 @@ QQTWindow::QQTWindow(QWidget *parent) : { ui->setupUi(this); - QQtObjectParcel::registerObject(this); + QQtObjectManager::registerObject(this); #ifdef __EMBEDDED_LINUX__ /* diff --git a/test/qqtwebclient/qqtwindow.cpp b/test/qqtwebclient/qqtwindow.cpp index 5f0253a7..d750c51b 100644 --- a/test/qqtwebclient/qqtwindow.cpp +++ b/test/qqtwebclient/qqtwindow.cpp @@ -17,7 +17,7 @@ QQTWindow::QQTWindow(QWidget *parent) : { ui->setupUi(this); - QQtObjectParcel::registerObject(this); + QQtObjectManager::registerObject(this); #ifdef __EMBEDDED_LINUX__ /* diff --git a/test/qqtwebkittest/qqtwindow.cpp b/test/qqtwebkittest/qqtwindow.cpp index f934aeb2..fb21e71c 100644 --- a/test/qqtwebkittest/qqtwindow.cpp +++ b/test/qqtwebkittest/qqtwindow.cpp @@ -13,7 +13,7 @@ QQTWindow::QQTWindow ( QWidget* parent ) : { ui->setupUi ( this ); - QQtObjectParcel::registerObject ( this ); + QQtObjectManager::registerObject ( this ); #ifdef __EMBEDDED_LINUX__ /*