mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
update dll export
This commit is contained in:
parent
29920bf6ba
commit
35156af561
@ -27,7 +27,8 @@ set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
||||
set(BUILD_SHARED_LIBS ON)
|
||||
set(CMAKE_VERBOSE_MAKEFILE OFF )
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
#set ( CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/build.cmake )
|
||||
|
||||
project(App0OnQQt)
|
||||
@ -56,3 +57,12 @@ add_subdirectory( examples/qqtframe )
|
||||
#add_subdirectory( examples/webkit )
|
||||
|
||||
#set ( CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/../../b1-Product/a0-qqtbased/Application)
|
||||
|
||||
if(APPLE)
|
||||
set (CPACK_GENERATOR Bundle)
|
||||
set (CPACK_BUNDLE_NAME "QQtFrame")
|
||||
set (CPACK_BUNDLE_PLIST "info.plist")
|
||||
set (CPACK_BUNDLE_ICON "app.ico")
|
||||
INCLUDE (CPack)
|
||||
endif(APPLE)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "qqtapp.h"
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
#include "qqtversion.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqtgui.h"
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "qqtapp.h"
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
#include "qqtversion.h"
|
||||
#include "qqtgui.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqtinput.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
greaterThan(QT_MAJOR_VERSION, 4): DEFINES += __QT5__
|
||||
|
||||
TARGET = qqtframe
|
||||
TEMPLATE = app
|
||||
@ -16,12 +17,12 @@ MOC_DIR = obj/moc.cpp
|
||||
UI_DIR = obj/ui.h
|
||||
RCC_DIR = qrc
|
||||
#user directory
|
||||
#DESTDIR = bin
|
||||
DESTDIR = ../../../Product/install/Application
|
||||
DESTDIR = bin
|
||||
#DESTDIR = ../../../Product/install/Application
|
||||
|
||||
INCLUDEPATH += ../qqtfoundation
|
||||
INCLUDEPATH += ../../src
|
||||
|
||||
include(../qqtfoundation/qqtfoundation.pri)
|
||||
include(../../src/qqt.pri)
|
||||
|
||||
QT_KIT = $$(QKIT)
|
||||
|
||||
@ -30,23 +31,34 @@ message($${QT_KIT} Defined in qqtframe)
|
||||
DEFINES += _TTY_POSIX_
|
||||
|
||||
equals(QT_KIT, MIPS32) {
|
||||
QT += multimedia
|
||||
DEFINES += __MIPS_LINUX__
|
||||
} else {
|
||||
DEFINES += __LINUX64__
|
||||
QT += multimedia
|
||||
DEFINES += __MIPS_LINUX__
|
||||
} else:equals(QT_KIT, LINUX) {
|
||||
DEFINES += __LINUX__
|
||||
} else:equals(QT_KIT, LINUX64) {
|
||||
DEFINES += __LINUX64__
|
||||
} else:equals(QT_KIT, WIN) {
|
||||
DEFINES += __WIN__
|
||||
} else:equals(QT_KIT, WIN64) {
|
||||
DEFINES += __WIN64__
|
||||
} else:equals(QT_KIT, macOS) {
|
||||
DEFINES += __DARWIN__
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
} else {
|
||||
DEFINES -= QT_NO_DEBUG_OUTPUT
|
||||
DEFINES -= QT_NO_DEBUG_OUTPUT
|
||||
}
|
||||
|
||||
|
||||
equals(QT_KIT, MIPS32) {
|
||||
mips32.path = /Application
|
||||
INSTALLS += mips32
|
||||
} else {
|
||||
}
|
||||
|
||||
INCLUDEPATH += .
|
||||
|
||||
target.path += /application
|
||||
|
||||
INSTALLS += target
|
||||
|
||||
SOURCES += $$PWD/main.cpp $$PWD/qqtapp.cpp $$PWD/qqtwindow.cpp
|
||||
|
||||
HEADERS += $$PWD/qqtapp.h $$PWD/qqtwindow.h
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "qqtwindow.h"
|
||||
#include "ui_qqtwindow.h"
|
||||
#include "qqtobjectfactory.h"
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqtwidgets.h"
|
||||
|
||||
|
12
qqt.pro
Normal file
12
qqt.pro
Normal file
@ -0,0 +1,12 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += \
|
||||
examples/qqtframe \
|
||||
# examples/animationframe \
|
||||
# examples/cmdwidget \
|
||||
# examples/qqtliveplayer \
|
||||
# examples/qqtffmpegplayer \
|
||||
# examples/qqtftpclient \
|
||||
# examples/qqthttpclient \
|
||||
# examples/qqtwebkit
|
||||
|
||||
#include(src/qqt.pri)
|
@ -1,12 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += \
|
||||
# qqtframe \
|
||||
# animationframe \
|
||||
# cmdwidget \
|
||||
# qqtliveplayer \
|
||||
# qqtffmpegplayer \
|
||||
# qqtftpclient \
|
||||
qqthttpclient
|
||||
# qqtwebkit
|
||||
|
||||
#include(qqtfoundation/qqtfoundation.pri)
|
9
readme.md
Executable file → Normal file
9
readme.md
Executable file → Normal file
@ -1,6 +1,7 @@
|
||||
#QQt Foundation Class
|
||||
|
||||
=============================
|
||||
|
||||
1. 支持绘制图表
|
||||
2. 支持检测USB设备热插拔
|
||||
3. 自定义了一部分特殊需要的控件,比如仅仅使用图片的checkbox
|
||||
@ -10,10 +11,14 @@
|
||||
7. QQt输入法
|
||||
8. Qt对象工厂,允许注册和查找和删除所有来自QObject的类。
|
||||
9. 视频播放器,模拟端口实时预览器
|
||||
10. QQt打印机,支持导出pdf
|
||||
10. QQt打印机,支持导出pdf[^1]
|
||||
11. QQt进度条,解决Qt进度条在Dialog中导致系统死机的问题。
|
||||
12. QQtWord,支持文档编写,输出pdf格式。
|
||||
13. QQtTabWidget,解决QtTab不能竖排的问题
|
||||
14. QQt TreeView,添加Qt内部没有TreeView
|
||||
15. 支持工程的版本变更
|
||||
16. QQt通讯套件。serialport/tcpclient/tcpserver通讯口类和QQTProtocol协议基类和QQTMessage报文基类。
|
||||
16. QQt通讯套件。
|
||||
1. serialport and tcpclient and tcpserver通讯口类
|
||||
2. QQTProtocol协议基类
|
||||
3. QQTMessage报文基类
|
||||
|
||||
|
@ -7,8 +7,9 @@
|
||||
#include <QSequentialAnimationGroup>
|
||||
#include <QPropertyAnimation>
|
||||
#include "qqtcore.h"
|
||||
#include <qqt.h>
|
||||
|
||||
class QQTAnimation : public QParallelAnimationGroup
|
||||
class QQTSHARED_EXPORT QQTAnimation : public QParallelAnimationGroup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <QDebug>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlError>
|
||||
#include <qqt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -76,6 +77,9 @@ typedef unsigned char uint8_t;
|
||||
#define WARNING "Warning"
|
||||
#define NOTICE "Notice"
|
||||
|
||||
|
||||
QQTSHARED_EXPORT void QQTSleep(int millsecond);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
@ -86,37 +90,34 @@ typedef unsigned char uint8_t;
|
||||
#define ptime() pline() << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss zzz")
|
||||
|
||||
|
||||
QQTSHARED_EXPORT QByteArray &operator<<(QByteArray &l, const quint8 r);
|
||||
|
||||
QByteArray &operator<<(QByteArray &l, const quint8 r);
|
||||
QQTSHARED_EXPORT QByteArray &operator<<(QByteArray &l, const quint16 r);
|
||||
|
||||
QByteArray &operator<<(QByteArray &l, const quint16 r);
|
||||
QQTSHARED_EXPORT QByteArray &operator<<(QByteArray &l, const quint32 r);
|
||||
|
||||
QByteArray &operator<<(QByteArray &l, const quint32 r);
|
||||
QQTSHARED_EXPORT QByteArray &operator<<(QByteArray &l, const QByteArray &r);
|
||||
|
||||
QByteArray &operator<<(QByteArray &l, const QByteArray &r);
|
||||
QQTSHARED_EXPORT QByteArray &operator>>(QByteArray &l, quint8& r);
|
||||
|
||||
QByteArray &operator>>(QByteArray &l, quint8& r);
|
||||
QQTSHARED_EXPORT QByteArray &operator>>(QByteArray &l, quint16& r);
|
||||
|
||||
QByteArray &operator>>(QByteArray &l, quint16& r);
|
||||
QQTSHARED_EXPORT QByteArray &operator>>(QByteArray &l, quint32& r);
|
||||
|
||||
QByteArray &operator>>(QByteArray &l, quint32& r);
|
||||
QQTSHARED_EXPORT QByteArray &operator>>(QByteArray &l, QByteArray& r);
|
||||
|
||||
QByteArray &operator>>(QByteArray &l, QByteArray& r);
|
||||
QQTSHARED_EXPORT QByteArray &operator<<(QByteArray &l, const qint16 r);
|
||||
|
||||
QByteArray &operator<<(QByteArray &l, const qint16 r);
|
||||
QQTSHARED_EXPORT QByteArray &operator<<(QByteArray &l, const qint32 r);
|
||||
|
||||
QByteArray &operator<<(QByteArray &l, const qint32 r);
|
||||
QQTSHARED_EXPORT QByteArray &operator>>(QByteArray &l, qint8& r);
|
||||
|
||||
QByteArray &operator>>(QByteArray &l, qint8& r);
|
||||
QQTSHARED_EXPORT QByteArray &operator>>(QByteArray &l, qint16& r);
|
||||
|
||||
QByteArray &operator>>(QByteArray &l, qint16& r);
|
||||
QQTSHARED_EXPORT QByteArray &operator>>(QByteArray &l, qint32& r);
|
||||
|
||||
QByteArray &operator>>(QByteArray &l, qint32& r);
|
||||
QQTSHARED_EXPORT QByteArray &operator>>(QByteArray &l, QByteArray& r);
|
||||
|
||||
QByteArray &operator>>(QByteArray &l, QByteArray& r);
|
||||
|
||||
|
||||
void QQTSleep(int millsecond);
|
||||
|
||||
/**
|
||||
* @brief The QQTBlock class
|
||||
@ -124,7 +125,7 @@ void QQTSleep(int millsecond);
|
||||
* 这个block应用场合为gui线程内部,不适用线程之间
|
||||
* 仅仅锁定一次和解锁一次,多次锁定和解锁无用途。
|
||||
*/
|
||||
class QQTBlock : public QObject
|
||||
class QQTSHARED_EXPORT QQTBlock : public QObject
|
||||
{
|
||||
public:
|
||||
explicit QQTBlock(QObject* parent = 0): QObject(parent), m_lock(0) {}
|
||||
|
@ -7,12 +7,13 @@
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QListIterator>
|
||||
#include <qqt.h>
|
||||
|
||||
/**
|
||||
* @brief The QQTObjectFactory class
|
||||
* QQT 对象管理器 工厂模式
|
||||
*/
|
||||
class QQTObjectFactory
|
||||
class QQTSHARED_EXPORT QQTObjectFactory
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef _JZ_DMMU_H_
|
||||
#define _JZ_DMMU_H_
|
||||
|
||||
#include <qqt.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define DMMU_DEV_NAME "/dev/dmmu"
|
||||
@ -18,21 +20,21 @@ __BEGIN_DECLS
|
||||
#define VIDEO_TABLE_FLAGE 1
|
||||
|
||||
struct dmmu_mem_info {
|
||||
int size;
|
||||
int page_count;
|
||||
int size;
|
||||
int page_count;
|
||||
|
||||
unsigned int paddr;
|
||||
unsigned int paddr;
|
||||
|
||||
void *vaddr;
|
||||
void *pages_phys_addr_table;
|
||||
void *vaddr;
|
||||
void *pages_phys_addr_table;
|
||||
|
||||
unsigned int start_offset;
|
||||
unsigned int end_offset;
|
||||
unsigned int start_offset;
|
||||
unsigned int end_offset;
|
||||
};
|
||||
|
||||
static inline void init_page_count(struct dmmu_mem_info *info)
|
||||
{
|
||||
int page_count;
|
||||
int page_count;
|
||||
#ifdef __MIPS_LINUX__
|
||||
unsigned int start; /* page start */
|
||||
unsigned int end; /* page end */
|
||||
@ -59,48 +61,48 @@ static inline void init_page_count(struct dmmu_mem_info *info)
|
||||
// printf("<----start_offset: %x, end_offset: %x, page_count: %d\n", info->start_offset, info->end_offset, page_count);
|
||||
#endif
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int dump_mem_info(struct dmmu_mem_info *mem, char * description)
|
||||
{
|
||||
if (mem == NULL) {
|
||||
printf("mem is NULL!\n");
|
||||
return -1;
|
||||
}
|
||||
printf("mem: %p, \t%s\n", mem, description?description:"");
|
||||
printf("\tvaddr= %p\n", mem->vaddr);
|
||||
printf("\tsize= %d (0x%x)\n", mem->size, mem->size);
|
||||
printf("\tpaddr= 0x%08x\n", mem->paddr);
|
||||
printf("\tpage_count= %d\n", mem->page_count);
|
||||
printf("\tpages_phys_addr_table=%p\n", mem->pages_phys_addr_table);
|
||||
printf("\tstart_offset= %d\n", mem->start_offset);
|
||||
printf("\tend_offset= %d\n", mem->end_offset);
|
||||
if (mem == NULL) {
|
||||
printf("mem is NULL!\n");
|
||||
return -1;
|
||||
}
|
||||
printf("mem: %p, \t%s\n", mem, description?description:"");
|
||||
printf("\tvaddr= %p\n", mem->vaddr);
|
||||
printf("\tsize= %d (0x%x)\n", mem->size, mem->size);
|
||||
printf("\tpaddr= 0x%08x\n", mem->paddr);
|
||||
printf("\tpage_count= %d\n", mem->page_count);
|
||||
printf("\tpages_phys_addr_table=%p\n", mem->pages_phys_addr_table);
|
||||
printf("\tstart_offset= %d\n", mem->start_offset);
|
||||
printf("\tend_offset= %d\n", mem->end_offset);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum REQUIRE_ALLOC_PAGE_TABLE {
|
||||
NO_REQUIRED = 0,
|
||||
REQUIRED = 1,
|
||||
NO_REQUIRED = 0,
|
||||
REQUIRED = 1,
|
||||
};
|
||||
|
||||
extern int dmmu_init();
|
||||
extern int dmmu_set_table_flag(void);
|
||||
extern int dmmu_init_with_set_page_table(unsigned int * phys_addr, int size);
|
||||
extern int dmmu_deinit();
|
||||
extern int dmmu_get_page_table_base_phys(unsigned int * phys_addr);
|
||||
extern int dmmu_set_page_table(unsigned int * phys_addr, int size);
|
||||
extern int dmmu_map_user_memory(struct dmmu_mem_info* mem);
|
||||
extern int dmmu_unmap_user_memory(struct dmmu_mem_info* mem);
|
||||
QQTSHARED_EXPORT extern int dmmu_init();
|
||||
QQTSHARED_EXPORT extern int dmmu_set_table_flag(void);
|
||||
QQTSHARED_EXPORT extern int dmmu_init_with_set_page_table(unsigned int * phys_addr, int size);
|
||||
QQTSHARED_EXPORT extern int dmmu_deinit();
|
||||
QQTSHARED_EXPORT extern int dmmu_get_page_table_base_phys(unsigned int * phys_addr);
|
||||
QQTSHARED_EXPORT extern int dmmu_set_page_table(unsigned int * phys_addr, int size);
|
||||
QQTSHARED_EXPORT extern int dmmu_map_user_memory(struct dmmu_mem_info* mem);
|
||||
QQTSHARED_EXPORT extern int dmmu_unmap_user_memory(struct dmmu_mem_info* mem);
|
||||
|
||||
extern int dmmu_map_user_mem(void * vaddr, int size);
|
||||
extern int dmmu_unmap_user_mem(void * vaddr, int size);
|
||||
QQTSHARED_EXPORT extern int dmmu_map_user_mem(void * vaddr, int size);
|
||||
QQTSHARED_EXPORT extern int dmmu_unmap_user_mem(void * vaddr, int size);
|
||||
|
||||
extern int dmmu_match_user_mem_tlb(void * vaddr, int size);
|
||||
QQTSHARED_EXPORT extern int dmmu_match_user_mem_tlb(void * vaddr, int size);
|
||||
|
||||
extern int dmmu_get_memory_physical_address(struct dmmu_mem_info* mem);
|
||||
extern int dmmu_release_memory_physical_address(struct dmmu_mem_info* mem);
|
||||
QQTSHARED_EXPORT extern int dmmu_get_memory_physical_address(struct dmmu_mem_info* mem);
|
||||
QQTSHARED_EXPORT extern int dmmu_release_memory_physical_address(struct dmmu_mem_info* mem);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define QQTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <qqt.h>
|
||||
|
||||
namespace Ui {
|
||||
class QQTDialog;
|
||||
@ -10,7 +11,7 @@ class QQTDialog;
|
||||
/**
|
||||
* @brief QSS
|
||||
*/
|
||||
class QQTDialog : public QDialog
|
||||
class QQTSHARED_EXPORT QQTDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -13,13 +13,14 @@
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
#include <QTextCodec>
|
||||
#include <qqt.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class frmInput;
|
||||
}
|
||||
|
||||
class QQTInput : public QWidget
|
||||
class QQTSHARED_EXPORT QQTInput : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define QQTMSGBOX_H
|
||||
|
||||
#include "qqtdialog.h"
|
||||
#include <qqt.h>
|
||||
|
||||
namespace Ui {
|
||||
class QQTMsgBox;
|
||||
@ -11,7 +12,7 @@ class QQTMsgBox;
|
||||
* @brief The QQTMsgBox class
|
||||
*
|
||||
*/
|
||||
class QQTMsgBox : public QQTDialog
|
||||
class QQTSHARED_EXPORT QQTMsgBox : public QQTDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -2,12 +2,13 @@
|
||||
#define QQTPASSWORDDIALOG_H
|
||||
|
||||
#include "qqtdialog.h"
|
||||
#include "qqt.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTPasswordDialog;
|
||||
}
|
||||
|
||||
class QQTPasswordDialog : public QQTDialog
|
||||
class QQTSHARED_EXPORT QQTPasswordDialog : public QQTDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
#ifndef QPREVIEWUI_H
|
||||
#define QPREVIEWUI_H
|
||||
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
#include "qqtlinux.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -23,7 +24,7 @@ namespace Ui {
|
||||
class QQTPreviewWidget;
|
||||
}
|
||||
|
||||
class QQTPreviewWidget : public QWidget
|
||||
class QQTSHARED_EXPORT QQTPreviewWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -3,12 +3,13 @@
|
||||
|
||||
#include "qqtdialog.h"
|
||||
#include "qqtprogressbar.h"
|
||||
#include "qqt.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTProgressDialog;
|
||||
}
|
||||
|
||||
class QQTProgressDialog : public QQTDialog
|
||||
class QQTSHARED_EXPORT QQTProgressDialog : public QQTDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
#include "qqtreport.h"
|
||||
|
||||
QQTReport::QQTReport(QObject *parent) :
|
||||
QQTWord(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void QQTReport::createSampleReport(const QString &head, const QString &foot, const QString &title, const QTableView *table)
|
||||
{
|
||||
initWord();
|
||||
setHeaderText(head);
|
||||
setFooterText(foot);
|
||||
addText(title, titleFont());
|
||||
//addText("");
|
||||
addText("试验结果", title2Font(), Qt::AlignLeft);
|
||||
//addText("");
|
||||
addTable(table);
|
||||
addSignoffText("打印人:___________");
|
||||
}
|
||||
|
||||
void QQTReport::CreateComplexReport(const QString &head, const QString &foot,
|
||||
const QString &title, const QList<QTableView *> &table)
|
||||
{
|
||||
initWord();
|
||||
setHeaderText(head);
|
||||
setFooterText(foot);
|
||||
addText(title, titleFont());
|
||||
//addText("");
|
||||
addText("试验结果", title2Font(), Qt::AlignLeft);
|
||||
QListIterator<QTableView*> itor(table);
|
||||
while(itor.hasNext())
|
||||
{
|
||||
QTableView* view = itor.next();
|
||||
addTable(view);
|
||||
addText("");
|
||||
}
|
||||
addSignoffText("打印人:___________");
|
||||
}
|
||||
|
||||
|
||||
QQTReport *QQTReportInstance(QObject *parent)
|
||||
{
|
||||
static QQTReport* r = new QQTReport(parent);
|
||||
return r;
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
#ifndef QQTREPORT_H
|
||||
#define QQTREPORT_H
|
||||
|
||||
#include "qqtword.h"
|
||||
|
||||
class QQTReport : public QQTWord
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTReport(QObject *parent = 0);
|
||||
|
||||
void createSampleReport(const QString& head, const QString& foot, const QString& title,
|
||||
const QTableView* table);
|
||||
|
||||
void CreateComplexReport(const QString &head, const QString &foot,
|
||||
const QString &title, const QList<QTableView *> &table);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
// QQTWord interface
|
||||
protected:
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
QQTReport* QQTReportInstance(QObject* parent);
|
||||
|
||||
#endif // QQTREPORT_H
|
@ -2,14 +2,15 @@
|
||||
#define QQTWIFIWIDGET_H
|
||||
|
||||
#include "qstandarditemmodel.h"
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
#include "qqtgui.h"
|
||||
#include "qqtpassworddialog.h"
|
||||
#include <QItemDelegate>
|
||||
#include <QStylePainter>
|
||||
#include "qqtcore.h"
|
||||
#include "qqt.h"
|
||||
|
||||
class QQTWIFIIDTextDelegate : public QItemDelegate
|
||||
class QQTSHARED_EXPORT QQTWIFIIDTextDelegate : public QItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqtprinter.h"
|
||||
#include "qqtgraphicsscene.h"
|
||||
|
@ -2,9 +2,10 @@
|
||||
#define QQTWORD_H
|
||||
|
||||
#include <QObject>
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
#include "qqtprinter.h"
|
||||
#include "qqtgraphicsscene.h"
|
||||
#include "qqt.h"
|
||||
|
||||
enum ESpanFlag
|
||||
{
|
||||
@ -18,7 +19,7 @@ enum ESpanFlag
|
||||
|
||||
Q_DECLARE_FLAGS(ESpanFlags, ESpanFlag)
|
||||
|
||||
class QQTWord : public QObject
|
||||
class QQTSHARED_EXPORT QQTWord : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define QQTFTPTREEMODEL_H
|
||||
|
||||
#include <QObject>
|
||||
#include "qqt.h"
|
||||
|
||||
class QQtFTPTreeModel : public QObject
|
||||
class QQTSHARED_EXPORT QQtFTPTreeModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
4
src/gui/qqtgui.h
Normal file
4
src/gui/qqtgui.h
Normal file
@ -0,0 +1,4 @@
|
||||
#ifndef QQTGUI_H
|
||||
#define QQTGUI_H
|
||||
|
||||
#endif // QQTGUI_H
|
@ -4,8 +4,9 @@
|
||||
#include <qqttreemodel.h>
|
||||
#include <qqttablemodel.h>
|
||||
#include <QList>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQTSqlTreeModel : public QQTTreeModel
|
||||
class QQTSHARED_EXPORT QQTSqlTreeModel : public QQTTreeModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -2,12 +2,13 @@
|
||||
#define QQTTABLEMODEL_H
|
||||
|
||||
#include <QSqlRelationalTableModel>
|
||||
#include <qqt.h>
|
||||
|
||||
/**
|
||||
* @brief The QQTTableModel class
|
||||
* QQTSqlRelationalTableModel 方便起见,仅仅使用这个model
|
||||
*/
|
||||
class QQTTableModel : public QSqlRelationalTableModel
|
||||
class QQTSHARED_EXPORT QQTTableModel : public QSqlRelationalTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -2,12 +2,14 @@
|
||||
#define QQTTREEMODEL_H
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <qqt.h>
|
||||
|
||||
/**
|
||||
* this is a interface class
|
||||
* define the tree model's functions name.
|
||||
*/
|
||||
|
||||
class QQTTreeModel : public QStandardItemModel
|
||||
class QQTSHARED_EXPORT QQTTreeModel : public QStandardItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -3,8 +3,9 @@
|
||||
|
||||
#include <qqttreemodel.h>
|
||||
#include <QDomDocument>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQTXmlTreeModel : public QQTTreeModel
|
||||
class QQTSHARED_EXPORT QQTXmlTreeModel : public QQTTreeModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define QQTMPLAYER_H
|
||||
|
||||
#include <QProcess>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQTPlayer : public QObject
|
||||
class QQTSHARED_EXPORT QQTPlayer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -6,8 +6,9 @@
|
||||
#define QQT_CLIENT_H
|
||||
|
||||
#include <QTcpSocket>
|
||||
#include "qqtprotocol.h"
|
||||
#include "QStringList"
|
||||
#include "qqtprotocol.h"
|
||||
#include "qqt.h"
|
||||
|
||||
#define TANK_Q_TCP_SOCKET 0
|
||||
#define TANK_Q_SOCKET 1
|
||||
@ -18,7 +19,7 @@
|
||||
/**
|
||||
* @brief 客户端决定和协议的交互关系;只跟协议打交道;
|
||||
*/
|
||||
class QQTClient : public QTcpSocket
|
||||
class QQTSHARED_EXPORT QQTClient : public QTcpSocket
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -1,965 +0,0 @@
|
||||
#include "qqtcloudprotocol.h"
|
||||
#include "qqtversion.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqtgui-qt.h"
|
||||
|
||||
QQTClient *QQTUpgradeClientInstance(QObject *parent)
|
||||
{
|
||||
static QQTClient* cli = NULL;
|
||||
if(!cli)
|
||||
{
|
||||
QStringList ip;
|
||||
ip << "222.175.114.244" << "124.133.1.54";
|
||||
//"www.QQToo.com"
|
||||
cli = new QQTClient(parent);
|
||||
cli->SetServerIPAddress(ip);
|
||||
cli->SetServerPort(8089);
|
||||
}
|
||||
return cli;
|
||||
}
|
||||
|
||||
QQTClient *QQTCloudClientInstance(QObject *parent)
|
||||
{
|
||||
static QQTClient* cli = NULL;
|
||||
if(!cli)
|
||||
{
|
||||
QStringList ip;
|
||||
ip << "222.175.114.244" << "124.133.1.54";
|
||||
cli = new QQTClient(parent);
|
||||
cli->SetServerIPAddress(ip);
|
||||
cli->SetServerPort(7079);
|
||||
}
|
||||
return cli;
|
||||
}
|
||||
|
||||
|
||||
QQTCloudProtocol::QQTCloudProtocol(QObject *parent) : QQTProtocol(parent)
|
||||
{
|
||||
m_isLogined = false;
|
||||
m_heartCount = 0;
|
||||
m_UID = 0;
|
||||
timer = new QTimer(this);
|
||||
timer->setSingleShot(false);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(sendHeatBeatMessage()));
|
||||
|
||||
connect(this, SIGNAL(signalSendData()), this, SLOT(sendUploadFileData()), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(signalDownData()), this, SLOT(sendDownFileData()), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(signalDownSucc()), this, SLOT(sendDownFileSuccess()), Qt::QueuedConnection );
|
||||
|
||||
|
||||
}
|
||||
|
||||
QTCheckVersionResult &QQTCloudProtocol::GetVersionResult() { return m_versionresult; }
|
||||
|
||||
QTCloudListDirResult &QQTCloudProtocol::GetDirList() { return m_dirs; }
|
||||
|
||||
QTCloudListFileResult &QQTCloudProtocol::GetListedFiles() { return m_files; }
|
||||
|
||||
bool QQTCloudProtocol::isLogined() { return m_isLogined; }
|
||||
|
||||
void QQTCloudProtocol::startHeartBeat()
|
||||
{
|
||||
m_heartCount = 0;
|
||||
/*
|
||||
* TODO:心跳检测重连会不会引发这条消息?
|
||||
* 如果连接还未成功开始发送心跳包,
|
||||
* QNativeSocketEngine::write() was not called in QAbstractSocket::ConnectedState
|
||||
*/
|
||||
timer->start(30 * 1000);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::stopHeartBeat()
|
||||
{
|
||||
m_heartCount = MAX_HEARDBEAT + 1;
|
||||
timer->stop();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendMessage(quint16 cmd, QByteArray &data)
|
||||
{
|
||||
QQTNetworkMessage qMsg;
|
||||
qMsg.setUid(m_UID);
|
||||
qMsg.setCmd(cmd);
|
||||
qMsg.setData(data);
|
||||
qMsg.translate();
|
||||
//pline() << qMsg;
|
||||
QByteArray b;
|
||||
qMsg.packer(b);
|
||||
write(b);
|
||||
}
|
||||
|
||||
bool QQTCloudProtocol::dispatcher(const QByteArray &m)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
QQTNetworkMessage qMsg;
|
||||
qMsg.parser(m);
|
||||
//pline() << qMsg;
|
||||
|
||||
switch(qMsg.cmd())
|
||||
{
|
||||
case _TCPCMD_LOGINRESUALT:
|
||||
recvLoginResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_HEARTBEATRESP:
|
||||
recvHeatBeatResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_CHECKVERSIONRSP:
|
||||
recvCheckVersionResult(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVEDIRLIST:
|
||||
recvListDirResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVEADDRESUALT:
|
||||
recvAddDirResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVEALTERRESUALT:
|
||||
recvModDirResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVEDELETERESUALT:
|
||||
recvDelDirResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVEFILELIST:
|
||||
recvListFilesResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVEPUBLICDIRLIST:
|
||||
recvListPubDirResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVEPUBLICFILELIST:
|
||||
recvListPubFilesResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVEFILEINFO:
|
||||
recvDownFileResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVEFILEDATA:
|
||||
recvDownFileDataResultMessage(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVECOMFIREFILEINFO:
|
||||
recvUploadFileResult(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVECOMFIREFILEDATA:
|
||||
recvUploadFileDataResult(qMsg);
|
||||
break;
|
||||
case _TCPCMD_RECEIVECOMFIREFILE:
|
||||
recvUploadFileSuccess(qMsg);
|
||||
break;
|
||||
default:
|
||||
//pline() << "receive unknown command:" << hex << qMsg.cmd();
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void QQTCloudProtocol::sendHeatBeatMessage()
|
||||
{
|
||||
/*
|
||||
* 断链判断 如果断链 TODO:
|
||||
*/
|
||||
if(m_heartCount > MAX_HEARDBEAT)
|
||||
{
|
||||
#if 1
|
||||
/*
|
||||
* 重连策略 30 * 2 s
|
||||
*/
|
||||
static int curp = 0;
|
||||
if(curp >= 2)
|
||||
{
|
||||
curp = 0;
|
||||
emit signalReconnectQequest();
|
||||
return;
|
||||
}
|
||||
curp++;
|
||||
#else
|
||||
/*
|
||||
* 此处设置重连策略 30s 150s 300s 600s
|
||||
*/
|
||||
static int p[4] = {1, 5, 10, 20};
|
||||
static int curp = 0;
|
||||
static int curpos = 0;
|
||||
if(curp >= p[curpos])
|
||||
{
|
||||
curp = 0;
|
||||
curpos = (curpos + 1) % 4;
|
||||
connectToSingelHost();
|
||||
return;
|
||||
}
|
||||
curp++;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
pline() << "HeartBeat Count:" << m_heartCount;
|
||||
m_heartCount++;
|
||||
QQTNetworkMessage qMsg;
|
||||
qMsg.setUid(m_UID);
|
||||
qMsg.setCmd(_TCPCMD_HEART);
|
||||
qMsg.translate();
|
||||
pline() << qMsg;
|
||||
QByteArray b;
|
||||
qMsg.packer(b);
|
||||
write(b);
|
||||
//waitForBytesWritten();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendLoginMessage()
|
||||
{
|
||||
/*
|
||||
* 这个地方可能要改动,串口发过来的时字符串,不是hex
|
||||
*/
|
||||
QSettings set;
|
||||
QByteArray _name = set.value("Device/DeviceNo").toByteArray();
|
||||
QByteArray _pwd = set.value("Device/Password").toByteArray();
|
||||
|
||||
QString name, pwd;
|
||||
for(int i = 0; i < _name.size(); i++)
|
||||
name += QString::number((quint8)_name[i], 16);
|
||||
for(int i = 0; i < _pwd.size(); i++)
|
||||
pwd += QString::number((quint8)_pwd[i], 16);
|
||||
name = name.toUpper();
|
||||
pwd = pwd.toUpper();
|
||||
|
||||
m_isLogined = false;
|
||||
QTCloudLogin t;
|
||||
t.m_name = name;
|
||||
t.m_password = pwd;
|
||||
QQTNetworkMessage qMsg;
|
||||
qMsg.setUid(m_UID);
|
||||
qMsg.setCmd(_TCPCMD_LOGIN);
|
||||
QByteArray d;
|
||||
packLoginData(d, t);
|
||||
qMsg.setData(d);
|
||||
qMsg.translate();
|
||||
//pline() << qMsg;
|
||||
QByteArray b;
|
||||
qMsg.packer(b);
|
||||
write(b);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendLogoutMessage()
|
||||
{
|
||||
m_isLogined = false;
|
||||
QQTNetworkMessage qMsg;
|
||||
qMsg.setUid(m_UID);
|
||||
qMsg.setCmd(_TCPCMD_EXIT);
|
||||
qMsg.translate();
|
||||
//pline() << qMsg;
|
||||
QByteArray b;
|
||||
qMsg.packer(b);
|
||||
write(b);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvConnPoolFullMessage(QQTNetworkMessage &){}
|
||||
|
||||
|
||||
void QQTCloudProtocol::recvLoginResultMessage(QQTNetworkMessage& qMsg)
|
||||
{
|
||||
m_UID = qMsg.uid();
|
||||
QTCloudLoginResult qtLoginResult;
|
||||
parseLoginResultData(qtLoginResult, qMsg.data());
|
||||
switch(qtLoginResult.m_result)
|
||||
{
|
||||
case 0x00:
|
||||
{
|
||||
pline() << "Login success id:" << hex << m_UID;
|
||||
m_isLogined = true;
|
||||
emit signalLoginSucc();
|
||||
}
|
||||
break;
|
||||
case 0x10:
|
||||
pline() << "Other user logined";
|
||||
break;
|
||||
case 0x11:
|
||||
pline() << "User unexisted";
|
||||
break;
|
||||
case 0x12:
|
||||
pline() << "Password error upflowed";
|
||||
break;
|
||||
case 0x23:
|
||||
case 0x22:
|
||||
case 0x21:
|
||||
pline() << "Password error" << hex << qtLoginResult.m_result;
|
||||
break;
|
||||
case 0xFF:
|
||||
default:
|
||||
pline() << "unknown error" << qtLoginResult.m_result;
|
||||
break;
|
||||
}
|
||||
|
||||
if(0x00 != qtLoginResult.m_result)
|
||||
emit signalLoginFail();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvHeatBeatResultMessage(QQTNetworkMessage &)
|
||||
{
|
||||
m_heartCount = 0;
|
||||
pline() << "HeartBeat Callback";
|
||||
}
|
||||
|
||||
|
||||
void QQTCloudProtocol::packCheckVersionData(QByteArray &l, const QTCheckVersion &t)
|
||||
{
|
||||
packKeyWordToByteArray(l, _TCP_SECTION_SOFTWAREID, t.m_softwareid);
|
||||
packKeyWordToByteArray(l, _TCP_SECTION_DEVICECODE, t.m_devicecode);
|
||||
packKeyWordToByteArray(l, _TCP_SECTION_SOFTWARECODE, t.m_softwarecode);
|
||||
packKeyWordToByteArray(l, _TCP_SECTION_VERSION, t.m_version);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::parseCheckVersionResultData(QTCheckVersionResult &t, const QByteArray &l)
|
||||
{
|
||||
quint32 pos = 0;
|
||||
QByteArray b = l;
|
||||
t.m_softwareid = parseKeyWordInByteArray(b, _TCP_SECTION_SOFTWAREID, pos);
|
||||
t.m_devicecode = parseKeyWordInByteArray(b, _TCP_SECTION_DEVICECODE, pos);
|
||||
t.m_softwarecode = parseKeyWordInByteArray(b, _TCP_SECTION_SOFTWARECODE, pos);
|
||||
t.m_version = parseKeyWordInByteArray(b, _TCP_SECTION_VERSION, pos);
|
||||
t.m_NewSoftwareID = parseKeyWordInByteArray(b, _TCP_SECTION_NEWSOFTWAREID, pos);
|
||||
|
||||
/*
|
||||
* 和公共文件区域的一样,郑工服务器端按照
|
||||
*/
|
||||
QByteArray m_Explain = parseKeyWordInByteArray(b, _TCP_SECTION_EXPLAIN, pos);
|
||||
QTextCodec *Codec = QTextCodec::codecForName("gbk");
|
||||
t.m_Explain = Codec->toUnicode(m_Explain);
|
||||
|
||||
t.m_ReleaseStatus = parseKeyWordInByteArray(b, _TCP_SECTION_RELEASESTAT, pos);
|
||||
t.m_ReleaseDate = parseKeyWordInByteArray(b, _TCP_SECTION_RELEASEDATE, pos);
|
||||
t.m_FileName = parseKeyWordInByteArray(b, _TCP_SECTION_FILENAME, pos);
|
||||
t.m_FileMD5 = parseKeyWordInByteArray(b, _TCP_SECTION_FILEMD5, pos);
|
||||
t.m_FileSize = parseKeyWordInByteArray(b, _TCP_SECTION_FILESIZE, pos);
|
||||
}
|
||||
|
||||
|
||||
void QQTCloudProtocol::sendCheckVersion()
|
||||
{
|
||||
QTCheckVersion t;
|
||||
t.m_softwareid = "0";
|
||||
t.m_devicecode = "0601";
|
||||
t.m_softwarecode = "211100";
|
||||
t.m_version = VER_FILEVERSION_STR;
|
||||
quint16 _tcpcmd = _TCPCMD_CHECKVERSION;
|
||||
|
||||
QQTNetworkMessage qMsg;
|
||||
qMsg.setUid(m_UID);
|
||||
qMsg.setCmd(_tcpcmd);
|
||||
QByteArray d;
|
||||
packCheckVersionData(d, t);
|
||||
qMsg.setData(d);
|
||||
qMsg.translate();
|
||||
//pline() << qMsg;
|
||||
QByteArray b;
|
||||
qMsg.packer(b);
|
||||
write(b);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendCheckNewVersion()
|
||||
{
|
||||
QTCheckVersion t;
|
||||
t.m_softwareid = m_versionresult.m_NewSoftwareID;
|
||||
t.m_devicecode = "";
|
||||
t.m_softwarecode = "";
|
||||
t.m_version = VER_FILEVERSION_STR;
|
||||
quint16 _tcpcmd = _TCPCMD_CHECKVERSION;
|
||||
|
||||
QQTNetworkMessage qMsg;
|
||||
qMsg.setUid(m_UID);
|
||||
qMsg.setCmd(_tcpcmd);
|
||||
QByteArray d;
|
||||
packCheckVersionData(d, t);
|
||||
qMsg.setData(d);
|
||||
qMsg.translate();
|
||||
//pline() << qMsg;
|
||||
QByteArray b;
|
||||
qMsg.packer(b);
|
||||
write(b);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvCheckVersionResult(QQTNetworkMessage &qMsg)
|
||||
{
|
||||
parseCheckVersionResultData(m_versionresult, qMsg.data());
|
||||
emit signalCheckVersionResult();
|
||||
}
|
||||
|
||||
|
||||
void QQTCloudProtocol::packListDirData(QByteArray &l, const QTCloudListDir &t)
|
||||
{
|
||||
l = t.m_code.toLatin1();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::parseListDirResultData(QTCloudListDirResult &r, const QByteArray &l)
|
||||
{
|
||||
quint32 pos = 0;
|
||||
QByteArray b = l;
|
||||
QByteArray h;
|
||||
h = parseKeyWordInByteArray(b, _TCP_SECTION_UPCODE, pos);
|
||||
r.m_upcode = h;
|
||||
while(pos < b.length())
|
||||
{
|
||||
_QTCloudListDirResult _r;
|
||||
QByteArray __r;
|
||||
__r = parseKeyWordInByteArray(b, _TCP_SECTION_ID, pos);
|
||||
_r.m_id = __r;
|
||||
__r = parseKeyWordInByteArray(b, _TCP_SECTION_CODE, pos);
|
||||
_r.m_code = __r;
|
||||
__r = parseKeyWordInByteArray(b, _TCP_SECTION_NAME, pos);
|
||||
_r.m_name = __r;
|
||||
r.m_dir.push_back(_r);
|
||||
}
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::packAddDirData(QByteArray &l, const QTCloudAddDir &t)
|
||||
{
|
||||
packKeyWordToByteArray(l, _TCP_SECTION_UPCODE, t.m_upcode);
|
||||
packKeyWordToByteArray(l, _TCP_SECTION_CODE, t.m_code);
|
||||
packKeyWordToByteArray(l, _TCP_SECTION_NAME, t.m_name);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::parseAddDirResultData(QTCloudAddDirResult &t, const QByteArray &l)
|
||||
{
|
||||
quint32 pos = 0;
|
||||
QByteArray b = l;
|
||||
t.m_upcode = parseKeyWordInByteArray(b, _TCP_SECTION_UPCODE, pos);
|
||||
t.m_result = parseKeyWordInByteArray(b, _TCP_SECTION_RESULE, pos);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::packDelFileData(QByteArray &l, const QTCloudDelFile &t)
|
||||
{
|
||||
packKeyWordToByteArray(l, _TCP_SECTION_CODE, t.m_code);
|
||||
packKeyWordToByteArray(l, _TCP_SECTION_ID, t.m_id);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::parseListFileResultData(QTCloudListFileResult &r, const QByteArray &l)
|
||||
{
|
||||
quint32 pos = 0;
|
||||
QByteArray b = l;
|
||||
QByteArray h;
|
||||
h = parseKeyWordInByteArray(b, _TCP_SECTION_CODE, pos);
|
||||
r.m_code = h;
|
||||
while(pos < b.length())
|
||||
{
|
||||
_QTCloudListFileResult _r;
|
||||
QByteArray __r;
|
||||
__r = parseKeyWordInByteArray(b, _TCP_SECTION_ID, pos);
|
||||
_r.m_id = __r;
|
||||
__r = parseKeyWordInByteArray(b, _TCP_SECTION_NAME, pos);
|
||||
_r.m_name = __r;
|
||||
__r = parseKeyWordInByteArray(b, _TCP_SECTION_SIZE, pos);
|
||||
_r.m_size = __r;
|
||||
__r = parseKeyWordInByteArray(b, _TCP_SECTION_DATE, pos);
|
||||
_r.m_date = __r;
|
||||
r.m_file.push_back(_r);
|
||||
}
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::packDownDevFileData(QByteArray &l, const QTCloudDownDevFile &t)
|
||||
{
|
||||
l = t.m_id.toLatin1();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::parseDownDevFileResultData(QTCloudDownDevFileResult &t, const QByteArray &l)
|
||||
{
|
||||
quint32 pos = 0;
|
||||
QByteArray b = l;
|
||||
t.m_fileno = parseKeyWordInByteArray(b, _TCP_SECTION_FILENO, pos);
|
||||
t.m_name = parseKeyWordInByteArray(b, _TCP_SECTION_NAME, pos);
|
||||
t.m_length = parseKeyWordInByteArray(b, _TCP_SECTION_LENGTH, pos);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::packDownDevFileSuccessData(QByteArray &l, const QTCloudDownFileSuccess &t)
|
||||
{
|
||||
l << t.m_fileno;
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::packDownDevFileDataData(QByteArray &l, const QTCloudDownFileData &t)
|
||||
{
|
||||
l << t.m_fileno << t.m_dno;
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::parseDownDevFileDataResultData(QTCloudDownFileDataResult &t, const QByteArray &l)
|
||||
{
|
||||
quint32 pos = 0;
|
||||
QByteArray b = l;
|
||||
b >> t.m_fileno >> t.m_dno >> t.m_addr >> t.m_dlen;
|
||||
t.m_data.resize(t.m_dlen);
|
||||
b >> t.m_data;
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::packUploadFileData(QByteArray &l, const QTCloudUploadFile &t)
|
||||
{
|
||||
l = QString(_TCPCMD_DATASENDFILEINFO).arg(t.m_code).arg(t.m_name).arg(t.m_overwrite).arg(t.m_length).toLatin1();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::parseUploadFileResultData(QTCloudUploadFileResult &t, const QByteArray &l)
|
||||
{
|
||||
QByteArray b = l;
|
||||
b >> t.m_fileno >> t.m_state;
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::packUploadFileDataData(QByteArray &l, const QTCloudUploadFileData &t)
|
||||
{
|
||||
l << t.m_fileno << t.m_dno << t.m_addr << t.m_dlen << t.m_data;
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::parseUploadFileDataResultData(QTCloudUploadFileDataResult &t, const QByteArray &l)
|
||||
{
|
||||
QByteArray b = l;
|
||||
b >> t.m_fileno >> t.m_dno;
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::parseUploadFileSuccessData(QTCloudUploadFileSuccess &t, const QByteArray &l)
|
||||
{
|
||||
QByteArray b = l;
|
||||
b >> t.m_fileno;
|
||||
}
|
||||
|
||||
|
||||
void QQTCloudProtocol::sendListDirectory(QString code)
|
||||
{
|
||||
QTCloudListDir t;
|
||||
t.m_code = code;
|
||||
quint16 _tcpcmd = _TCPCMD_SEARCHDIR;
|
||||
QQTNetworkMessage qMsg;
|
||||
qMsg.setUid(m_UID);
|
||||
qMsg.setCmd(_tcpcmd);
|
||||
QByteArray d;
|
||||
packListDirData(d, t);
|
||||
qMsg.setData(d);
|
||||
qMsg.translate();
|
||||
//pline() << qMsg;
|
||||
QByteArray b;
|
||||
qMsg.packer(b);
|
||||
write(b);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendAddDirectory()
|
||||
{
|
||||
QTCloudAddDir t;
|
||||
t.m_upcode = "";
|
||||
t.m_code = "";
|
||||
t.m_name = "Method2";
|
||||
quint16 _tcpcmd = _TCPCMD_ADDDIR;
|
||||
QByteArray d;
|
||||
packAddDirData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendModDirectory()
|
||||
{
|
||||
QTCloudModDirName t;
|
||||
t.m_upcode = "";
|
||||
t.m_code = "";
|
||||
t.m_name = "Method2";
|
||||
quint16 _tcpcmd = _TCPCMD_ALTERDIR;
|
||||
|
||||
QByteArray d;
|
||||
//(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendDelDirectory()
|
||||
{
|
||||
QTCloudDelDir t;
|
||||
t.m_upcode = "";
|
||||
t.m_code = "";
|
||||
t.m_name = "Method2";
|
||||
quint16 _tcpcmd = _TCPCMD_DELETEDIR;
|
||||
QByteArray d;
|
||||
//(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvAddDirResultMessage(QQTNetworkMessage &){}
|
||||
|
||||
void QQTCloudProtocol::recvDelDirResultMessage(QQTNetworkMessage &){}
|
||||
|
||||
void QQTCloudProtocol::recvModDirResultMessage(QQTNetworkMessage &){}
|
||||
|
||||
void QQTCloudProtocol::sendListFiles(QString code)
|
||||
{
|
||||
QTCloudListFile t;
|
||||
t.m_code = code;
|
||||
quint16 _tcpcmd = _TCPCMD_SEARCHFILE;
|
||||
QByteArray d;
|
||||
packListDirData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendDelFile(QString code, QString id)
|
||||
{
|
||||
QTCloudDelFile t;
|
||||
t.m_code = code;
|
||||
t.m_id = id;
|
||||
quint16 _tcpcmd = _TCPCMD_DELETEFILE;
|
||||
QByteArray d;
|
||||
packDelFileData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
pline() << t.m_code << t.m_id;
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendListPubDirectory()
|
||||
{
|
||||
QTCloudListPubDir t;
|
||||
t.m_code = "";
|
||||
quint16 _tcpcmd = _TCPCMD_SEARCHPUBLICDIR;
|
||||
QByteArray d;
|
||||
packListDirData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendListPubFiles()
|
||||
{
|
||||
QTCloudListPubFile t;
|
||||
t.m_code = "";
|
||||
quint16 _tcpcmd = _TCPCMD_SEARCHPUBLICFILE;
|
||||
QByteArray d;
|
||||
packListDirData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendDownDevFiles(const QString& id, const QString& localfile)
|
||||
{
|
||||
m_downfileresult.m_localfile = localfile;
|
||||
m_work = 1;
|
||||
QTCloudDownDevFile t;
|
||||
t.m_id = id;
|
||||
quint16 _tcpcmd = _TCPCMD_DOWNLOADFILE;
|
||||
QByteArray d;
|
||||
packDownDevFileData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendDownPubFiles()
|
||||
{
|
||||
QTCloudDownPubFile t;
|
||||
_QTCloudListFileResult _result;
|
||||
foreach (_result, m_pubfiles.m_file) {
|
||||
break;
|
||||
}
|
||||
t.m_id = _result.m_id;
|
||||
quint16 _tcpcmd = _TCPCMD_DOWNLOADPUBFILE;
|
||||
QByteArray d;
|
||||
packDownDevFileData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendDownFileData()
|
||||
{
|
||||
pline() << m_downfiledata.m_fileno << m_downfiledata.m_dno;
|
||||
quint16 _tcpcmd = _TCPCMD_COMFIREFILEINFO;
|
||||
QByteArray d;
|
||||
packDownDevFileDataData(d, m_downfiledata);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendCancelDown()
|
||||
{
|
||||
QTCloudCancelDownFile t;
|
||||
t.m_fileno = m_downfiledata.m_fileno;
|
||||
quint16 _tcpcmd = _TCPCMD_CANCELREVFILE;
|
||||
m_work = 0;
|
||||
emit signalCancelDown();;
|
||||
QByteArray d;
|
||||
packDownDevFileSuccessData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendDownFileSuccess()
|
||||
{
|
||||
QTCloudDownFileSuccess t;
|
||||
t.m_fileno = m_downfiledata.m_fileno;
|
||||
quint16 _tcpcmd = _TCPCMD_DOWNFILEOK;
|
||||
QByteArray d;
|
||||
packDownDevFileSuccessData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendUploadFile(const QString& code, const QString& cloudname, const QString& localfile)
|
||||
{
|
||||
m_uploadfile.m_code = code;
|
||||
m_uploadfile.m_name = cloudname;
|
||||
m_uploadfile.m_localfile = localfile;
|
||||
QFileInfo f(m_uploadfile.m_localfile);
|
||||
m_uploadfile.m_length = QString::number(f.size());
|
||||
m_uploadfile.m_overwrite = _TCP_RESULT_TRUE;
|
||||
quint16 _tcpcmd = _TCPCMD_SENDFILEINFO;
|
||||
QQTNetworkMessage qMsg;
|
||||
qMsg.setUid(m_UID);
|
||||
qMsg.setCmd(_tcpcmd);
|
||||
QByteArray d;
|
||||
packUploadFileData(d, m_uploadfile);
|
||||
qMsg.setData(d);
|
||||
qMsg.translate();
|
||||
//pline() << qMsg;
|
||||
QByteArray b;
|
||||
qMsg.packer(b);
|
||||
write(b);
|
||||
//waitForBytesWritten(-1);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendUploadFileData()
|
||||
{
|
||||
m_uploadfiledata.m_addr = m_uploadfiledata.m_dno * _TCP_BLOCKDATA_SIZE;
|
||||
QFile f(m_uploadfile.m_localfile);
|
||||
f.open( QIODevice::ReadOnly );
|
||||
if(f.isOpen())
|
||||
{
|
||||
f.seek(m_uploadfiledata.m_addr);
|
||||
m_uploadfiledata.m_data = f.read(_TCP_BLOCKDATA_SIZE);
|
||||
}
|
||||
f.close();
|
||||
m_uploadfiledata.m_dlen = m_uploadfiledata.m_data.length();
|
||||
quint16 _tcpcmd = _TCPCMD_SENDFILEDATA;
|
||||
QQTNetworkMessage qMsg;
|
||||
qMsg.setUid(m_UID);
|
||||
qMsg.setCmd(_tcpcmd);
|
||||
QByteArray d;
|
||||
packUploadFileDataData(d, m_uploadfiledata);
|
||||
qMsg.setData(d);
|
||||
qMsg.translate();
|
||||
pline() << qMsg;
|
||||
QByteArray b;
|
||||
qMsg.packer(b);
|
||||
write(b);
|
||||
|
||||
pline() << m_uploadfile.m_name << m_uploadfile.m_localfile << m_uploadfiledata.m_fileno << m_uploadfiledata.m_dno << m_uploadfiledata.m_addr << m_uploadfiledata.m_dlen;
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendCancelUpload()
|
||||
{
|
||||
QTCloudCancelUploadFile t;
|
||||
t.m_fileno = m_uploadfiledata.m_fileno;
|
||||
quint16 _tcpcmd = _TCPCMD_CANCELSENDFILE;
|
||||
QByteArray d;
|
||||
packDownDevFileSuccessData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
emit signalCancelUpload();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::sendDownUpgradeFile(const QString &id, const QString &localfile)
|
||||
{
|
||||
m_downfileresult.m_localfile = localfile;
|
||||
m_work = 1;
|
||||
QTCloudDownDevFile t;
|
||||
t.m_id = id;
|
||||
quint16 _tcpcmd = _TCPCMD_DOWNUPGRADEFILE;
|
||||
QByteArray d;
|
||||
packDownDevFileData(d, t);
|
||||
sendMessage(_tcpcmd, d);
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvListDirResultMessage(QQTNetworkMessage &qMsg)
|
||||
{
|
||||
m_dirs.m_upcode = "";
|
||||
m_dirs.m_dir.clear();
|
||||
parseListDirResultData(m_dirs, qMsg.data());
|
||||
pline() << m_dirs.m_upcode;
|
||||
_QTCloudListDirResult _result;
|
||||
foreach (_result, m_dirs.m_dir) {
|
||||
/*
|
||||
* 这里保存到model中
|
||||
*/
|
||||
pline() << _result.m_id << _result.m_code << _result.m_name;
|
||||
}
|
||||
emit signalListDirOK();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvListFilesResultMessage(QQTNetworkMessage &qMsg)
|
||||
{
|
||||
m_files.m_code = "";
|
||||
m_files.m_file.clear();
|
||||
parseListFileResultData(m_files, qMsg.data());
|
||||
pline() << m_files.m_code;
|
||||
_QTCloudListFileResult _result;
|
||||
foreach (_result, m_files.m_file) {
|
||||
/*
|
||||
* 这里保存到model中
|
||||
*/
|
||||
pline() << _result.m_id << _result.m_name << _result.m_size << _result.m_date;
|
||||
}
|
||||
emit signalListFileOK();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvListPubDirResultMessage(QQTNetworkMessage &qMsg)
|
||||
{
|
||||
m_pubdirs.m_upcode = "";
|
||||
m_pubdirs.m_dir.clear();
|
||||
parseListDirResultData(m_pubdirs, qMsg.data());
|
||||
pline() << m_pubdirs.m_upcode;
|
||||
_QTCloudListDirResult _result;
|
||||
foreach (_result, m_pubdirs.m_dir) {
|
||||
/*
|
||||
* 这里保存到model中
|
||||
*/
|
||||
pline() << _result.m_id << _result.m_code << _result.m_name;
|
||||
}
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvListPubFilesResultMessage(QQTNetworkMessage &qMsg)
|
||||
{
|
||||
m_pubfiles.m_code = "";
|
||||
m_pubfiles.m_file.clear();
|
||||
parseListFileResultData(m_pubfiles, qMsg.data());
|
||||
pline() << m_pubfiles.m_code;
|
||||
_QTCloudListFileResult _result;
|
||||
foreach (_result, m_pubfiles.m_file) {
|
||||
/*
|
||||
* 这里保存到model中
|
||||
*/
|
||||
pline() << _result.m_id << _result.m_name << _result.m_size << _result.m_date;
|
||||
}
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvDownFileResultMessage(QQTNetworkMessage &qMsg)
|
||||
{
|
||||
parseDownDevFileResultData(m_downfileresult, qMsg.data());
|
||||
pline() << m_downfileresult.m_fileno << m_downfileresult.m_name << m_downfileresult.m_length;
|
||||
m_downfiledata.m_fileno = m_downfileresult.m_fileno.toInt();
|
||||
|
||||
QString tmpFile = m_downfileresult.m_localfile;
|
||||
|
||||
#ifdef __MIPS_LINUX__
|
||||
system(QString("touch %1").arg(tmpFile).toLatin1().data());
|
||||
#endif
|
||||
|
||||
QFile f(tmpFile);
|
||||
f.open( QIODevice::WriteOnly | QIODevice::Truncate );
|
||||
pline() << tmpFile << f.size();
|
||||
f.close();
|
||||
emit signalUpdateProgress(0);
|
||||
emit signalDownData();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvDownFileDataResultMessage(QQTNetworkMessage &qMsg)
|
||||
{
|
||||
if(0 == m_work)
|
||||
return;
|
||||
QTCloudDownFileDataResult result;
|
||||
parseDownDevFileDataResultData(result, qMsg.data());
|
||||
pline() << result.m_fileno << result.m_dno << result.m_addr <<
|
||||
result.m_dlen;// << m_downfiledata.m_data;
|
||||
int nFileSize = 0;
|
||||
QString tmpFile = m_downfileresult.m_localfile;
|
||||
QFile f(tmpFile);
|
||||
f.open( QIODevice::WriteOnly | QIODevice::Append );
|
||||
f.write(result.m_data);
|
||||
nFileSize = f.size();
|
||||
f.close();
|
||||
pline() << nFileSize << m_downfileresult.m_length;
|
||||
int percent = 0;
|
||||
if(nFileSize > 0)
|
||||
percent = 100 * nFileSize / m_downfileresult.m_length.toInt();
|
||||
emit signalUpdateProgress(percent);
|
||||
pline() << percent;
|
||||
if(nFileSize < m_downfileresult.m_length.toInt())
|
||||
{
|
||||
m_downfiledata.m_dno++;
|
||||
emit signalDownData();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_downfiledata.m_dno = 0;
|
||||
emit signalDownSucc();
|
||||
}
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvUploadFileResult(QQTNetworkMessage &qMsg)
|
||||
{
|
||||
QTCloudUploadFileResult result;
|
||||
parseUploadFileResultData(result, qMsg.data());
|
||||
pline() << result.m_fileno << result.m_state;
|
||||
perr(result.m_state, 0x00) << "ok to send file data";
|
||||
perr(result.m_state, 0x01) << "unsupport file type";
|
||||
perr(result.m_state, 0x02) << "file too length";
|
||||
perr(result.m_state, 0x03) << "too much file";
|
||||
perr(result.m_state, 0x04) << "files too long";
|
||||
perr(result.m_state, 0x14) << "no much storage";
|
||||
|
||||
if(result.m_state == 0x00)
|
||||
{
|
||||
m_uploadfiledata.m_fileno = result.m_fileno;
|
||||
m_uploadfiledata.m_dno = 0;
|
||||
/*
|
||||
* 使用Timer确认不是网络速率的原因。
|
||||
*/
|
||||
emit signalUpdateProgress(0);
|
||||
emit signalSendData();
|
||||
}
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvUploadFileDataResult(QQTNetworkMessage &qMsg)
|
||||
{
|
||||
QTCloudUploadFileDataResult result;
|
||||
|
||||
parseUploadFileDataResultData(result, qMsg.data());
|
||||
pline() << result.m_fileno << result.m_dno << result.m_dno * _TCP_BLOCKDATA_SIZE << m_uploadfile.m_length.toInt();
|
||||
|
||||
/*
|
||||
* 不需要发空串
|
||||
*/
|
||||
m_uploadfiledata.m_dno = result.m_dno + 1;
|
||||
int percent = 0;
|
||||
if(m_uploadfile.m_length.toInt() > 0)
|
||||
percent = 100 * m_uploadfiledata.m_dno * _TCP_BLOCKDATA_SIZE /
|
||||
m_uploadfile.m_length.toInt();
|
||||
|
||||
if(m_uploadfiledata.m_dno * _TCP_BLOCKDATA_SIZE < m_uploadfile.m_length.toInt())
|
||||
{
|
||||
emit signalSendData();
|
||||
emit signalUpdateProgress(percent);
|
||||
}
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::recvUploadFileSuccess(QQTNetworkMessage &qMsg)
|
||||
{
|
||||
QTCloudUploadFileSuccess result;
|
||||
parseUploadFileSuccessData(result, qMsg.data());
|
||||
pline() << result.m_fileno << m_uploadfiledata.m_dno << m_uploadfiledata.m_dno * _TCP_BLOCKDATA_SIZE << m_uploadfile.m_length.toInt() << "upload success";
|
||||
emit signalUpdateProgress(100);
|
||||
emit signalUploadSucc();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::packLoginData(QByteArray &l, const QTCloudLogin &t)
|
||||
{
|
||||
l = QString(_TCPCMD_DATALOGIN).arg(t.m_name).arg(t.m_password).toLatin1();
|
||||
}
|
||||
|
||||
void QQTCloudProtocol::parseLoginResultData(QTCloudLoginResult &t, const QByteArray &l)
|
||||
{
|
||||
QByteArray _l = l;
|
||||
_l >> t.m_result;
|
||||
}
|
||||
|
||||
|
||||
QByteArray& QQTCloudProtocol::packKeyWordToByteArray(QByteArray &array, const QString& key, const QString &value)
|
||||
{
|
||||
return array << key.toLatin1() << "=\"" << value.toLatin1() << "\"";
|
||||
}
|
||||
|
||||
QByteArray QQTCloudProtocol::parseKeyWordInByteArray(const QByteArray &array, const QByteArray §ion, quint32& pos)
|
||||
{
|
||||
int index = pos, indexTemp = 0;
|
||||
|
||||
index = array.indexOf(section, index);
|
||||
index = array.indexOf('\"', index);
|
||||
indexTemp = array.indexOf('\"', index+1);
|
||||
pos = indexTemp + 1;
|
||||
return array.mid(index + 1, (indexTemp - index-1));
|
||||
}
|
||||
|
||||
quint16 QQTCloudProtocol::splitter(const QByteArray &s)
|
||||
{
|
||||
QByteArray l = s.left(4);
|
||||
quint16 b0 = 0, b1 = 0;
|
||||
l >> b0 >> b1;
|
||||
return b1;
|
||||
}
|
||||
|
||||
quint16 QQTCloudProtocol::minlength()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
quint16 QQTCloudProtocol::maxlength()
|
||||
{
|
||||
return 32768;
|
||||
}
|
@ -1,433 +0,0 @@
|
||||
#ifndef QQTCLOUDPROTOCOL_H
|
||||
#define QQTCLOUDPROTOCOL_H
|
||||
|
||||
#include <QTimer>
|
||||
#include "qqtprotocol.h"
|
||||
#include "qqtnetworkmessage.h"
|
||||
#include "qqtclient.h"
|
||||
|
||||
#define _TCPCMD_HEART 0x0010
|
||||
#define _TCPCMD_HEARTBEATRESP 0x8010
|
||||
|
||||
#define _TCPCMD_REGISTER 0x0101
|
||||
#define _TCPCMD_REGISTERRESUALT 0x8101
|
||||
|
||||
#define _TCPCMD_VERIFYCODE 0x0105
|
||||
#define _TCPCMD_RECEIVEVERIFYBMP 0x8105
|
||||
|
||||
#define _TCPCMD_EXIT 0x0104
|
||||
#define _TCPCMD_NEXTAREA 0x1010
|
||||
#define _TCPCMD_NEXTMACHINE 0x1011
|
||||
|
||||
#define _TCPCMD_LOGIN 0x0102
|
||||
#define _TCPCMD_LOGINRESUALT 0x8102
|
||||
|
||||
|
||||
#define _TCPCMD_RECEIVEDIRYES 0x4f4b
|
||||
#define _TCPCMD_RECEIVEDIRNO
|
||||
|
||||
#define _TCPCMD_SEARCHDIR 0x0200
|
||||
#define _TCPCMD_ADDDIR 0x0201
|
||||
#define _TCPCMD_ALTERDIR 0x0202
|
||||
#define _TCPCMD_DELETEDIR 0x0203
|
||||
#define _TCPCMD_SEARCHFILE 0x0204
|
||||
#define _TCPCMD_DELETEFILE 0x0205
|
||||
#define _TCPCMD_SEARCHPUBLICDIR 0x0210
|
||||
#define _TCPCMD_SEARCHPUBLICFILE 0x0211
|
||||
|
||||
#define _TCPCMD_SENDFILEINFO 0x0321
|
||||
#define _TCPCMD_SENDFILEDATA 0x0322
|
||||
#define _TCPCMD_CANCELSENDFILE 0x0323
|
||||
|
||||
#define _TCPCMD_DOWNLOADFILE 0x0303
|
||||
#define _TCPCMD_DOWNLOADPUBFILE 0x0304
|
||||
#define _TCPCMD_COMFIREFILEINFO 0x0311
|
||||
#define _TCPCMD_CANCELREVFILE 0x0312
|
||||
#define _TCPCMD_DOWNFILEOK 0x0313
|
||||
|
||||
#define _TCPCMD_RECEIVEDIRLIST 0x8200
|
||||
#define _TCPCMD_RECEIVEADDRESUALT 0x8201
|
||||
#define _TCPCMD_RECEIVEALTERRESUALT 0x8202
|
||||
#define _TCPCMD_RECEIVEDELETERESUALT 0x8203
|
||||
#define _TCPCMD_RECEIVEFILELIST 0x8204
|
||||
#define _TCPCMD_RECEIVEPUBLICDIRLIST 0x8210
|
||||
#define _TCPCMD_RECEIVEPUBLICFILELIST 0x8211
|
||||
|
||||
#define _TCPCMD_RECEIVEFILEINFO 0x8311
|
||||
#define _TCPCMD_RECEIVEFILEDATA 0x8312
|
||||
#define _TCPCMD_RECEIVECOMFIREFILEINFO 0x8321
|
||||
#define _TCPCMD_RECEIVECOMFIREFILEDATA 0x8322
|
||||
#define _TCPCMD_RECEIVECOMFIREFILE 0x8323
|
||||
|
||||
|
||||
#define _TCPCMD_CHECKVERSION 0x0400
|
||||
#define _TCPCMD_CHECKVERSIONRSP 0x8400
|
||||
|
||||
#define _TCPCMD_DOWNUPGRADEFILE 0x0411
|
||||
|
||||
#define _TCP_SECTION_SOFTWAREID "SOFTWAREID"
|
||||
#define _TCP_SECTION_DEVICECODE "INSTRUMENTCODE"
|
||||
#define _TCP_SECTION_SOFTWARECODE "SOFTWARECODE"
|
||||
#define _TCP_SECTION_VERSION "VERSION"
|
||||
#define _TCP_SECTION_NEWSOFTWAREID "NEWSOFTWAREID"
|
||||
#define _TCP_SECTION_EXPLAIN "EXPLAIN"
|
||||
#define _TCP_SECTION_RELEASESTAT "RELEASESTATUS"
|
||||
#define _TCP_SECTION_RELEASEDATE "RELEASEDATE"
|
||||
#define _TCP_SECTION_FILENAME "FILENAME"
|
||||
#define _TCP_SECTION_FILEMD5 "FILEMD5"
|
||||
#define _TCP_SECTION_FILESIZE "FILESIZE"
|
||||
|
||||
#define _TCP_SECTION_UPCODE "UPCODE"
|
||||
#define _TCP_SECTION_ID "ID"
|
||||
#define _TCP_SECTION_CODE "CODE"
|
||||
#define _TCP_SECTION_NAME "NAME"
|
||||
#define _TCP_SECTION_SIZE "SIZE"
|
||||
#define _TCP_SECTION_DATE "DATE"
|
||||
#define _TCP_SECTION_FILENO "FILENO"
|
||||
#define _TCP_SECTION_LENGTH "LENGTH"
|
||||
#define _TCP_SECTION_RESULE "RESULT"
|
||||
|
||||
#define _TCP_RESULT_OK "OK"
|
||||
#define _TCP_RESULT_FAIL "FF"
|
||||
#define _TCP_RESULT_TRUE "TRUE"
|
||||
#define _TCP_RESULT_FALSE "FALSE"
|
||||
|
||||
#define _TCP_SECTION_USERNAME "USERNAME"
|
||||
#define _TCP_SECTION_PASSWORD "PASSWORD"
|
||||
|
||||
typedef struct tagTankLogin
|
||||
{
|
||||
QString m_name;
|
||||
QString m_password;
|
||||
}QTCloudLogin;
|
||||
|
||||
typedef struct tagTankLoginReuslt
|
||||
{
|
||||
quint8 m_result;
|
||||
}QTCloudLoginResult;
|
||||
|
||||
typedef struct tagQTCloudListDir
|
||||
{
|
||||
QString m_code;
|
||||
}QTCloudListDir, QTCloudListFile, QTCloudListPubDir, QTCloudListPubFile;
|
||||
|
||||
typedef struct tag_QTCloudListDirResult
|
||||
{
|
||||
QString m_id;
|
||||
QString m_code;
|
||||
QString m_name;
|
||||
}_QTCloudListDirResult;
|
||||
|
||||
typedef struct tagQTCloudListDirResult
|
||||
{
|
||||
QList<_QTCloudListDirResult> m_dir;
|
||||
QString m_upcode;
|
||||
}QTCloudListDirResult, QTCloudListPubDirResult;
|
||||
|
||||
typedef struct tagTankAddDir
|
||||
{
|
||||
QString m_upcode;
|
||||
QString m_code;
|
||||
QString m_name;
|
||||
}QTCloudAddDir, QTCloudModDirName, QTCloudDelDir;
|
||||
|
||||
typedef struct tagQTCloudDelFile
|
||||
{
|
||||
QString m_code;
|
||||
QString m_id;
|
||||
}QTCloudDelFile;
|
||||
|
||||
typedef struct tagQTCloudAddDirResult
|
||||
{
|
||||
QString m_upcode;
|
||||
QString m_result;
|
||||
}QTCloudAddDirResult, QTCloudDelDirResult, QTCloudModDirNameResult;
|
||||
|
||||
typedef struct tag_QTCloudListFileResult
|
||||
{
|
||||
QString m_id;
|
||||
QString m_name;
|
||||
QString m_size;
|
||||
QString m_date;
|
||||
}_QTCloudListFileResult;
|
||||
|
||||
typedef struct tagQTCloudListFileResult
|
||||
{
|
||||
QList<_QTCloudListFileResult> m_file;
|
||||
QString m_code;
|
||||
}QTCloudListFileResult, QTCloudListPubFileResult;
|
||||
|
||||
typedef struct tagTankDownDevFile
|
||||
{
|
||||
QString m_id;
|
||||
}QTCloudDownDevFile, QTCloudDownPubFile;
|
||||
|
||||
typedef struct tagQTCloudDownFileData
|
||||
{
|
||||
tagQTCloudDownFileData()
|
||||
{
|
||||
m_fileno = 0;
|
||||
m_dno = 0;
|
||||
}
|
||||
|
||||
quint32 m_fileno;
|
||||
quint32 m_dno;
|
||||
}QTCloudDownFileData, QTCloudUploadFileDataResult;
|
||||
|
||||
typedef struct tagQTCloudCancelDownFile
|
||||
{
|
||||
quint32 m_fileno;
|
||||
}QTCloudCancelDownFile, QTCloudDownFileSuccess, QTCloudCancelUploadFile, QTCloudUploadFileSuccess;
|
||||
|
||||
typedef struct tagQTCloudDownFileResult
|
||||
{
|
||||
QString m_fileno;
|
||||
QString m_name;
|
||||
QString m_length;
|
||||
//local
|
||||
QString m_localfile;
|
||||
}QTCloudDownDevFileResult, QTCloudDownPubFileResult;
|
||||
|
||||
typedef struct tagQTCloudDownFileDataResult
|
||||
{
|
||||
tagQTCloudDownFileDataResult()
|
||||
{
|
||||
m_fileno = 0;
|
||||
m_dno = 0;
|
||||
m_addr = 0;
|
||||
m_dlen = 0;
|
||||
m_data.clear();
|
||||
}
|
||||
|
||||
quint32 m_fileno;
|
||||
quint32 m_dno;
|
||||
quint32 m_addr;
|
||||
quint16 m_dlen;
|
||||
QByteArray m_data;
|
||||
}QTCloudDownFileDataResult, QTCloudUploadFileData;
|
||||
|
||||
typedef struct tagTankUploadFile
|
||||
{
|
||||
QString m_code;
|
||||
QString m_name;
|
||||
QString m_overwrite;
|
||||
QString m_length;
|
||||
//local
|
||||
QString m_localfile;
|
||||
}QTCloudUploadFile;
|
||||
|
||||
typedef struct tagTankUploadFileResult
|
||||
{
|
||||
tagTankUploadFileResult()
|
||||
{
|
||||
m_fileno = 0;
|
||||
m_state = 0;
|
||||
}
|
||||
|
||||
quint32 m_fileno;
|
||||
quint8 m_state;
|
||||
}QTCloudUploadFileResult;
|
||||
|
||||
|
||||
typedef struct tagQTCheckVersion
|
||||
{
|
||||
QString m_softwareid;
|
||||
QString m_devicecode;
|
||||
QString m_softwarecode;
|
||||
QString m_version;
|
||||
}QTCheckVersion;
|
||||
|
||||
typedef struct tagQTCheckVersionResult
|
||||
{
|
||||
QString m_softwareid;
|
||||
QString m_devicecode;
|
||||
QString m_softwarecode;
|
||||
QString m_version;
|
||||
QString m_NewSoftwareID;
|
||||
QString m_Explain;
|
||||
QString m_ReleaseStatus;
|
||||
QString m_ReleaseDate;
|
||||
QString m_FileName;
|
||||
QString m_FileMD5;
|
||||
QString m_FileSize;
|
||||
}QTCheckVersionResult;
|
||||
|
||||
|
||||
#define _TCPCMD_DATALOGIN "USERNAME=\"%1\"PASSWORD=\"%2\""
|
||||
#define _TCPCMD_DATAADDDIR "UPCODE=\"%1\"CODE=\"%2\"NAME=\"%3\""
|
||||
#define _TCPCMD_DATAALTERDIR "UPCODE=\"%1\"ID=\"%2\"NAME=\"%3\""
|
||||
#define _TCPCMD_DATADELETEDIR "UPCODE=\"%1\"ID=\"%2\""
|
||||
#define _TCPCMD_DATADELETEFILE "CODE=\"%1\"ID=\"%2\""
|
||||
#define _TCPCMD_DATASENDFILEINFO "CODE=\"%1\"NAME=\"%2\"OVERWRITE=\"%3\"LENGTH=\"%4\""
|
||||
#define MAX_HEARDBEAT 10
|
||||
|
||||
class QQTCloudProtocol : public QQTProtocol
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTCloudProtocol(QObject *parent = 0);
|
||||
|
||||
QTCheckVersionResult& GetVersionResult();
|
||||
QTCloudListDirResult& GetDirList();
|
||||
QTCloudListFileResult& GetListedFiles();
|
||||
bool isLogined();
|
||||
void startHeartBeat();
|
||||
void stopHeartBeat();
|
||||
|
||||
signals:
|
||||
void signalLoginSucc();//
|
||||
void signalLoginFail();
|
||||
void signalLogoutSucc();
|
||||
void signalLogoutFail();//?
|
||||
void signalReconnectQequest();//app do client.connect.
|
||||
void signalCancelDown();
|
||||
void signalDownSucc();
|
||||
void signalListDirOK();
|
||||
void signalListFileOK();
|
||||
void signalUpdateProgress(int percent);
|
||||
|
||||
void signalCancelUpload();
|
||||
void signalUploadSucc();
|
||||
|
||||
signals:
|
||||
void signalSendData();
|
||||
void signalDownData();
|
||||
void signalCheckVersionResult();
|
||||
protected:
|
||||
quint8 m_work;
|
||||
private:
|
||||
QTCheckVersionResult m_versionresult;
|
||||
QTCloudUploadFile m_uploadfile;
|
||||
QTCloudUploadFileData m_uploadfiledata;
|
||||
QTCloudListDirResult m_dirs;
|
||||
QTCloudListFileResult m_files;
|
||||
QTCloudListPubDirResult m_pubdirs;
|
||||
QTCloudListPubFileResult m_pubfiles;
|
||||
QTCloudDownDevFileResult m_downfileresult;
|
||||
QTCloudDownFileData m_downfiledata;
|
||||
private:
|
||||
quint32 m_UID;
|
||||
qint8 m_heartCount;
|
||||
QTimer* timer;
|
||||
bool m_isLogined;
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
public slots:
|
||||
/*
|
||||
* 服务器需要解析收到的命令,而此处不需要,所以客户端和服务器代码分开编写。
|
||||
*/
|
||||
void sendHeatBeatMessage();
|
||||
void recvHeatBeatResultMessage(QQTNetworkMessage&);
|
||||
|
||||
/*
|
||||
* 和PC的协议中,不登陆不能进行任何操作,所以此处登陆;
|
||||
*/
|
||||
void sendLoginMessage();
|
||||
void recvLoginResultMessage(QQTNetworkMessage&);
|
||||
|
||||
void sendLogoutMessage();
|
||||
void recvConnPoolFullMessage(QQTNetworkMessage&);
|
||||
|
||||
void sendCheckVersion();
|
||||
void sendCheckNewVersion();
|
||||
void recvCheckVersionResult(QQTNetworkMessage &);
|
||||
|
||||
void sendListDirectory(QString code = "");
|
||||
void recvListDirResultMessage(QQTNetworkMessage&);
|
||||
|
||||
void sendAddDirectory();
|
||||
void sendModDirectory();
|
||||
void sendDelDirectory();
|
||||
void recvAddDirResultMessage(QQTNetworkMessage&);
|
||||
void recvDelDirResultMessage(QQTNetworkMessage&);
|
||||
void recvModDirResultMessage(QQTNetworkMessage&);
|
||||
|
||||
void sendListFiles(QString code = "001");
|
||||
void sendListPubDirectory();
|
||||
void sendListPubFiles();
|
||||
void recvListFilesResultMessage(QQTNetworkMessage&);
|
||||
void recvListPubDirResultMessage(QQTNetworkMessage&);
|
||||
void recvListPubFilesResultMessage(QQTNetworkMessage&);
|
||||
|
||||
void sendDelFile(QString code, QString id);
|
||||
void sendDownUpgradeFile(const QString& id, const QString& localfile);
|
||||
/**
|
||||
* @brief sendDownDevFiles
|
||||
* @param path 文件下载下来保存的路径
|
||||
* @param id
|
||||
* @param local 文件下载下来保存的名字
|
||||
*/
|
||||
void sendDownDevFiles(const QString& id, const QString& localfile);
|
||||
void sendDownPubFiles();
|
||||
void sendDownFileData();
|
||||
void sendDownFileSuccess();
|
||||
void sendCancelDown();
|
||||
|
||||
void recvDownFileResultMessage(QQTNetworkMessage&);
|
||||
void recvDownFileDataResultMessage(QQTNetworkMessage&);
|
||||
|
||||
void sendUploadFile(const QString& code, const QString& cloudname, const QString& localfile);
|
||||
void sendUploadFileData();
|
||||
void sendCancelUpload();
|
||||
void recvUploadFileResult(QQTNetworkMessage&);
|
||||
void recvUploadFileDataResult(QQTNetworkMessage&);
|
||||
void recvUploadFileSuccess(QQTNetworkMessage&);
|
||||
|
||||
void sendMessage(quint16 cmd, QByteArray& data);
|
||||
|
||||
protected:
|
||||
void packLoginData(QByteArray& l, const QTCloudLogin& t);
|
||||
void parseLoginResultData(QTCloudLoginResult& t, const QByteArray& l);
|
||||
|
||||
void packListDirData(QByteArray& l, const QTCloudListDir& t);
|
||||
void parseListDirResultData(QTCloudListDirResult& r, const QByteArray& l);
|
||||
|
||||
void packAddDirData(QByteArray& l, const QTCloudAddDir& t);
|
||||
void parseAddDirResultData(QTCloudAddDirResult& r, const QByteArray& l);
|
||||
|
||||
void packDelFileData(QByteArray& l, const QTCloudDelFile& t);
|
||||
|
||||
void parseListFileResultData(QTCloudListFileResult& r, const QByteArray& l);
|
||||
|
||||
void packDownDevFileData(QByteArray& l, const QTCloudDownDevFile& t);
|
||||
void parseDownDevFileResultData(QTCloudDownDevFileResult& r, const QByteArray& l);
|
||||
|
||||
void packDownDevFileSuccessData(QByteArray& l, const QTCloudDownFileSuccess& t);
|
||||
|
||||
void packDownDevFileDataData(QByteArray& l, const QTCloudDownFileData& t);
|
||||
void parseDownDevFileDataResultData(QTCloudDownFileDataResult& r, const QByteArray& l);
|
||||
|
||||
void packUploadFileData(QByteArray& l, const QTCloudUploadFile& t);
|
||||
void parseUploadFileResultData(QTCloudUploadFileResult& r, const QByteArray& l);
|
||||
|
||||
void packUploadFileDataData(QByteArray& l, const QTCloudUploadFileData& t);
|
||||
void parseUploadFileDataResultData(QTCloudUploadFileDataResult& t, const QByteArray& l);
|
||||
|
||||
void parseUploadFileSuccessData(QTCloudUploadFileSuccess& t, const QByteArray& l);
|
||||
void packCheckVersionData(QByteArray& l, const QTCheckVersion& t);
|
||||
void parseCheckVersionResultData(QTCheckVersionResult& t, const QByteArray& l);
|
||||
|
||||
protected:
|
||||
QByteArray& packKeyWordToByteArray(QByteArray &array, const QString &key, const QString& value);
|
||||
|
||||
QByteArray parseKeyWordInByteArray(const QByteArray& array, const QByteArray §ion, quint32 &pos);
|
||||
|
||||
// QQTProtocol interface
|
||||
public:
|
||||
quint16 minlength() override;
|
||||
quint16 maxlength() override;
|
||||
quint16 splitter(const QByteArray &s) override;
|
||||
bool dispatcher(const QByteArray &m) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
QQTClient *QQTUpgradeClientInstance(QObject *parent);
|
||||
|
||||
|
||||
QQTClient *QQTCloudClientInstance(QObject *parent);
|
||||
|
||||
|
||||
#endif // QQTCLOUDPROTOCOL_H
|
@ -1,7 +1,7 @@
|
||||
#include "qqtethenetmanager.h"
|
||||
#include "qqtlinux.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
|
||||
QQTEthenetManager* QQTEthenetManager::_instance = NULL;
|
||||
|
||||
|
@ -6,8 +6,9 @@
|
||||
#include <QList>
|
||||
#include <qthread.h>
|
||||
#include "qqtcore.h"
|
||||
#include "qqt.h"
|
||||
|
||||
class QQTNetworkClearThread : public QThread
|
||||
class QQTSHARED_EXPORT QQTNetworkClearThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -22,7 +23,7 @@ protected:
|
||||
void run();
|
||||
};
|
||||
|
||||
class QQTDhcpThread : public QThread
|
||||
class QQTSHARED_EXPORT QQTDhcpThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -39,7 +40,7 @@ private:
|
||||
};
|
||||
|
||||
// thread unsafe
|
||||
class QQTEthenetManager : public QObject
|
||||
class QQTSHARED_EXPORT QQTEthenetManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define QQTFTPPROTOCOL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQtFtpProtocol : public QObject
|
||||
class QQTSHARED_EXPORT QQtFtpProtocol : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define QQTHTTPPROTOCOL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQtHttpProtocol : public QObject
|
||||
class QQTSHARED_EXPORT QQtHttpProtocol : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -1,28 +0,0 @@
|
||||
#include "qqtlanprotocol.h"
|
||||
|
||||
QQTLanProtocol::QQTLanProtocol(QObject *parent) :
|
||||
QQTProtocol(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
quint16 QQTLanProtocol::minlength()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
quint16 QQTLanProtocol::maxlength()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
quint16 QQTLanProtocol::splitter(const QByteArray &s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool QQTLanProtocol::dispatcher(const QByteArray &m)
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#ifndef QQTLANPROTOCOL_H
|
||||
#define QQTLANPROTOCOL_H
|
||||
|
||||
#include "qqtprotocol.h"
|
||||
|
||||
class QQTLanProtocol : public QQTProtocol
|
||||
{
|
||||
public:
|
||||
explicit QQTLanProtocol(QObject *parent = 0);
|
||||
|
||||
// QQTProtocol interface
|
||||
public:
|
||||
quint16 minlength() override;
|
||||
quint16 maxlength() override;
|
||||
quint16 splitter(const QByteArray &s) override;
|
||||
bool dispatcher(const QByteArray &m) override;
|
||||
};
|
||||
|
||||
#endif // QQTLANPROTOCOL_H
|
@ -2,12 +2,12 @@
|
||||
#define QQTMESSAGE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <qqt.h>
|
||||
|
||||
/**
|
||||
* @brief 语法类 定义报文格式
|
||||
*/
|
||||
class QQTMessage : public QObject
|
||||
class QQTSHARED_EXPORT QQTMessage : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <QElapsedTimer>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDebug>
|
||||
#include <qqt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -36,7 +37,7 @@ enum {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
typedef struct tagWifi
|
||||
typedef struct QQTSHARED_EXPORT tagWifi
|
||||
{
|
||||
QString wifi[ESSID_MAX];
|
||||
|
||||
@ -55,4 +56,4 @@ typedef struct tagWifi
|
||||
|
||||
|
||||
|
||||
#endif // QQTNETWORKDEFINE_H
|
||||
#endif // QQTNETWORKDEFINE_H
|
||||
|
@ -1,98 +0,0 @@
|
||||
#include "qqtnetworkmessage.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqtnetwork.h"
|
||||
|
||||
QQTNetworkMessage::QQTNetworkMessage(QObject *parent) : QQTMessage(parent)
|
||||
{
|
||||
m_Head = _TCPCMD_TAGHEAD;
|
||||
m_Size = m_Cmd = m_Uid = m_Sum = 0;
|
||||
m_Data.clear();;
|
||||
m_Tail = _TCPCMD_TAGTAIL;
|
||||
}
|
||||
|
||||
const quint16 &QQTNetworkMessage::head() const { return m_Head; }
|
||||
|
||||
void QQTNetworkMessage::setHead(quint16 head) { m_Head = head; }
|
||||
|
||||
const quint16 &QQTNetworkMessage::size() const { return m_Size; }
|
||||
|
||||
void QQTNetworkMessage::setSize(quint16 size) { m_Size = size; }
|
||||
|
||||
const quint16 &QQTNetworkMessage::cmd() const { return m_Cmd; }
|
||||
|
||||
void QQTNetworkMessage::setCmd(quint16 cmd) { m_Cmd = cmd; }
|
||||
|
||||
const quint32 &QQTNetworkMessage::uid() const { return m_Uid; }
|
||||
|
||||
void QQTNetworkMessage::setUid(quint32 uid) { m_Uid = uid; }
|
||||
|
||||
const QByteArray &QQTNetworkMessage::data() const { return m_Data; }
|
||||
|
||||
void QQTNetworkMessage::setData(QByteArray &data) { m_Data = data; }
|
||||
|
||||
const quint16 &QQTNetworkMessage::sum() const { return m_Sum; }
|
||||
|
||||
void QQTNetworkMessage::setSum(quint16 sum) { m_Sum = sum; }
|
||||
|
||||
const quint32 &QQTNetworkMessage::tail() const { return m_Tail; }
|
||||
|
||||
void QQTNetworkMessage::setTail(quint32 tail) { m_Tail = tail; }
|
||||
|
||||
void QQTNetworkMessage::translate()
|
||||
{
|
||||
m_Size = m_Data.length() + 0x10;
|
||||
QByteArray qbaVerify;
|
||||
qbaVerify << m_Size << m_Cmd << m_Uid << m_Data;
|
||||
m_Sum = 0;
|
||||
/*
|
||||
* 校验码等错误 会导致服务器不回复消息
|
||||
* 如果不添加quint8 0x0112+0x0088=0x009a 单字节到二字节进位的位置看不懂
|
||||
* 带进位的8位偶校验。
|
||||
*/
|
||||
for(int i = 0; i < qbaVerify.length(); i++)
|
||||
m_Sum += quint8(qbaVerify.at(i));
|
||||
//real verify
|
||||
//m_Sum = qChecksum(qbaVerify.data(), qbaVerify.length());
|
||||
}
|
||||
|
||||
void QQTNetworkMessage::parser(const QByteArray &block)
|
||||
{
|
||||
QByteArray l = block;
|
||||
quint16 b0 = 0, b1 = 0, b2 = 0, b5 = 0;
|
||||
quint32 b3 = 0, b6 = 0;
|
||||
QByteArray b4;
|
||||
l >> b0 >> b1 >> b2 >> b3;
|
||||
b4.resize(b1-0x10);
|
||||
l >> b4 >> b5 >> b6;
|
||||
setHead(b0);
|
||||
setSize(b1);
|
||||
setCmd(b2);
|
||||
setUid(b3);
|
||||
setData(b4);
|
||||
setSum(b5);
|
||||
setTail(b6);
|
||||
}
|
||||
|
||||
void QQTNetworkMessage::packer(QByteArray &stream)
|
||||
{
|
||||
stream << head();
|
||||
stream << size();
|
||||
stream << cmd();
|
||||
stream << uid();
|
||||
stream << data();
|
||||
stream << sum();
|
||||
stream << tail();
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug dbg, const QQTNetworkMessage &c)
|
||||
{
|
||||
dbg.nospace() << "{" << hex << c.head() << "|" <<
|
||||
hex << c.size() << "=" << dec << c.size() << "|" <<
|
||||
hex << c.cmd() << "|" <<
|
||||
hex << c.uid() << "|" <<
|
||||
c.data().data() << "@" << dec << c.data().size() << "|" <<
|
||||
hex << c.sum() << "|" <<
|
||||
hex << c.tail() << "}";
|
||||
return dbg.space();
|
||||
}
|
||||
|
@ -1,56 +0,0 @@
|
||||
#ifndef QQTNETWORKMESSAGE_H
|
||||
#define QQTNETWORKMESSAGE_H
|
||||
|
||||
#include "qqtmessage.h"
|
||||
|
||||
#define _TCPCMD_TAGHEAD 0xAA55
|
||||
#define _TCPCMD_TAGTAIL 0xCC33C33C
|
||||
|
||||
class QQTNetworkMessage : public QQTMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTNetworkMessage(QObject *parent = 0);
|
||||
|
||||
const quint16& head() const;
|
||||
void setHead(quint16 head);
|
||||
const quint16& size() const;
|
||||
void setSize(quint16 size);
|
||||
const quint16& cmd() const;
|
||||
void setCmd(quint16 cmd);
|
||||
const quint32& uid() const;
|
||||
void setUid(quint32 uid);
|
||||
const QByteArray& data() const;
|
||||
void setData(QByteArray &data);
|
||||
const quint16& sum() const;
|
||||
void setSum(quint16 sum);
|
||||
const quint32& tail() const;
|
||||
void setTail(quint32 tail);
|
||||
void translate();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
// QQTMessage interface
|
||||
public:
|
||||
|
||||
void parser(const QByteArray &l) override;
|
||||
|
||||
void packer(QByteArray &l) override;
|
||||
private:
|
||||
quint16 m_Head;
|
||||
quint16 m_Size;
|
||||
quint16 m_Cmd;
|
||||
quint32 m_Uid;
|
||||
QByteArray m_Data;
|
||||
quint16 m_Sum;
|
||||
quint32 m_Tail;
|
||||
|
||||
|
||||
};
|
||||
|
||||
QDebug operator<< (QDebug dbg, const QQTNetworkMessage &c);
|
||||
|
||||
|
||||
#endif // QQTNETWORKMESSAGE_H
|
@ -3,11 +3,13 @@
|
||||
|
||||
#include <QObject>
|
||||
#include "qqtmessage.h"
|
||||
#include <qqt.h>
|
||||
|
||||
/**
|
||||
* @brief The QQTProtocol class
|
||||
* very good ideology and impliment
|
||||
*/
|
||||
class QQTProtocol : public QObject
|
||||
class QQTSHARED_EXPORT QQTProtocol : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -1,114 +0,0 @@
|
||||
#include "qqtserialmessage.h"
|
||||
#include "qqtcore.h"
|
||||
|
||||
QQTSerialMessage::QQTSerialMessage(QObject *parent) :
|
||||
QQTMessage(parent)
|
||||
{
|
||||
m_Head = _SERIAL_HEAD;
|
||||
m_Size = m_Cmd = m_Sum = 0;
|
||||
m_Data.clear();;
|
||||
m_Tail = _SERIAL_TAIL;
|
||||
}
|
||||
|
||||
const quint16 &QQTSerialMessage::head() const { return m_Head; }
|
||||
|
||||
void QQTSerialMessage::setHead(quint16 head) { m_Head = head; }
|
||||
|
||||
const quint16 &QQTSerialMessage::size() const { return m_Size; }
|
||||
|
||||
void QQTSerialMessage::setSize(quint16 size) { m_Size = size; }
|
||||
|
||||
const quint16 &QQTSerialMessage::cmd() const { return m_Cmd; }
|
||||
|
||||
void QQTSerialMessage::setCmd(quint16 cmd) { m_Cmd = cmd; }
|
||||
|
||||
const QByteArray &QQTSerialMessage::data() const { return m_Data; }
|
||||
|
||||
void QQTSerialMessage::setData(QByteArray &data) { m_Data = data; }
|
||||
|
||||
const quint16 &QQTSerialMessage::sum() const { return m_Sum; }
|
||||
|
||||
void QQTSerialMessage::setSum(quint16 sum) { m_Sum = sum; }
|
||||
|
||||
const quint16 &QQTSerialMessage::tail() const { return m_Tail; }
|
||||
|
||||
void QQTSerialMessage::setTail(quint16 tail) { m_Tail = tail; }
|
||||
|
||||
void QQTSerialMessage::translate()
|
||||
{
|
||||
m_Size = m_Data.length() + 0x0A;
|
||||
QByteArray qbaVerify;
|
||||
qbaVerify << m_Size << m_Cmd << m_Data;
|
||||
m_Sum = 0;
|
||||
/*
|
||||
* 校验码等错误 会导致服务器不回复消息
|
||||
* 如果不添加quint8 0x0112+0x0088=0x009a 单字节到二字节进位的位置看不懂
|
||||
*/
|
||||
for(int i = 0; i < qbaVerify.length(); i++)
|
||||
m_Sum += quint8(qbaVerify.at(i));
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug dbg, const QQTSerialMessage &c)
|
||||
{
|
||||
#if 1
|
||||
dbg.nospace() << "{" << hex << c.head() << "|" <<
|
||||
hex << c.size() << "@@" << dec << c.size() << "|" <<
|
||||
hex << c.cmd() << "|" <<
|
||||
c.data().data() << "@" << dec << c.data().size() << "|" <<
|
||||
hex << c.sum() << "|" <<
|
||||
hex << c.tail() << "}";
|
||||
#elif 0
|
||||
QByteArray a;
|
||||
c.pack(a);
|
||||
dbg.nospace() << a.toHex().toUpper();
|
||||
#else
|
||||
QByteArray head;
|
||||
head << c.head();
|
||||
QByteArray size;
|
||||
size << c.size();
|
||||
QByteArray cmd;
|
||||
cmd << c.cmd();
|
||||
QByteArray data;
|
||||
data << c.data();
|
||||
QByteArray sum;
|
||||
sum << c.sum();
|
||||
QByteArray tail;
|
||||
tail << c.tail();
|
||||
dbg.nospace() << "{" << head.toHex().toUpper() << " " <<
|
||||
size.toHex().toUpper() << "@" <<
|
||||
dec << c.size() << " " <<
|
||||
cmd.toHex().toUpper() << " " <<
|
||||
data.toHex().toUpper() << "@" <<
|
||||
dec << data.size() << " " <<
|
||||
sum.toHex().toUpper() << " " <<
|
||||
tail.toHex().toUpper() << "}";
|
||||
#endif
|
||||
return dbg.space();
|
||||
}
|
||||
|
||||
void QQTSerialMessage::parser(const QByteArray &netData)
|
||||
{
|
||||
QByteArray l = netData;
|
||||
quint16 b0 = 0, b1 = 0, b2 = 0, b4 = 0, b5 = 0;
|
||||
QByteArray b3;
|
||||
l >> b0 >> b1 >> b2;
|
||||
b3.resize(b1-0x0A);
|
||||
l >> b3 >> b4 >> b5;
|
||||
setHead(b0);
|
||||
setSize(b1);
|
||||
setCmd(b2);
|
||||
setData(b3);
|
||||
setSum(b4);
|
||||
setTail(b5);
|
||||
}
|
||||
|
||||
void QQTSerialMessage::packer(QByteArray &l)
|
||||
{
|
||||
l << head();
|
||||
l << size();
|
||||
l << cmd();
|
||||
l << data();
|
||||
l << sum();
|
||||
l << tail();
|
||||
}
|
||||
|
@ -1,46 +0,0 @@
|
||||
#ifndef QQTSERIALMESSAGE_H
|
||||
#define QQTSERIALMESSAGE_H
|
||||
|
||||
#include "qqtmessage.h"
|
||||
|
||||
|
||||
#define _SERIAL_HEAD 0xAA55
|
||||
#define _SERIAL_TAIL 0xCC33
|
||||
|
||||
class QQTSerialMessage : public QQTMessage
|
||||
{
|
||||
public:
|
||||
explicit QQTSerialMessage(QObject* parent = 0);
|
||||
|
||||
const quint16& head() const;
|
||||
void setHead(quint16 head);
|
||||
const quint16& size() const;
|
||||
void setSize(quint16 size);
|
||||
//user
|
||||
const quint16& cmd() const;
|
||||
void setCmd(quint16 cmd);
|
||||
//user
|
||||
const QByteArray& data() const;
|
||||
void setData(QByteArray& data);
|
||||
const quint16& sum() const;
|
||||
void setSum(quint16 sum);
|
||||
const quint16& tail() const;
|
||||
void setTail(quint16 tail);
|
||||
void translate();
|
||||
|
||||
// QQTSyntax interface
|
||||
public:
|
||||
void parser(const QByteArray &l) override;
|
||||
void packer(QByteArray &l) override;
|
||||
private:
|
||||
quint16 m_Head;
|
||||
quint16 m_Size;
|
||||
quint16 m_Cmd;
|
||||
QByteArray m_Data;
|
||||
quint16 m_Sum;
|
||||
quint16 m_Tail;
|
||||
};
|
||||
|
||||
QDebug operator<< (QDebug dbg, const QQTSerialMessage &c);
|
||||
|
||||
#endif // QQTSERIALMESSAGE_H
|
@ -4,9 +4,9 @@
|
||||
#include <QSerialPort>
|
||||
#include "qqtcore.h"
|
||||
#include "qqtprotocol.h"
|
||||
#include "qqtserialmessage.h"
|
||||
#include <qqt.h>
|
||||
|
||||
class QQTSerialPort : public QSerialPort
|
||||
class QQTSHARED_EXPORT QQTSerialPort : public QSerialPort
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -4,8 +4,9 @@
|
||||
#include <QTcpServer>
|
||||
#include "qqtprotocol.h"
|
||||
#include "qqtclient.h"
|
||||
#include "qqt.h"
|
||||
|
||||
class QQTServer : public QTcpServer
|
||||
class QQTSHARED_EXPORT QQTServer : public QTcpServer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -1,266 +0,0 @@
|
||||
#include "qqtuserserialprotocol.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqtgui-qt.h"
|
||||
|
||||
void QQTWritePassAck::pack(QByteArray &l)
|
||||
{
|
||||
setCmd(_SERIAL_WRITEPASSACK);
|
||||
translate();
|
||||
QQTSerialMessage::packer(l);
|
||||
}
|
||||
|
||||
|
||||
void QQTWriteSerialNoAck::pack(QByteArray &l)
|
||||
{
|
||||
setCmd(_SERIAL_WRITEDEVNOACK);
|
||||
translate();
|
||||
QQTSerialMessage::packer(l);
|
||||
}
|
||||
|
||||
|
||||
void QQTHandupAck::pack(QByteArray &l)
|
||||
{
|
||||
setCmd(_SERIAL_HANDACK);
|
||||
translate();
|
||||
QQTSerialMessage::packer(l);
|
||||
}
|
||||
|
||||
|
||||
void QQTCloseAck::pack(QByteArray &l)
|
||||
{
|
||||
setCmd(_SERIAL_CLOSEACK);
|
||||
translate();
|
||||
QQTSerialMessage::packer(l);
|
||||
}
|
||||
|
||||
|
||||
void QQTReadSerialNoAck::pack(QByteArray &l)
|
||||
{
|
||||
setCmd(_SERIAL_READDEVNOACK);
|
||||
translate();
|
||||
QQTSerialMessage::packer(l);
|
||||
}
|
||||
|
||||
|
||||
void QQTReadPassAck::pack(QByteArray &l)
|
||||
{
|
||||
setCmd(_SERIAL_READPASSACK);
|
||||
translate();
|
||||
QQTSerialMessage::packer(l);
|
||||
}
|
||||
|
||||
|
||||
void QQTExceptionAck::pack(QByteArray &l)
|
||||
{
|
||||
setCmd(_SERIAL_EXCEPTIONACK);
|
||||
translate();
|
||||
QQTSerialMessage::packer(l);
|
||||
}
|
||||
|
||||
QQTUserSerialProtocol::QQTUserSerialProtocol(QObject *parent) :
|
||||
QQTProtocol(parent)
|
||||
{
|
||||
#ifdef __MIPS_LINUX__
|
||||
QString portName("/dev/ttyS2");
|
||||
#else
|
||||
QString portName("/dev/ttyS2");
|
||||
#endif
|
||||
s0 = QQTUserSerialPortInstance(this, portName, QSerialPort::Baud57600);
|
||||
|
||||
if(s0->open(QIODevice::ReadWrite)) //Open Port dev.
|
||||
pline() << QString("serial port %1 open success!").arg(portName);
|
||||
else
|
||||
pline() << QString("serial port %1 open failed! errcode =").arg(portName) << s0->errorString();
|
||||
}
|
||||
|
||||
QQTUserSerialProtocol::~QQTUserSerialProtocol()
|
||||
{
|
||||
s0->close();
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::recvHandup(const QByteArray &l)
|
||||
{
|
||||
sendHandupAck();
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::sendHandupAck()
|
||||
{
|
||||
//status c51 + local
|
||||
QByteArray s;
|
||||
s << quint8(0x00);
|
||||
QByteArray l;
|
||||
QQTHandupAck ack;
|
||||
ack.setData(s);
|
||||
ack.pack(l);
|
||||
write(l);
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::recvClose(const QByteArray &l)
|
||||
{
|
||||
sendCloseAck();
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::sendCloseAck()
|
||||
{
|
||||
QByteArray s;
|
||||
s << quint8(0x00);
|
||||
QByteArray l;
|
||||
QQTCloseAck ack;
|
||||
ack.setData(s);
|
||||
ack.pack(l);
|
||||
write(l);
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::recvWriteSerialNumber(const QByteArray &l)
|
||||
{
|
||||
QSettings set;
|
||||
set.setValue("Device/DeviceNo", l);
|
||||
set.sync();
|
||||
sendWriteSerialNumberAck();
|
||||
emit sigSerialUnlock();
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::sendWriteSerialNumberAck()
|
||||
{
|
||||
QQTWriteSerialNoAck ack;
|
||||
QSettings set;
|
||||
QByteArray sn = set.value("/Device/DeviceNo").toByteArray();
|
||||
ack.setData(sn);
|
||||
QByteArray l;
|
||||
ack.pack(l);
|
||||
write(l);
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::recvReadSerial(const QByteArray &l)
|
||||
{
|
||||
sendReadSerialAck();
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::sendReadSerialAck()
|
||||
{
|
||||
QSettings set;
|
||||
QByteArray serial = set.value("Device/DeviceNo").toByteArray();
|
||||
QByteArray l;
|
||||
QQTReadSerialNoAck ack;
|
||||
ack.setData(serial);
|
||||
ack.pack(l);
|
||||
write(l);
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::recvWritePassword(const QByteArray &l)
|
||||
{
|
||||
QSettings set;
|
||||
set.setValue("Device/Password", l);
|
||||
set.sync();
|
||||
sendWritePasswordAck();
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::sendWritePasswordAck()
|
||||
{
|
||||
QQTWritePassAck ack;
|
||||
QSettings set;
|
||||
QByteArray sn = set.value("/Device/Password").toByteArray();
|
||||
ack.setData(sn);
|
||||
QByteArray l;
|
||||
ack.pack(l);
|
||||
write(l);
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol:: recvReadPassword(const QByteArray &l)
|
||||
{
|
||||
sendReadPasswordAck();
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::sendReadPasswordAck()
|
||||
{
|
||||
QSettings set;
|
||||
QByteArray serial = set.value("Device/Password").toByteArray();
|
||||
QByteArray l;
|
||||
QQTReadPassAck ack;
|
||||
ack.setData(serial);
|
||||
ack.pack(l);
|
||||
write(l);
|
||||
}
|
||||
|
||||
void QQTUserSerialProtocol::sendExceptionAck()
|
||||
{
|
||||
/*
|
||||
* 机器运行出现异常自动通过这个串口上报
|
||||
*/
|
||||
QByteArray l;
|
||||
QQTExceptionAck ack;
|
||||
//ack.setData("");
|
||||
ack.pack(l);
|
||||
write(l);
|
||||
}
|
||||
|
||||
quint16 QQTUserSerialProtocol::minlength()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
quint16 QQTUserSerialProtocol::maxlength()
|
||||
{
|
||||
return 128;
|
||||
}
|
||||
|
||||
quint16 QQTUserSerialProtocol::splitter(const QByteArray &s)
|
||||
{
|
||||
QByteArray l = s.left(4);
|
||||
quint16 b0 = 0, b1 = 0;
|
||||
l >> b0 >> b1;
|
||||
return b1;
|
||||
}
|
||||
|
||||
|
||||
bool QQTUserSerialProtocol::dispatcher(const QByteArray &m)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
QQTSerialMessage qMsg;
|
||||
qMsg.parser(m);
|
||||
pline() << qMsg;
|
||||
|
||||
switch(qMsg.cmd())
|
||||
{
|
||||
case _SERIAL_HAND:
|
||||
recvHandup(qMsg.data());
|
||||
break;
|
||||
case _SERIAL_CLOSE:
|
||||
recvClose(qMsg.data());
|
||||
break;
|
||||
case _SERIAL_WRITEDEVNO:
|
||||
recvWriteSerialNumber(qMsg.data());
|
||||
break;
|
||||
case _SERIAL_READDEVNO:
|
||||
recvReadSerial(qMsg.data());
|
||||
break;
|
||||
case _SERIAL_WRITEPASS:
|
||||
recvWritePassword(qMsg.data());
|
||||
break;
|
||||
case _SERIAL_READPASS:
|
||||
recvReadPassword(qMsg.data());
|
||||
break;
|
||||
default:
|
||||
ret = false;
|
||||
pline() << "receive unknown command:" << hex << qMsg.cmd();
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QQTSerialPort *QQTUserSerialPortInstance(QObject *parent, QString name, QSerialPort::BaudRate)
|
||||
{
|
||||
static QQTSerialPort* s0 = NULL;
|
||||
if(s0 == 0)
|
||||
{
|
||||
s0 = new QQTSerialPort(parent);
|
||||
s0->setPortName(name);
|
||||
s0->setBaudRate(QSerialPort::Baud57600);
|
||||
s0->setDataBits(QSerialPort::Data8);
|
||||
s0->setParity(QSerialPort::NoParity);
|
||||
s0->setStopBits(QSerialPort::OneStop);
|
||||
s0->setFlowControl(QSerialPort::NoFlowControl);
|
||||
}
|
||||
return s0;
|
||||
}
|
@ -1,130 +0,0 @@
|
||||
#ifndef QQTUSERSERIALPROTOCOL_H
|
||||
#define QQTUSERSERIALPROTOCOL_H
|
||||
|
||||
#include "qqtserialmessage.h"
|
||||
#include "qqtprotocol.h"
|
||||
#include "qqtserialport.h"
|
||||
|
||||
#define _SERIAL_HAND 0x0001
|
||||
#define _SERIAL_HANDACK 0x8001
|
||||
#define _SERIAL_CLOSE 0x0002
|
||||
#define _SERIAL_CLOSEACK 0x8002
|
||||
#define _SERIAL_WRITEDEVNO 0x0003
|
||||
#define _SERIAL_WRITEDEVNOACK 0x8003
|
||||
#define _SERIAL_READDEVNO 0x0004
|
||||
#define _SERIAL_READDEVNOACK 0x8004
|
||||
#define _SERIAL_WRITEPASS 0x0005
|
||||
#define _SERIAL_WRITEPASSACK 0x8005
|
||||
#define _SERIAL_READPASS 0x0006
|
||||
#define _SERIAL_READPASSACK 0x8006
|
||||
#define _SERIAL_EXCEPTIONACK 0x800F
|
||||
|
||||
|
||||
class QQTHandupAck : public QQTSerialMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTHandupAck(QObject *parent = 0) : QQTSerialMessage(parent){}
|
||||
|
||||
void pack(QByteArray& l);
|
||||
};
|
||||
|
||||
class QQTCloseAck : public QQTSerialMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTCloseAck(QObject *parent = 0) : QQTSerialMessage(parent){}
|
||||
|
||||
void pack(QByteArray &l);
|
||||
};
|
||||
|
||||
class QQTWriteSerialNoAck : public QQTSerialMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTWriteSerialNoAck(QObject *parent = 0) : QQTSerialMessage(parent){}
|
||||
|
||||
void pack(QByteArray& l);
|
||||
};
|
||||
|
||||
class QQTReadSerialNoAck : public QQTSerialMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTReadSerialNoAck(QObject *parent = 0) : QQTSerialMessage(parent){}
|
||||
|
||||
void pack(QByteArray& l);
|
||||
};
|
||||
|
||||
class QQTWritePassAck : public QQTSerialMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTWritePassAck(QObject *parent = 0) : QQTSerialMessage(parent){}
|
||||
|
||||
void pack(QByteArray &l);
|
||||
};
|
||||
|
||||
|
||||
class QQTReadPassAck : public QQTSerialMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTReadPassAck(QObject *parent = 0) : QQTSerialMessage(parent){}
|
||||
|
||||
void pack(QByteArray &l);
|
||||
};
|
||||
|
||||
|
||||
class QQTExceptionAck : public QQTSerialMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTExceptionAck(QObject *parent = 0) : QQTSerialMessage(parent){}
|
||||
|
||||
void pack(QByteArray &l);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The QQTUserSerialProtocol class
|
||||
* 用户使用这个串口操作机器
|
||||
*/
|
||||
class QQTUserSerialProtocol : public QQTProtocol
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQTUserSerialProtocol(QObject *parent = 0);
|
||||
~QQTUserSerialProtocol();
|
||||
|
||||
signals:
|
||||
void sigSerialUnlock();
|
||||
|
||||
public slots:
|
||||
void recvHandup(const QByteArray& l);
|
||||
void sendHandupAck();
|
||||
void recvClose(const QByteArray& l);
|
||||
void sendCloseAck();
|
||||
void recvWriteSerialNumber(const QByteArray& l);
|
||||
void sendWriteSerialNumberAck();
|
||||
void recvReadSerial(const QByteArray& l);
|
||||
void sendReadSerialAck();
|
||||
void recvWritePassword(const QByteArray& l);
|
||||
void sendWritePasswordAck();
|
||||
void recvReadPassword(const QByteArray& l);
|
||||
void sendReadPasswordAck();
|
||||
void sendExceptionAck();
|
||||
|
||||
|
||||
// QQTProtocol interface
|
||||
public:
|
||||
quint16 minlength() override;
|
||||
quint16 maxlength() override;
|
||||
quint16 splitter(const QByteArray &s) override;
|
||||
bool dispatcher(const QByteArray &m) override;
|
||||
|
||||
private:
|
||||
QQTSerialPort* s0;
|
||||
};
|
||||
|
||||
QQTSerialPort* QQTUserSerialPortInstance(QObject* parent = 0, QString name = "/dev/tty0", QSerialPort::BaudRate = QSerialPort::Baud57600);
|
||||
#endif // QQTUSERSERIALPROTOCOL_H
|
@ -4,8 +4,9 @@
|
||||
#include <QNetworkAccessManager>
|
||||
//import this struct will not build fail
|
||||
#include <QNetworkProxy>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQtWebClient : public QNetworkAccessManager
|
||||
class QQTSHARED_EXPORT QQtWebClient : public QNetworkAccessManager
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -4,8 +4,9 @@
|
||||
#include <QObject>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQtWebProtocol : public QObject
|
||||
class QQTSHARED_EXPORT QQtWebProtocol : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/******************************************************************************
|
||||
Name: description
|
||||
Name: description
|
||||
Copyright (C) 2011-2015 Wang Bin <wbsecg1@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@ -24,14 +24,15 @@
|
||||
#include <QtCore/QThread>
|
||||
#include "qdevicewatcher.h"
|
||||
#include <QTimer>
|
||||
#include <qqt.h>
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __PRETTY_FUNCTION__ __FUNCTION__
|
||||
#endif
|
||||
|
||||
class QQTPluginWatcher : public QThread
|
||||
class QQTSHARED_EXPORT QQTPluginWatcher : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
static QQTPluginWatcher *Instance();
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define _QQTPRINTER_H
|
||||
|
||||
#include <QPrinter>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQTPrinter : public QPrinter
|
||||
class QQTSHARED_EXPORT QQTPrinter : public QPrinter
|
||||
{
|
||||
public:
|
||||
QQTPrinter(PrinterMode mode = HighResolution);
|
||||
|
13
src/qqt.h
13
src/qqt.h
@ -1,8 +1,17 @@
|
||||
#ifndef QQTPUB_H
|
||||
#define QQTPUB_H
|
||||
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(QQT_LIBRARY)
|
||||
# define QQTSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define QQTSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#include "qqtgui.h"
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
#if defined(__WIN__) || defined(__WIN64__)
|
||||
#include "qqtwin.h"
|
||||
#elif defined(__LINUX__) || defined(__LINUX64__)
|
||||
@ -14,6 +23,6 @@
|
||||
#include "qqtsql.h"
|
||||
#include "qqtnetwork.h"
|
||||
#include "qqtwidgets.h"
|
||||
|
||||
#include "qqtframe.h"
|
||||
|
||||
#endif // QQTPUB_H
|
||||
|
373
src/qqt.pri
373
src/qqt.pri
@ -14,6 +14,13 @@ QT += core gui network sql xml
|
||||
DEFINES += _TTY_POSIX_
|
||||
|
||||
INCLUDEPATH += $$PWD \
|
||||
$$PWD/core \
|
||||
$$PWD/gui \
|
||||
$$PWD/multimedia \
|
||||
$$PWD/network \
|
||||
$$PWD/printsupport \
|
||||
$$PWD/sql \
|
||||
$$PWD/widgets \
|
||||
$$PWD/customplot \
|
||||
$$PWD/pluginwatcher \
|
||||
$$PWD/dmmu \
|
||||
@ -21,24 +28,27 @@ INCLUDEPATH += $$PWD \
|
||||
|
||||
QT_KIT = $$(QKIT)
|
||||
|
||||
message($${QT_KIT} Defined in qqtfoundation)
|
||||
message($${QT_KIT} Defined in libqt)
|
||||
#MIPS __MIPS_LINUX__
|
||||
#LINUX __LINUX__
|
||||
#LINUX64 __LINUX64__
|
||||
#WIN __WIN__
|
||||
#WIN64 __WIN64__
|
||||
#macOS __DARWIN__
|
||||
#处理文件内平台小差异
|
||||
equals(QT_KIT, MIPS32) {
|
||||
QT += multimedia
|
||||
DEFINES += __MIPS_LINUX__
|
||||
} else:equals(QT_KIT, LINUX) {
|
||||
DEFINES += __LINUX__
|
||||
} else:equals(QT_KIT, LINUX64) {
|
||||
} else:equals(QT_KIT, LINUX64) {
|
||||
DEFINES += __LINUX64__
|
||||
} else:equals(QT_KIT, WIN) {
|
||||
} else:equals(QT_KIT, WIN) {
|
||||
DEFINES += __WIN__
|
||||
} else:equals(QT_KIT, WIN64) {
|
||||
DEFINES += __WIN64__
|
||||
} else:equals(QT_KIT, macOS) {
|
||||
DEFINES += __DARWIN__
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
@ -52,188 +62,219 @@ win32 {
|
||||
LIBS += -luser32
|
||||
}
|
||||
|
||||
#root dir
|
||||
win32 {
|
||||
#win32 base type
|
||||
HEADERS += $$PWD/qqtwin.h
|
||||
|
||||
wince*: SOURCES += $$PWD/pluginwatcher/qdevicewatcher_wince.cpp
|
||||
else: SOURCES += $$PWD/pluginwatcher/qdevicewatcher_win32.cpp
|
||||
}
|
||||
|
||||
unix {
|
||||
macx {
|
||||
SOURCES += $$PWD/pluginwatcher/qdevicewatcher_mac.cpp
|
||||
LIBS += -framework DiskArbitration -framework Foundation
|
||||
HEADERS += $$PWD/qqtdarwin.h
|
||||
LIBS += -framework DiskArbitration -framework Cocoa -framework IOKit
|
||||
} else {
|
||||
SOURCES += $$PWD/pluginwatcher/qdevicewatcher_linux.cpp
|
||||
HEADERS += $$PWD/qqtlinux.h
|
||||
}
|
||||
#frame
|
||||
SOURCES += $$PWD/frame/qqtprogressdialog.cpp \
|
||||
$$PWD/frame/qqtpassworddialog.cpp \
|
||||
$$PWD/frame/qqtpreviewwidget.cpp \
|
||||
$$PWD/frame/qqtwifiwidget.cpp
|
||||
HEADERS += $$PWD/frame/qqtprogressdialog.h \
|
||||
$$PWD/frame/qqtpassworddialog.h \
|
||||
$$PWD/frame/qqtpreviewwidget.h \
|
||||
$$PWD/frame/qqtwifiwidget.h
|
||||
FORMS += $$PWD/frame/qqtprogressdialog.ui \
|
||||
$$PWD/frame/qqtpassworddialog.ui \
|
||||
$$PWD/frame/qqtpreviewwidget.ui \
|
||||
$$PWD/frame/qqtwifiwidget.ui
|
||||
#dmmu
|
||||
SOURCES += $$PWD/dmmu/dmmu.c
|
||||
HEADERS += $$PWD/dmmu/dmmu.h \
|
||||
$$PWD/dmmu/jz_cim.h \
|
||||
$$PWD/dmmu/graphics.h \
|
||||
$$PWD/dmmu/hal.h
|
||||
#
|
||||
SOURCES += $$PWD/qqtethenetmanager.cpp
|
||||
HEADERS += $$PWD/qqtethenetmanager.h \
|
||||
$$PWD/qqtlinux.h
|
||||
}
|
||||
#websocket
|
||||
lessThan(QT_MAJOR_VERSION, 5) {
|
||||
SOURCES += $$PWD/qqtq4ftpprotocol.cpp \
|
||||
$$PWD/qqtq4httpprotocol.cpp
|
||||
HEADERS += $$PWD/qqtq4ftpprotocol.h \
|
||||
$$PWD/qqtq4httpprotocol.h
|
||||
}
|
||||
SOURCES += $$PWD/qqtwebclient.cpp \
|
||||
$$PWD/qqtftptreemodel.cpp \
|
||||
$$PWD/qqtftpprotocol.cpp \
|
||||
$$PWD/qqthttpprotocol.cpp \
|
||||
$$PWD/qqtwebprotocol.cpp
|
||||
HEADERS += $$PWD/qqtwebclient.h \
|
||||
$$PWD/qqtftptreemodel.h \
|
||||
$$PWD/qqtftpprotocol.h \
|
||||
$$PWD/qqthttpprotocol.h \
|
||||
$$PWD/qqtwebprotocol.h
|
||||
HEADERS += \
|
||||
$$PWD/qqt.h \
|
||||
$$PWD/qqtversion.h \
|
||||
$$PWD/qqt-qt.h
|
||||
|
||||
#core
|
||||
SOURCES += $$PWD/core/qqtcore.cpp \
|
||||
$$PWD/core/qqtanimation.cpp \
|
||||
$$PWD/core/qqtobjectfactory.cpp
|
||||
HEADERS += $$PWD/core/qqtcore.h \
|
||||
$$PWD/core/qqtanimation.h \
|
||||
$$PWD/core/qqtobjectfactory.h
|
||||
|
||||
|
||||
#customplot
|
||||
SOURCES += $$PWD/customplot/qcpdocumentobject.cpp \
|
||||
$$PWD/customplot/qcustomplot.cpp
|
||||
HEADERS += $$PWD/customplot/qcpdocumentobject.h \
|
||||
$$PWD/customplot/qcustomplot.h
|
||||
|
||||
|
||||
|
||||
|
||||
#dmmu
|
||||
equals(QT_KIT, MIPS32) {
|
||||
SOURCES += $$PWD/dmmu/dmmu.c
|
||||
HEADERS += $$PWD/dmmu/dmmu.h \
|
||||
$$PWD/dmmu/jz_cim.h \
|
||||
$$PWD/dmmu/graphics.h \
|
||||
$$PWD/dmmu/hal.h
|
||||
}
|
||||
|
||||
|
||||
#frame
|
||||
equals(QT_KIT, MIPS32) {
|
||||
SOURCES += $$PWD/frame/qqtpreviewwidget.cpp \
|
||||
$$PWD/frame/qqtwifiwidget.cpp
|
||||
HEADERS += $$PWD/frame/qqtpreviewwidget.h \
|
||||
$$PWD/frame/qqtwifiwidget.h
|
||||
FORMS += $$PWD/frame/qqtpreviewwidget.ui \
|
||||
$$PWD/frame/qqtwifiwidget.ui
|
||||
}
|
||||
SOURCES += \
|
||||
$$PWD/frame/qqtprogressdialog.cpp \
|
||||
$$PWD/frame/qqtpassworddialog.cpp \
|
||||
$$PWD/frame/qqtframe.cpp \
|
||||
$$PWD/frame/qqtdialog.cpp \
|
||||
$$PWD/frame/qqtmsgbox.cpp \
|
||||
$$PWD/frame/qqtinput.cpp \
|
||||
$$PWD/frame/qqtword.cpp
|
||||
HEADERS += \
|
||||
$$PWD/frame/qqtprogressdialog.h \
|
||||
$$PWD/frame/qqtpassworddialog.h \
|
||||
$$PWD/frame/qqtframe.h \
|
||||
$$PWD/frame/qqtdialog.h \
|
||||
$$PWD/frame/qqtmsgbox.h \
|
||||
$$PWD/frame/qqtinput.h \
|
||||
$$PWD/frame/qqtword.h
|
||||
FORMS += \
|
||||
$$PWD/frame/qqtprogressdialog.ui \
|
||||
$$PWD/frame/qqtpassworddialog.ui \
|
||||
$$PWD/frame/qqtdialog.ui \
|
||||
$$PWD/frame/qqtinput.ui \
|
||||
$$PWD/frame/qqtmsgbox.ui
|
||||
|
||||
|
||||
#gui
|
||||
SOURCES += \
|
||||
$$PWD/gui/qqtftptreemodel.cpp \
|
||||
$$PWD/gui/qqtsqltreemodel.cpp \
|
||||
$$PWD/gui/qqttablemodel.cpp \
|
||||
$$PWD/gui/qqttreemodel.cpp \
|
||||
$$PWD/gui/qqtxmltreemodel.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/gui/qqtftptreemodel.h \
|
||||
$$PWD/gui/qqtsqltreemodel.h \
|
||||
$$PWD/gui/qqttablemodel.h \
|
||||
$$PWD/gui/qqttreemodel.h \
|
||||
$$PWD/gui/qqtxmltreemodel.h \
|
||||
$$PWD/gui/qqtgui.h
|
||||
|
||||
|
||||
#multimedia
|
||||
SOURCES += $$PWD/multimedia/qqtmplayer.cpp
|
||||
HEADERS += $$PWD/multimedia/qqtmplayer.h
|
||||
|
||||
|
||||
#network
|
||||
equals(QT_KIT, MIPS32) {
|
||||
SOURCES += $$PWD/network/qqtethenetmanager.cpp
|
||||
HEADERS += $$PWD/network/qqtethenetmanager.h
|
||||
}
|
||||
##websocket
|
||||
SOURCES += $$PWD/network/qqtwebclient.cpp \
|
||||
$$PWD/network/qqtftpprotocol.cpp \
|
||||
$$PWD/network/qqthttpprotocol.cpp \
|
||||
$$PWD/network/qqtwebprotocol.cpp
|
||||
HEADERS += $$PWD/network/qqtwebclient.h \
|
||||
$$PWD/network/qqtftpprotocol.h \
|
||||
$$PWD/network/qqthttpprotocol.h \
|
||||
$$PWD/network/qqtwebprotocol.h
|
||||
#tcpsocket
|
||||
SOURCES += \
|
||||
$$PWD/network/qqtclient.cpp \
|
||||
$$PWD/network/qqtserialport.cpp \
|
||||
$$PWD/network/qqtserver.cpp \
|
||||
$$PWD/network/qqtmessage.cpp \
|
||||
$$PWD/network/qqtprotocol.cpp \
|
||||
$$PWD/network/qqtnetwork.cpp
|
||||
HEADERS += \
|
||||
$$PWD/network/qqtclient.h \
|
||||
$$PWD/network/qqtserialport.h \
|
||||
$$PWD/network/qqtserver.h \
|
||||
$$PWD/network/qqtmessage.h \
|
||||
$$PWD/network/qqtprotocol.h \
|
||||
$$PWD/network/qqtnetwork.h
|
||||
|
||||
#pluginwatcher
|
||||
win32 {
|
||||
wince*: SOURCES += $$PWD/pluginwatcher/qdevicewatcher_wince.cpp
|
||||
else: SOURCES += $$PWD/pluginwatcher/qdevicewatcher_win32.cpp
|
||||
}
|
||||
unix {
|
||||
macx {
|
||||
SOURCES += $$PWD/pluginwatcher/qdevicewatcher_mac.cpp
|
||||
} else {
|
||||
SOURCES += $$PWD/pluginwatcher/qdevicewatcher_linux.cpp
|
||||
}
|
||||
}
|
||||
SOURCES += $$PWD/pluginwatcher/qdevicewatcher.cpp \
|
||||
$$PWD/pluginwatcher/qqtpluginwatcher.cpp
|
||||
HEADERS += $$PWD/pluginwatcher/qqtpluginwatcher.h \
|
||||
$$PWD/pluginwatcher/qdevicewatcher.h \
|
||||
$$PWD/pluginwatcher/qdevicewatcher_p.h
|
||||
#com
|
||||
SOURCES += $$PWD/qqtcheckbox.cpp \
|
||||
$$PWD/qqtdefine.cpp \
|
||||
$$PWD/qqtdialog.cpp \
|
||||
$$PWD/qqtheaderview.cpp \
|
||||
$$PWD/qqtlistview.cpp \
|
||||
$$PWD/qqtprinter.cpp \
|
||||
$$PWD/qqtprogressbar.cpp \
|
||||
$$PWD/qqtpushbutton.cpp \
|
||||
$$PWD/qqtradiobutton.cpp \
|
||||
$$PWD/qqttabbar.cpp \
|
||||
$$PWD/qqttableview.cpp \
|
||||
$$PWD/qqttabwidget.cpp \
|
||||
$$PWD/qqttabwidgetb.cpp \
|
||||
$$PWD/qqttreeview.cpp \
|
||||
$$PWD/qqtwidget.cpp \
|
||||
$$PWD/qqtclient.cpp \
|
||||
$$PWD/qqtlineeditwithsearch.cpp \
|
||||
$$PWD/qqtplayer.cpp \
|
||||
$$PWD/qqtserialport.cpp \
|
||||
$$PWD/qqtserver.cpp \
|
||||
$$PWD/qqttablemodel.cpp \
|
||||
$$PWD/qqtmptablewidget.cpp \
|
||||
$$PWD/qqttablewidget.cpp \
|
||||
$$PWD/qqtgraphicsscene.cpp \
|
||||
$$PWD/qqtgraphicsitem.cpp \
|
||||
$$PWD/qqtgraphicsview.cpp \
|
||||
$$PWD/qqtword.cpp \
|
||||
$$PWD/qqtreport.cpp \
|
||||
$$PWD/qqtobjectfactory.cpp \
|
||||
$$PWD/qqtfilesystem.cpp \
|
||||
$$PWD/qqtinput.cpp \
|
||||
$$PWD/qqtmsgbox.cpp \
|
||||
$$PWD/qqtcloudprotocol.cpp \
|
||||
$$PWD/qqtmessage.cpp \
|
||||
$$PWD/qqtprotocol.cpp \
|
||||
$$PWD/qqtserialmessage.cpp \
|
||||
$$PWD/qqtnetworkmessage.cpp \
|
||||
$$PWD/qqtuserserialprotocol.cpp \
|
||||
$$PWD/qqtlanprotocol.cpp \
|
||||
$$PWD/qqtanimation.cpp \
|
||||
$$PWD/qqtcloudtreemodel.cpp \
|
||||
$$PWD/qqtcloudtreewidget.cpp \
|
||||
$$PWD/qqttreewidget.cpp \
|
||||
$$PWD/qqttreemodel.cpp \
|
||||
$$PWD/qqtfilesystemtreemodel.cpp \
|
||||
$$PWD/qqtsqltreemodel.cpp \
|
||||
$$PWD/qqtxmltreemodel.cpp
|
||||
|
||||
HEADERS += $$PWD/qqtcheckbox.h \
|
||||
$$PWD/qqtdefine.h \
|
||||
$$PWD/qqtdialog.h \
|
||||
$$PWD/qqtgui.h \
|
||||
$$PWD/qqtgui-qt.h \
|
||||
$$PWD/qqtheaderview.h \
|
||||
$$PWD/qqtlistview.h \
|
||||
$$PWD/qqtprinter.h \
|
||||
$$PWD/qqtprogressbar.h \
|
||||
$$PWD/qqtFoundation.h \
|
||||
$$PWD/qqtpushbutton.h \
|
||||
$$PWD/qqtradiobutton.h \
|
||||
$$PWD/qqttabbar.h \
|
||||
$$PWD/qqttableview.h \
|
||||
$$PWD/qqttabwidget.h \
|
||||
$$PWD/qqttabwidgetb.h \
|
||||
$$PWD/qqttreeview.h \
|
||||
$$PWD/qqtwidget.h \
|
||||
$$PWD/qqtclient.h \
|
||||
$$PWD/qqtlineeditwithsearch.h \
|
||||
$$PWD/qqtplayer.h \
|
||||
$$PWD/qqtserialport.h \
|
||||
$$PWD/qqtserver.h \
|
||||
$$PWD/qqttablemodel.h \
|
||||
$$PWD/qqtmptablewidget.h \
|
||||
$$PWD/qqttablewidget.h \
|
||||
$$PWD/qqtgraphicsscene.h \
|
||||
$$PWD/qqtgraphicsitem.h \
|
||||
$$PWD/qqtgraphicsview.h \
|
||||
$$PWD/qqtword.h \
|
||||
$$PWD/qqtreport.h \
|
||||
$$PWD/version.h \
|
||||
$$PWD/qqtobjectfactory.h \
|
||||
$$PWD/qqtfilesystem.h \
|
||||
$$PWD/qqtinput.h \
|
||||
$$PWD/qqtmsgbox.h \
|
||||
$$PWD/qqtcloudprotocol.h \
|
||||
$$PWD/qqtprotocol.h \
|
||||
$$PWD/qqtmessage.h \
|
||||
$$PWD/qqtserialmessage.h \
|
||||
$$PWD/qqtnetworkmessage.h \
|
||||
$$PWD/qqtuserserialprotocol.h \
|
||||
$$PWD/qqtlanprotocol.h \
|
||||
$$PWD/qqtanimation.h \
|
||||
$$PWD/qqtcloudtreemodel.h \
|
||||
$$PWD/qqtcloudtreewidget.h \
|
||||
$$PWD/qqttreewidget.h \
|
||||
$$PWD/qqttreemodel.h \
|
||||
$$PWD/qqtfilesystemtreemodel.h \
|
||||
$$PWD/qqtsqltreemodel.h \
|
||||
$$PWD/qqtxmltreemodel.h
|
||||
#printsupport
|
||||
SOURCES += $$PWD/printsupport/qqtprinter.cpp
|
||||
HEADERS += $$PWD/printsupport/qqtprinter.h
|
||||
|
||||
FORMS += $$PWD/qqtcheckbox.ui \
|
||||
$$PWD/qqtdialog.ui \
|
||||
$$PWD/qqtlistview.ui \
|
||||
$$PWD/qqtprogressbar.ui \
|
||||
$$PWD/qqtpushbutton.ui \
|
||||
$$PWD/qqtradiobutton.ui \
|
||||
$$PWD/qqttableview.ui \
|
||||
$$PWD/qqttabwidget.ui \
|
||||
$$PWD/qqttabwidgetb.ui \
|
||||
$$PWD/qqttreeview.ui \
|
||||
$$PWD/qqtwidget.ui \
|
||||
$$PWD/qqttablewidget.ui \
|
||||
$$PWD/qqtmptablewidget.ui \
|
||||
$$PWD/qqtinput.ui \
|
||||
$$PWD/qqtmsgbox.ui \
|
||||
$$PWD/qqtcloudtreewidget.ui \
|
||||
$$PWD/qqttreewidget.ui
|
||||
|
||||
#sql
|
||||
SOURCES += $$PWD/sql/qqtsql.cpp
|
||||
HEADERS += $$PWD/sql/qqtsql.h
|
||||
|
||||
|
||||
#widgets
|
||||
SOURCES += \
|
||||
$$PWD/widgets/qqtcheckbox.cpp \
|
||||
$$PWD/widgets/qqtheaderview.cpp \
|
||||
$$PWD/widgets/qqtlistview.cpp \
|
||||
$$PWD/widgets/qqtprogressbar.cpp \
|
||||
$$PWD/widgets/qqtpushbutton.cpp \
|
||||
$$PWD/widgets/qqtradiobutton.cpp \
|
||||
$$PWD/widgets/qqttabbar.cpp \
|
||||
$$PWD/widgets/qqttableview.cpp \
|
||||
$$PWD/widgets/qqttabwidget.cpp \
|
||||
$$PWD/widgets/qqttabwidgetb.cpp \
|
||||
$$PWD/widgets/qqttreeview.cpp \
|
||||
$$PWD/widgets/qqtlineeditwithsearch.cpp \
|
||||
$$PWD/widgets/qqtmptablewidget.cpp \
|
||||
$$PWD/widgets/qqttablewidget.cpp \
|
||||
$$PWD/widgets/qqtgraphicsscene.cpp \
|
||||
$$PWD/widgets/qqtgraphicsitem.cpp \
|
||||
$$PWD/widgets/qqtgraphicsview.cpp \
|
||||
$$PWD/widgets/qqttreewidget.cpp \
|
||||
$$PWD/widgets/qqtwidget.cpp \
|
||||
$$PWD/widgets/qqtwidgets.cpp
|
||||
HEADERS += \
|
||||
$$PWD/widgets/qqtcheckbox.h \
|
||||
$$PWD/widgets/qqtheaderview.h \
|
||||
$$PWD/widgets/qqtlistview.h \
|
||||
$$PWD/widgets/qqtprogressbar.h \
|
||||
$$PWD/widgets/qqtpushbutton.h \
|
||||
$$PWD/widgets/qqtradiobutton.h \
|
||||
$$PWD/widgets/qqttabbar.h \
|
||||
$$PWD/widgets/qqttableview.h \
|
||||
$$PWD/widgets/qqttabwidget.h \
|
||||
$$PWD/widgets/qqttabwidgetb.h \
|
||||
$$PWD/widgets/qqttreeview.h \
|
||||
$$PWD/widgets/qqtlineeditwithsearch.h \
|
||||
$$PWD/widgets/qqtmptablewidget.h \
|
||||
$$PWD/widgets/qqttablewidget.h \
|
||||
$$PWD/widgets/qqtgraphicsscene.h \
|
||||
$$PWD/widgets/qqtgraphicsitem.h \
|
||||
$$PWD/widgets/qqtgraphicsview.h \
|
||||
$$PWD/widgets/qqttreewidget.h \
|
||||
$$PWD/widgets/qqtwidget.h \
|
||||
$$PWD/widgets/qqtwidgets.h
|
||||
FORMS += \
|
||||
$$PWD/widgets/qqtcheckbox.ui \
|
||||
$$PWD/widgets/qqtlistview.ui \
|
||||
$$PWD/widgets/qqtprogressbar.ui \
|
||||
$$PWD/widgets/qqtpushbutton.ui \
|
||||
$$PWD/widgets/qqtradiobutton.ui \
|
||||
$$PWD/widgets/qqttableview.ui \
|
||||
$$PWD/widgets/qqttabwidget.ui \
|
||||
$$PWD/widgets/qqttabwidgetb.ui \
|
||||
$$PWD/widgets/qqttreeview.ui \
|
||||
$$PWD/widgets/qqtwidget.ui \
|
||||
$$PWD/widgets/qqttablewidget.ui \
|
||||
$$PWD/widgets/qqtmptablewidget.ui \
|
||||
$$PWD/widgets/qqttreewidget.ui
|
||||
|
284
src/qqt.pro
Normal file
284
src/qqt.pro
Normal file
@ -0,0 +1,284 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2016-03-24T14:08:11
|
||||
#
|
||||
#-------------------------------------------------
|
||||
TARGET = qqt
|
||||
TEMPLATE = lib
|
||||
|
||||
DEFINES += QQT_LIBRARY QCUSTOMPLOT_COMPILE_LIBRARY BUILD_QDEVICEWATCHER_LIB
|
||||
|
||||
lessThan(QT_MAJOR_VERSION, 5): CONFIG += serialport
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport serialport
|
||||
greaterThan(QT_MAJOR_VERSION, 4): DEFINES += __QT5__
|
||||
|
||||
QT += core gui network sql xml
|
||||
|
||||
DEFINES += _TTY_POSIX_
|
||||
|
||||
INCLUDEPATH += $$PWD \
|
||||
$$PWD/core \
|
||||
$$PWD/gui \
|
||||
$$PWD/multimedia \
|
||||
$$PWD/network \
|
||||
$$PWD/printsupport \
|
||||
$$PWD/sql \
|
||||
$$PWD/widgets \
|
||||
$$PWD/customplot \
|
||||
$$PWD/pluginwatcher \
|
||||
$$PWD/dmmu \
|
||||
$$PWD/frame
|
||||
|
||||
QT_KIT = $$(QKIT)
|
||||
|
||||
message($${QT_KIT} Defined in libqt)
|
||||
#MIPS __MIPS_LINUX__
|
||||
#LINUX __LINUX__
|
||||
#LINUX64 __LINUX64__
|
||||
#WIN __WIN__
|
||||
#WIN64 __WIN64__
|
||||
#macOS __DARWIN__
|
||||
#处理文件内平台小差异
|
||||
equals(QT_KIT, MIPS32) {
|
||||
QT += multimedia
|
||||
DEFINES += __MIPS_LINUX__
|
||||
} else:equals(QT_KIT, LINUX) {
|
||||
DEFINES += __LINUX__
|
||||
} else:equals(QT_KIT, LINUX64) {
|
||||
DEFINES += __LINUX64__
|
||||
} else:equals(QT_KIT, WIN) {
|
||||
DEFINES += __WIN__
|
||||
} else:equals(QT_KIT, WIN64) {
|
||||
DEFINES += __WIN64__
|
||||
} else:equals(QT_KIT, macOS) {
|
||||
DEFINES += __DARWIN__
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
} else {
|
||||
DEFINES -= QT_NO_DEBUG_OUTPUT
|
||||
}
|
||||
|
||||
win32 {
|
||||
win32:DEFINES += _CRT_SECURE_NO_WARNINGS #fopen fopen_s
|
||||
QMAKE_CXXFLAGS += /wd"4819" /wd"4244" /wd"4100"
|
||||
LIBS += -luser32
|
||||
}
|
||||
|
||||
#root dir
|
||||
win32 {
|
||||
#win32 base type
|
||||
HEADERS += $$PWD/qqtwin.h
|
||||
}
|
||||
unix {
|
||||
macx {
|
||||
HEADERS += $$PWD/qqtdarwin.h
|
||||
LIBS += -framework DiskArbitration -framework Cocoa -framework IOKit
|
||||
} else {
|
||||
HEADERS += $$PWD/qqtlinux.h
|
||||
}
|
||||
}
|
||||
HEADERS += \
|
||||
$$PWD/qqt.h \
|
||||
$$PWD/qqtversion.h \
|
||||
$$PWD/qqt-qt.h
|
||||
|
||||
#core
|
||||
SOURCES += $$PWD/core/qqtcore.cpp \
|
||||
$$PWD/core/qqtanimation.cpp \
|
||||
$$PWD/core/qqtobjectfactory.cpp
|
||||
HEADERS += $$PWD/core/qqtcore.h \
|
||||
$$PWD/core/qqtanimation.h \
|
||||
$$PWD/core/qqtobjectfactory.h
|
||||
|
||||
|
||||
#customplot
|
||||
SOURCES += $$PWD/customplot/qcpdocumentobject.cpp \
|
||||
$$PWD/customplot/qcustomplot.cpp
|
||||
HEADERS += $$PWD/customplot/qcpdocumentobject.h \
|
||||
$$PWD/customplot/qcustomplot.h
|
||||
|
||||
|
||||
|
||||
|
||||
#dmmu
|
||||
equals(QT_KIT, MIPS32) {
|
||||
SOURCES += $$PWD/dmmu/dmmu.c
|
||||
HEADERS += $$PWD/dmmu/dmmu.h \
|
||||
$$PWD/dmmu/jz_cim.h \
|
||||
$$PWD/dmmu/graphics.h \
|
||||
$$PWD/dmmu/hal.h
|
||||
}
|
||||
|
||||
|
||||
#frame
|
||||
equals(QT_KIT, MIPS32) {
|
||||
SOURCES += $$PWD/frame/qqtpreviewwidget.cpp \
|
||||
$$PWD/frame/qqtwifiwidget.cpp
|
||||
HEADERS += $$PWD/frame/qqtpreviewwidget.h \
|
||||
$$PWD/frame/qqtwifiwidget.h
|
||||
FORMS += $$PWD/frame/qqtpreviewwidget.ui \
|
||||
$$PWD/frame/qqtwifiwidget.ui
|
||||
}
|
||||
SOURCES += \
|
||||
$$PWD/frame/qqtprogressdialog.cpp \
|
||||
$$PWD/frame/qqtpassworddialog.cpp \
|
||||
$$PWD/frame/qqtframe.cpp \
|
||||
$$PWD/frame/qqtdialog.cpp \
|
||||
$$PWD/frame/qqtmsgbox.cpp \
|
||||
$$PWD/frame/qqtinput.cpp \
|
||||
$$PWD/frame/qqtword.cpp
|
||||
HEADERS += \
|
||||
$$PWD/frame/qqtprogressdialog.h \
|
||||
$$PWD/frame/qqtpassworddialog.h \
|
||||
$$PWD/frame/qqtframe.h \
|
||||
$$PWD/frame/qqtdialog.h \
|
||||
$$PWD/frame/qqtmsgbox.h \
|
||||
$$PWD/frame/qqtinput.h \
|
||||
$$PWD/frame/qqtword.h
|
||||
FORMS += \
|
||||
$$PWD/frame/qqtprogressdialog.ui \
|
||||
$$PWD/frame/qqtpassworddialog.ui \
|
||||
$$PWD/frame/qqtdialog.ui \
|
||||
$$PWD/frame/qqtinput.ui \
|
||||
$$PWD/frame/qqtmsgbox.ui
|
||||
|
||||
|
||||
#gui
|
||||
SOURCES += \
|
||||
$$PWD/gui/qqtftptreemodel.cpp \
|
||||
$$PWD/gui/qqtsqltreemodel.cpp \
|
||||
$$PWD/gui/qqttablemodel.cpp \
|
||||
$$PWD/gui/qqttreemodel.cpp \
|
||||
$$PWD/gui/qqtxmltreemodel.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/gui/qqtftptreemodel.h \
|
||||
$$PWD/gui/qqtsqltreemodel.h \
|
||||
$$PWD/gui/qqttablemodel.h \
|
||||
$$PWD/gui/qqttreemodel.h \
|
||||
$$PWD/gui/qqtxmltreemodel.h \
|
||||
$$PWD/gui/qqtgui.h
|
||||
|
||||
|
||||
#multimedia
|
||||
SOURCES += $$PWD/multimedia/qqtmplayer.cpp
|
||||
HEADERS += $$PWD/multimedia/qqtmplayer.h
|
||||
|
||||
|
||||
#network
|
||||
equals(QT_KIT, MIPS32) {
|
||||
SOURCES += $$PWD/network/qqtethenetmanager.cpp
|
||||
HEADERS += $$PWD/network/qqtethenetmanager.h
|
||||
}
|
||||
##websocket
|
||||
SOURCES += $$PWD/network/qqtwebclient.cpp \
|
||||
$$PWD/network/qqtftpprotocol.cpp \
|
||||
$$PWD/network/qqthttpprotocol.cpp \
|
||||
$$PWD/network/qqtwebprotocol.cpp
|
||||
HEADERS += $$PWD/network/qqtwebclient.h \
|
||||
$$PWD/network/qqtftpprotocol.h \
|
||||
$$PWD/network/qqthttpprotocol.h \
|
||||
$$PWD/network/qqtwebprotocol.h
|
||||
#tcpsocket
|
||||
SOURCES += \
|
||||
$$PWD/network/qqtclient.cpp \
|
||||
$$PWD/network/qqtserialport.cpp \
|
||||
$$PWD/network/qqtserver.cpp \
|
||||
$$PWD/network/qqtmessage.cpp \
|
||||
$$PWD/network/qqtprotocol.cpp \
|
||||
$$PWD/network/qqtnetwork.cpp
|
||||
HEADERS += \
|
||||
$$PWD/network/qqtclient.h \
|
||||
$$PWD/network/qqtserialport.h \
|
||||
$$PWD/network/qqtserver.h \
|
||||
$$PWD/network/qqtmessage.h \
|
||||
$$PWD/network/qqtprotocol.h \
|
||||
$$PWD/network/qqtnetwork.h
|
||||
|
||||
#pluginwatcher
|
||||
win32 {
|
||||
wince*: SOURCES += $$PWD/pluginwatcher/qdevicewatcher_wince.cpp
|
||||
else: SOURCES += $$PWD/pluginwatcher/qdevicewatcher_win32.cpp
|
||||
}
|
||||
unix {
|
||||
macx {
|
||||
SOURCES += $$PWD/pluginwatcher/qdevicewatcher_mac.cpp
|
||||
} else {
|
||||
SOURCES += $$PWD/pluginwatcher/qdevicewatcher_linux.cpp
|
||||
}
|
||||
}
|
||||
SOURCES += $$PWD/pluginwatcher/qdevicewatcher.cpp \
|
||||
$$PWD/pluginwatcher/qqtpluginwatcher.cpp
|
||||
HEADERS += $$PWD/pluginwatcher/qqtpluginwatcher.h \
|
||||
$$PWD/pluginwatcher/qdevicewatcher.h \
|
||||
$$PWD/pluginwatcher/qdevicewatcher_p.h
|
||||
|
||||
#printsupport
|
||||
SOURCES += $$PWD/printsupport/qqtprinter.cpp
|
||||
HEADERS += $$PWD/printsupport/qqtprinter.h
|
||||
|
||||
|
||||
#sql
|
||||
SOURCES += $$PWD/sql/qqtsql.cpp
|
||||
HEADERS += $$PWD/sql/qqtsql.h
|
||||
|
||||
|
||||
#widgets
|
||||
SOURCES += \
|
||||
$$PWD/widgets/qqtcheckbox.cpp \
|
||||
$$PWD/widgets/qqtheaderview.cpp \
|
||||
$$PWD/widgets/qqtlistview.cpp \
|
||||
$$PWD/widgets/qqtprogressbar.cpp \
|
||||
$$PWD/widgets/qqtpushbutton.cpp \
|
||||
$$PWD/widgets/qqtradiobutton.cpp \
|
||||
$$PWD/widgets/qqttabbar.cpp \
|
||||
$$PWD/widgets/qqttableview.cpp \
|
||||
$$PWD/widgets/qqttabwidget.cpp \
|
||||
$$PWD/widgets/qqttabwidgetb.cpp \
|
||||
$$PWD/widgets/qqttreeview.cpp \
|
||||
$$PWD/widgets/qqtlineeditwithsearch.cpp \
|
||||
$$PWD/widgets/qqtmptablewidget.cpp \
|
||||
$$PWD/widgets/qqttablewidget.cpp \
|
||||
$$PWD/widgets/qqtgraphicsscene.cpp \
|
||||
$$PWD/widgets/qqtgraphicsitem.cpp \
|
||||
$$PWD/widgets/qqtgraphicsview.cpp \
|
||||
$$PWD/widgets/qqttreewidget.cpp \
|
||||
$$PWD/widgets/qqtwidget.cpp \
|
||||
$$PWD/widgets/qqtwidgets.cpp
|
||||
HEADERS += \
|
||||
$$PWD/widgets/qqtcheckbox.h \
|
||||
$$PWD/widgets/qqtheaderview.h \
|
||||
$$PWD/widgets/qqtlistview.h \
|
||||
$$PWD/widgets/qqtprogressbar.h \
|
||||
$$PWD/widgets/qqtpushbutton.h \
|
||||
$$PWD/widgets/qqtradiobutton.h \
|
||||
$$PWD/widgets/qqttabbar.h \
|
||||
$$PWD/widgets/qqttableview.h \
|
||||
$$PWD/widgets/qqttabwidget.h \
|
||||
$$PWD/widgets/qqttabwidgetb.h \
|
||||
$$PWD/widgets/qqttreeview.h \
|
||||
$$PWD/widgets/qqtlineeditwithsearch.h \
|
||||
$$PWD/widgets/qqtmptablewidget.h \
|
||||
$$PWD/widgets/qqttablewidget.h \
|
||||
$$PWD/widgets/qqtgraphicsscene.h \
|
||||
$$PWD/widgets/qqtgraphicsitem.h \
|
||||
$$PWD/widgets/qqtgraphicsview.h \
|
||||
$$PWD/widgets/qqttreewidget.h \
|
||||
$$PWD/widgets/qqtwidget.h \
|
||||
$$PWD/widgets/qqtwidgets.h
|
||||
FORMS += \
|
||||
$$PWD/widgets/qqtcheckbox.ui \
|
||||
$$PWD/widgets/qqtlistview.ui \
|
||||
$$PWD/widgets/qqtprogressbar.ui \
|
||||
$$PWD/widgets/qqtpushbutton.ui \
|
||||
$$PWD/widgets/qqtradiobutton.ui \
|
||||
$$PWD/widgets/qqttableview.ui \
|
||||
$$PWD/widgets/qqttabwidget.ui \
|
||||
$$PWD/widgets/qqttabwidgetb.ui \
|
||||
$$PWD/widgets/qqttreeview.ui \
|
||||
$$PWD/widgets/qqtwidget.ui \
|
||||
$$PWD/widgets/qqttablewidget.ui \
|
||||
$$PWD/widgets/qqtmptablewidget.ui \
|
||||
$$PWD/widgets/qqttreewidget.ui
|
41
src/qqtgui.h
41
src/qqtgui.h
@ -1,41 +0,0 @@
|
||||
#ifndef QQTGUI_H
|
||||
#define QQTGUI_H
|
||||
|
||||
#include "qqtversion.h"
|
||||
|
||||
/*
|
||||
#include "qqtcheckbox.h"
|
||||
#include "qqtradiobutton.h"
|
||||
#include "qqtpushbutton.h"
|
||||
#include "qqttabwidget.h"
|
||||
#include "qqttabwidgetb.h"
|
||||
#include "qqtprogressbar.h"
|
||||
#include "qqtdialog.h"
|
||||
#include "qqtlineeditwithsearch.h"
|
||||
#include "qqtplayer.h"
|
||||
#include "qqtword.h"
|
||||
#include "qqtreport.h"
|
||||
#include "qqtclient.h"
|
||||
#include "qqtethenetmanager.h"
|
||||
#include "qqtpluginwatcher.h"
|
||||
#include "qqtprinter.h"
|
||||
#include "qqtserver.h"
|
||||
#include "qqtserialport.h"
|
||||
#include "qqtuserserialprotocol.h"
|
||||
#include "qcustomplot.h"
|
||||
#include "qqtmsgbox.h"
|
||||
#include "qqtinput.h"
|
||||
|
||||
#include "qqttablewidget.h"
|
||||
#include "qqtmptablewidget.h"
|
||||
#include "qqtcloudtreewidget.h"
|
||||
|
||||
#include "qqtgraphicsitem.h"
|
||||
#include "qqtgraphicsscene.h"
|
||||
#include "qqtgraphicsview.h"
|
||||
|
||||
#include "qqtfilesystem.h"
|
||||
|
||||
#include "qqtanimation.h"
|
||||
*/
|
||||
#endif // QQTGUI_H
|
@ -1,22 +1,22 @@
|
||||
#ifndef QQTVERSION_H
|
||||
#define QQTVERSION_H
|
||||
|
||||
#define VER_FILEVERSION 1,0,0,0 //<EFBFBD>ļ<EFBFBD><EFBFBD>汾
|
||||
#define VER_FILEVERSION 1,0,0,0 //????<EFBFBD><EFBFBD>
|
||||
#define VER_FILEVERSION_STR "1.0.0.0"
|
||||
|
||||
#define VER_PRODUCTVERSION 1.0 //<EFBFBD><EFBFBD>Ʒ<EFBFBD>汾
|
||||
#define VER_PRODUCTVERSION 1.0 //????<EFBFBD><EFBFBD>
|
||||
#define VER_PRODUCTVERSION_MAJOR 1
|
||||
#define VER_PRODUCTVERSION_STR "1.0" //<EFBFBD><EFBFBD>Ʒ<EFBFBD>汾
|
||||
#define VER_PRODUCTVERSION_STR "1.0" //????<EFBFBD><EFBFBD>
|
||||
#define VER_PRODUCTVERSION_MAJOR_STR "1"
|
||||
|
||||
#define VER_COMPANYNAME_STR "QQT"
|
||||
#define VER_FILEDESCRIPTION_STR "QQT" //<EFBFBD>ļ<EFBFBD>˵<EFBFBD><EFBFBD>
|
||||
#define VER_FILEDESCRIPTION_STR "QQT" //??????
|
||||
#define VER_INTERNALNAME_STR "QQT"
|
||||
#define VER_LEGALCOPYRIGHT_STR "Copyright 2007-2017 QQT Co., Ltd." //<EFBFBD><EFBFBD>Ȩ
|
||||
#define VER_LEGALCOPYRIGHT_STR "Copyright 2007-2017 QQT Co., Ltd." //???
|
||||
#define VER_LEGALTRADEMARKS1_STR "All rights reserved"
|
||||
#define VER_LEGALTRADEMARKS2_STR "All rights reserved"
|
||||
#define VER_ORIGINALFILENAME_STR "QQT" //ԭʼ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
|
||||
#define VER_PRODUCTNAME_STR "QQT" //<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define VER_ORIGINALFILENAME_STR "QQT" //???????
|
||||
#define VER_PRODUCTNAME_STR "QQT" //???????
|
||||
|
||||
#define VER_COMPANYDOMAIN_STR "www.qqt.com"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <QDebug>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlError>
|
||||
#include <qqt.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -26,12 +27,12 @@ extern "C" {
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
QSqlDatabase newDatabaseConn();
|
||||
QQTSHARED_EXPORT QSqlDatabase newDatabaseConn();
|
||||
|
||||
void setDatabaseName(QSqlDatabase &db, QString dbName);
|
||||
QQTSHARED_EXPORT void setDatabaseName(QSqlDatabase &db, QString dbName);
|
||||
|
||||
void openDatabase(QSqlDatabase &db);
|
||||
QQTSHARED_EXPORT void openDatabase(QSqlDatabase &db);
|
||||
|
||||
void closeDatabase(QSqlDatabase &db);
|
||||
QQTSHARED_EXPORT void closeDatabase(QSqlDatabase &db);
|
||||
|
||||
#endif // QQTSQLDEFINE_H
|
||||
#endif // QQTSQLDEFINE_H
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QCheckBox>
|
||||
#include "qqtcore.h"
|
||||
#include "qqtwidgets.h"
|
||||
#include "qqt.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTCheckBox;
|
||||
@ -12,7 +13,7 @@ class QQTCheckBox;
|
||||
* @brief The QQTCheckBox class
|
||||
* 为了图片占据全部全部控件而编写。
|
||||
*/
|
||||
class QQTCheckBox : public QCheckBox
|
||||
class QQTSHARED_EXPORT QQTCheckBox : public QCheckBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -3,15 +3,16 @@
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QGraphicsProxyWidget>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQTGraphicsItem : public QGraphicsItem
|
||||
class QQTSHARED_EXPORT QQTGraphicsItem : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsItem(QQTGraphicsItem *parent = 0);
|
||||
|
||||
};
|
||||
|
||||
class QQTGraphicsTextItem : public QGraphicsTextItem
|
||||
class QQTSHARED_EXPORT QQTGraphicsTextItem : public QGraphicsTextItem
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsTextItem(QQTGraphicsItem *parent = 0);
|
||||
@ -23,7 +24,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class QQTGraphicsSimpleTextItem : public QGraphicsSimpleTextItem
|
||||
class QQTSHARED_EXPORT QQTGraphicsSimpleTextItem : public QGraphicsSimpleTextItem
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsSimpleTextItem(QQTGraphicsItem *parent = 0);
|
||||
@ -31,14 +32,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class QQTGraphicsPixmapItem : public QGraphicsPixmapItem
|
||||
class QQTSHARED_EXPORT QQTGraphicsPixmapItem : public QGraphicsPixmapItem
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsPixmapItem(QQTGraphicsItem *parent = 0);
|
||||
|
||||
};
|
||||
|
||||
class QQTGraphicsRectItem : public QGraphicsRectItem
|
||||
class QQTSHARED_EXPORT QQTGraphicsRectItem : public QGraphicsRectItem
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsRectItem(QQTGraphicsItem *parent = 0);
|
||||
@ -50,7 +51,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class QQTGraphicsLineItem : public QGraphicsLineItem
|
||||
class QQTSHARED_EXPORT QQTGraphicsLineItem : public QGraphicsLineItem
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsLineItem(QQTGraphicsItem *parent = 0);
|
||||
@ -64,7 +65,7 @@ public:
|
||||
|
||||
|
||||
|
||||
class QQTGraphicsPathItem : public QGraphicsPathItem
|
||||
class QQTSHARED_EXPORT QQTGraphicsPathItem : public QGraphicsPathItem
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsPathItem(QQTGraphicsItem *parent = 0);
|
||||
@ -72,7 +73,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class QQTGraphicsEllipseItem : public QGraphicsEllipseItem
|
||||
class QQTSHARED_EXPORT QQTGraphicsEllipseItem : public QGraphicsEllipseItem
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsEllipseItem(QQTGraphicsItem *parent = 0);
|
||||
@ -80,21 +81,21 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class QQTGraphicsPolygonItem : public QGraphicsPolygonItem
|
||||
class QQTSHARED_EXPORT QQTGraphicsPolygonItem : public QGraphicsPolygonItem
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsPolygonItem(QQTGraphicsItem *parent = 0);
|
||||
|
||||
};
|
||||
|
||||
class QQTGraphicsItemGroup : public QGraphicsItemGroup
|
||||
class QQTSHARED_EXPORT QQTGraphicsItemGroup : public QGraphicsItemGroup
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsItemGroup(QQTGraphicsItem *parent = 0);
|
||||
|
||||
};
|
||||
|
||||
class QQTGraphicsProxyWidget : public QGraphicsProxyWidget
|
||||
class QQTSHARED_EXPORT QQTGraphicsProxyWidget : public QGraphicsProxyWidget
|
||||
{
|
||||
public:
|
||||
explicit QQTGraphicsProxyWidget(QQTGraphicsItem *parent = 0);
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <QGraphicsItem>
|
||||
#include <QPainter>
|
||||
#include "qqtcore.h"
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
QQTGraphicsScene::QQTGraphicsScene(QObject *parent) :
|
||||
QGraphicsScene(parent)
|
||||
{
|
||||
|
@ -3,8 +3,9 @@
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include "qqtgraphicsitem.h"
|
||||
#include <qqt.h>
|
||||
|
||||
class QQTGraphicsScene : public QGraphicsScene
|
||||
class QQTSHARED_EXPORT QQTGraphicsScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include "qqtcore.h"
|
||||
#include "qqtgraphicsscene.h"
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
|
||||
QQTGraphicsView::QQTGraphicsView(QWidget *parent) :
|
||||
QGraphicsView(parent)
|
||||
|
@ -2,9 +2,9 @@
|
||||
#define QQTGRAPHICSVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <qqt.h>
|
||||
|
||||
|
||||
class QQTGraphicsView : public QGraphicsView
|
||||
class QQTSHARED_EXPORT QQTGraphicsView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -2,8 +2,9 @@
|
||||
#define QQTHEADERVIEW_H
|
||||
|
||||
#include <QHeaderView>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQTHeaderView : public QHeaderView
|
||||
class QQTSHARED_EXPORT QQTHeaderView : public QHeaderView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -3,8 +3,9 @@
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <qqt.h>
|
||||
|
||||
class QQTLineEditWithSearch : public QLineEdit
|
||||
class QQTSHARED_EXPORT QQTLineEditWithSearch : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -2,12 +2,13 @@
|
||||
#define QQTLISTVIEW_H
|
||||
|
||||
#include <QListView>
|
||||
#include <qqt.h>
|
||||
|
||||
namespace Ui {
|
||||
class QQTListView;
|
||||
}
|
||||
|
||||
class QQTListView : public QListView
|
||||
class QQTSHARED_EXPORT QQTListView : public QListView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "ui_qqtmptablewidget.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqtsql.h"
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
|
||||
QQTMPTableWidget::QQTMPTableWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <QHeaderView>
|
||||
#include <QTableView>
|
||||
#include "qqttablewidget.h"
|
||||
#include "qqt.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTMPTableWidget;
|
||||
@ -17,7 +18,7 @@ class QQTMPTableWidget;
|
||||
* 这里的控件使用默认视图
|
||||
* 这里的控件只是Table-DB关系,没有Tree/List模型
|
||||
*/
|
||||
class QQTMPTableWidget : public QWidget
|
||||
class QQTSHARED_EXPORT QQTMPTableWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -7,12 +7,13 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include "qqtwidgets.h"
|
||||
#include "qqt.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTProgressBar;
|
||||
}
|
||||
|
||||
class QQTProgressBar : public QWidget
|
||||
class QQTSHARED_EXPORT QQTProgressBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -3,12 +3,13 @@
|
||||
|
||||
#include <QPushButton>
|
||||
#include "qqtwidgets.h"
|
||||
#include <qqt.h>
|
||||
|
||||
namespace Ui {
|
||||
class QQTPushButton;
|
||||
}
|
||||
|
||||
class QQTPushButton : public QPushButton
|
||||
class QQTSHARED_EXPORT QQTPushButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -4,12 +4,13 @@
|
||||
#include <QRadioButton>
|
||||
#include "qqtcore.h"
|
||||
#include "qqtwidgets.h"
|
||||
#include "qqt.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTRadioButton;
|
||||
}
|
||||
|
||||
class QQTRadioButton : public QRadioButton
|
||||
class QQTSHARED_EXPORT QQTRadioButton : public QRadioButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -5,8 +5,9 @@
|
||||
#include <QList>
|
||||
#include "qqtcore.h"
|
||||
#include "qqtwidgets.h"
|
||||
#include "qqt.h"
|
||||
|
||||
class QQTTabBar : public QTabBar
|
||||
class QQTSHARED_EXPORT QQTTabBar : public QTabBar
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -3,12 +3,13 @@
|
||||
|
||||
#include <QTableView>
|
||||
#include "qqtheaderview.h"
|
||||
#include "qqt.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTTableView;
|
||||
}
|
||||
|
||||
class QQTTableView : public QTableView
|
||||
class QQTSHARED_EXPORT QQTTableView : public QTableView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "qqttablewidget.h"
|
||||
#include "ui_qqttablewidget.h"
|
||||
|
||||
#include "qqtgui-qt.h"
|
||||
#include "qqt-qt.h"
|
||||
#include "qqtcore.h"
|
||||
#include "qqtsql.h"
|
||||
|
||||
|
@ -3,12 +3,13 @@
|
||||
|
||||
#include "qqttableview.h"
|
||||
#include "qqttablemodel.h"
|
||||
#include "qqt.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTTableWidget;
|
||||
}
|
||||
|
||||
class QQTTableWidget : public QQTTableView
|
||||
class QQTSHARED_EXPORT QQTTableWidget : public QQTTableView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -3,12 +3,13 @@
|
||||
|
||||
#include <QTabWidget>
|
||||
#include "qqttabbar.h"
|
||||
#include "qqt.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTTabWidget;
|
||||
}
|
||||
|
||||
class QQTTabWidget : public QTabWidget
|
||||
class QQTSHARED_EXPORT QQTTabWidget : public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -2,12 +2,13 @@
|
||||
#define QQTTABWIDGETB_H
|
||||
|
||||
#include <QTabWidget>
|
||||
#include <qqt.h>
|
||||
|
||||
namespace Ui {
|
||||
class QQTTabWidgetB;
|
||||
}
|
||||
|
||||
class QQTTabWidgetB : public QTabWidget
|
||||
class QQTSHARED_EXPORT QQTTabWidgetB : public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -2,12 +2,13 @@
|
||||
#define QQTTREEVIEW_H
|
||||
|
||||
#include <QTreeView>
|
||||
#include <qqt.h>
|
||||
|
||||
namespace Ui {
|
||||
class QQTTreeView;
|
||||
}
|
||||
|
||||
class QQTTreeView : public QTreeView
|
||||
class QQTSHARED_EXPORT QQTTreeView : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -3,12 +3,13 @@
|
||||
|
||||
#include "qqttreeview.h"
|
||||
#include "qqttreemodel.h"
|
||||
#include "qqt.h"
|
||||
|
||||
namespace Ui {
|
||||
class QQTTreeWidget;
|
||||
}
|
||||
|
||||
class QQTTreeWidget : public QQTTreeView
|
||||
class QQTSHARED_EXPORT QQTTreeWidget : public QQTTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -2,12 +2,13 @@
|
||||
#define QPICWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <qqt.h>
|
||||
|
||||
namespace Ui {
|
||||
class QQTWidget;
|
||||
}
|
||||
|
||||
class QQTWidget : public QWidget
|
||||
class QQTSHARED_EXPORT QQTWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <QElapsedTimer>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDebug>
|
||||
#include "qqt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -34,7 +35,7 @@ enum
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct tagBtnIconTable
|
||||
typedef struct QQTSHARED_EXPORT tagBtnIconTable
|
||||
{
|
||||
QString pixmap[BTN_MAX];
|
||||
|
||||
@ -49,10 +50,10 @@ typedef struct tagBtnIconTable
|
||||
}TBtnIconTable;
|
||||
|
||||
|
||||
void moveCenter(QWidget* w);
|
||||
QQTSHARED_EXPORT void moveCenter(QWidget* w);
|
||||
|
||||
void moveRight(QWidget* w);
|
||||
QQTSHARED_EXPORT void moveRight(QWidget* w);
|
||||
|
||||
|
||||
|
||||
#endif //__QQT_WIDGETS_DEFINE_H__
|
||||
#endif //__QQT_WIDGETS_DEFINE_H__
|
||||
|
Loading…
x
Reference in New Issue
Block a user